Padding after EOL option must be zeros according to RFC793 but

the NOPs used are 0x01.
While we could simply pad with EOLs (which are 0x00), rather use an
explicit 0x00 constant there to not confuse poeple with 'EOL padding'.
Put in a comment saying just that.

Problem discussed on:	src-committers with andre, silby, dwhite as
			follow up to the rev. 1.161 commit of tcp_var.h.
MFC after:		11 days
This commit is contained in:
Bjoern A. Zeeb 2008-03-09 13:26:50 +00:00
parent 08995e292e
commit 413deb1262

View File

@ -1386,9 +1386,17 @@ tcp_addoptions(struct tcpopt *to, u_char *optp)
optlen += TCPOLEN_EOL;
*optp++ = TCPOPT_EOL;
}
/*
* According to RFC 793 (STD0007):
* "The content of the header beyond the End-of-Option option
* must be header padding (i.e., zero)."
* and later: "The padding is composed of zeros."
* While EOLs are zeros use an explicit 0x00 here to not confuse
* people with padding of EOLs.
*/
while (optlen % 4) {
optlen += TCPOLEN_NOP;
*optp++ = TCPOPT_NOP;
optlen += 1;
*optp++ = 0x00;
}
KASSERT(optlen <= TCP_MAXOLEN, ("%s: TCP options too long", __func__));