diff options
author | bms <bms@FreeBSD.org> | 2004-06-18 03:31:07 +0000 |
---|---|---|
committer | bms <bms@FreeBSD.org> | 2004-06-18 03:31:07 +0000 |
commit | 3163bfb503d9be02b08b47903e08eb464713c080 (patch) | |
tree | 3c5048d0f178d2ea75c9e9d95f2d2d737687df31 /sys/netinet | |
parent | d87fad9f086c5e1c8af4ba8e1373bcc73f21dce5 (diff) | |
download | FreeBSD-src-3163bfb503d9be02b08b47903e08eb464713c080.zip FreeBSD-src-3163bfb503d9be02b08b47903e08eb464713c080.tar.gz |
If SO_DEBUG is enabled for a TCP socket, and a received segment is
encapsulated within an IPv6 datagram, do not abuse the 'ipov' pointer
when registering trace records. 'ipov' is specific to IPv4, and
will therefore be uninitialized.
[This fandango is only necessary in the first place because of our
host-byte-order IP field pessimization.]
PR: kern/60856
Submitted by: Galois Zheng
Diffstat (limited to 'sys/netinet')
-rw-r--r-- | sys/netinet/tcp_output.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c index 7d48eef..621b524 100644 --- a/sys/netinet/tcp_output.c +++ b/sys/netinet/tcp_output.c @@ -883,9 +883,18 @@ send: * Trace. */ if (so->so_options & SO_DEBUG) { - u_short save = ipov->ih_len; - ipov->ih_len = htons(m->m_pkthdr.len /* - hdrlen + (th->th_off << 2) */); + u_short save; +#ifdef INET6 + if (!isipv6) +#endif + { + save = ipov->ih_len; + ipov->ih_len = htons(m->m_pkthdr.len /* - hdrlen + (th->th_off << 2) */); + } tcp_trace(TA_OUTPUT, tp->t_state, tp, mtod(m, void *), th, 0); +#ifdef INET6 + if (!isipv6) +#endif ipov->ih_len = save; } #endif |