diff options
author | bz <bz@FreeBSD.org> | 2008-03-09 13:26:50 +0000 |
---|---|---|
committer | bz <bz@FreeBSD.org> | 2008-03-09 13:26:50 +0000 |
commit | 130655d8aa00a45e57525071e11cad7735562a85 (patch) | |
tree | f2eb56053328506f279e9284baa172f2b2ba172a /sys/netinet/tcp_output.c | |
parent | af8220297084dd222e3114c4b65b1f6cb2ee6765 (diff) | |
download | FreeBSD-src-130655d8aa00a45e57525071e11cad7735562a85.zip FreeBSD-src-130655d8aa00a45e57525071e11cad7735562a85.tar.gz |
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
Diffstat (limited to 'sys/netinet/tcp_output.c')
-rw-r--r-- | sys/netinet/tcp_output.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c index 1c0ef90..44adab6 100644 --- a/sys/netinet/tcp_output.c +++ b/sys/netinet/tcp_output.c @@ -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__)); |