net: tcp: Be explicit about the max Window Scale
authorBarret Rhoden <brho@cs.berkeley.edu>
Mon, 26 Jun 2017 16:39:30 +0000 (12:39 -0400)
committerBarret Rhoden <brho@cs.berkeley.edu>
Fri, 21 Jul 2017 15:52:54 +0000 (11:52 -0400)
RFC 7323

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
kern/src/net/tcp.c

index fd0999c..88330e0 100644 (file)
@@ -90,6 +90,7 @@ enum {
        MSS_LENGTH = 4, /* max segment size header option length */
        WSOPT = 3,
        WS_LENGTH = 3,  /* WS header option length */
+       MAX_WS_VALUE = 14,      /* RFC specified.  Limits available window to 2^30 */
        TS_OPT = 8,
        TS_LENGTH = 10,
        TS_SEND_PREPAD = 2,     /* For non-SYNs, pre-pad 2 nops for 32 byte alignment */
@@ -1187,7 +1188,7 @@ static void parse_inbound_opts(Tcp *tcph, uint8_t *opt, uint16_t optsize)
                                        tcph->mss = nhgets(opt + 2);
                                break;
                        case WSOPT:
-                               if (optlen == WS_LENGTH && *(opt + 2) <= 14)
+                               if (optlen == WS_LENGTH && *(opt + 2) <= MAX_WS_VALUE)
                                        tcph->ws = HaveWS | *(opt + 2);
                                break;
                        case SACK_OK_OPT: