o Remove unused and redundant TCP option definitions
o Replace usage of MAX_TCPOPTLEN with the correctly constructed and derived MAX_TCPOPTLEN
This commit is contained in:
parent
edec8cf92b
commit
853a532b7f
@ -91,18 +91,9 @@ struct tcphdr {
|
||||
#define TCPOPT_TIMESTAMP 8
|
||||
#define TCPOLEN_TIMESTAMP 10
|
||||
#define TCPOLEN_TSTAMP_APPA (TCPOLEN_TIMESTAMP+2) /* appendix A */
|
||||
#define TCPOPT_TSTAMP_HDR \
|
||||
(TCPOPT_NOP<<24|TCPOPT_NOP<<16|TCPOPT_TIMESTAMP<<8|TCPOLEN_TIMESTAMP)
|
||||
|
||||
#define MAX_TCPOPTLEN 40 /* Absolute maximum TCP options len */
|
||||
|
||||
#define TCPOPT_SIGNATURE 19 /* Keyed MD5: RFC 2385 */
|
||||
#define TCPOPT_SIGNATURE 19 /* Keyed MD5: RFC 2385 */
|
||||
#define TCPOLEN_SIGNATURE 18
|
||||
|
||||
/* Option definitions */
|
||||
#define TCPOPT_SACK_PERMIT_HDR \
|
||||
(TCPOPT_NOP<<24|TCPOPT_NOP<<16|TCPOPT_SACK_PERMITTED<<8|TCPOLEN_SACK_PERMITTED)
|
||||
#define TCPOPT_SACK_HDR (TCPOPT_NOP<<24|TCPOPT_NOP<<16|TCPOPT_SACK<<8)
|
||||
/* Miscellaneous constants */
|
||||
#define MAX_SACK_BLKS 6 /* Max # SACK blocks stored at receiver side */
|
||||
#define TCP_MAX_SACK 4 /* MAX # SACKs sent in any segment */
|
||||
|
@ -1319,7 +1319,7 @@ tcp_addoptions(struct tcpopt *to, u_char *optp)
|
||||
optlen += TCPOLEN_NOP;
|
||||
*optp++ = TCPOPT_NOP;
|
||||
}
|
||||
if (MAX_TCPOPTLEN - optlen < TCPOLEN_SIGNATURE)
|
||||
if (TCP_MAXOLEN - optlen < TCPOLEN_SIGNATURE)
|
||||
continue;
|
||||
optlen += TCPOLEN_SIGNATURE;
|
||||
*optp++ = TCPOPT_SIGNATURE;
|
||||
@ -1339,12 +1339,12 @@ tcp_addoptions(struct tcpopt *to, u_char *optp)
|
||||
optlen += TCPOLEN_NOP;
|
||||
*optp++ = TCPOPT_NOP;
|
||||
}
|
||||
if (MAX_TCPOPTLEN - optlen < 2 + TCPOLEN_SACK)
|
||||
if (TCP_MAXOLEN - optlen < 2 + TCPOLEN_SACK)
|
||||
continue;
|
||||
optlen += TCPOLEN_SACKHDR;
|
||||
*optp++ = TCPOPT_SACK;
|
||||
sackblks = min(to->to_nsacks,
|
||||
(MAX_TCPOPTLEN - optlen) / TCPOLEN_SACK);
|
||||
(TCP_MAXOLEN - optlen) / TCPOLEN_SACK);
|
||||
*optp++ = TCPOLEN_SACKHDR + sackblks * TCPOLEN_SACK;
|
||||
while (sackblks--) {
|
||||
sack_seq = htonl(sack->start);
|
||||
@ -1375,6 +1375,6 @@ tcp_addoptions(struct tcpopt *to, u_char *optp)
|
||||
*optp++ = TCPOPT_NOP;
|
||||
}
|
||||
|
||||
KASSERT(optlen <= MAX_TCPOPTLEN, ("%s: TCP options too long", __func__));
|
||||
KASSERT(optlen <= TCP_MAXOLEN, ("%s: TCP options too long", __func__));
|
||||
return (optlen);
|
||||
}
|
||||
|
@ -1108,7 +1108,7 @@ syncache_respond(struct syncache *sc)
|
||||
mssopt = max( min(sc->sc_peer_mss, mssopt), tcp_minmss);
|
||||
|
||||
/* XXX: Assume that the entire packet will fit in a header mbuf. */
|
||||
KASSERT(max_linkhdr + tlen + MAX_TCPOPTLEN <= MHLEN,
|
||||
KASSERT(max_linkhdr + tlen + TCP_MAXOLEN <= MHLEN,
|
||||
("syncache: mbuf too small"));
|
||||
|
||||
/* Create the IP+TCP header from scratch. */
|
||||
|
Loading…
x
Reference in New Issue
Block a user