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
This commit is contained in:
Bruce M Simpson 2004-06-18 03:31:07 +00:00
parent c012260726
commit 5214cb3f59
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=130666

View File

@ -883,9 +883,18 @@ tcp_output(struct tcpcb *tp)
* 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