To my reading there are no real consumers of ip6_plen (IPv6

Payload Length) as set in tcpip_fillheaders().
ip6_output() will calculate it based of the length from the
mbuf packet header itself.
So initialize the value in tcpip_fillheaders() in correct
(network) byte order.

With the above change, to my reading, all places calling tcp_trace()
pass in the ip6 header via ipgen as serialized in the mbuf and with
ip6_plen in network byte order.
Thus convert the IPv6 payload length to host byte order before printing.

MFC after:	2 months
This commit is contained in:
Bjoern A. Zeeb 2008-09-07 20:44:45 +00:00
parent bbe9d8cba9
commit 00db174bc2
2 changed files with 2 additions and 2 deletions

View File

@ -171,7 +171,7 @@ tcp_trace(short act, short ostate, struct tcpcb *tp, void *ipgen,
ack = th->th_ack;
len =
#ifdef INET6
isipv6 ? ((struct ip6_hdr *)ipgen)->ip6_plen :
isipv6 ? ntohs(((struct ip6_hdr *)ipgen)->ip6_plen) :
#endif
((struct ip *)ipgen)->ip_len;
if (act == TA_OUTPUT) {

View File

@ -381,7 +381,7 @@ tcpip_fillheaders(struct inpcb *inp, void *ip_ptr, void *tcp_ptr)
ip6->ip6_vfc = (ip6->ip6_vfc & ~IPV6_VERSION_MASK) |
(IPV6_VERSION & IPV6_VERSION_MASK);
ip6->ip6_nxt = IPPROTO_TCP;
ip6->ip6_plen = sizeof(struct tcphdr);
ip6->ip6_plen = htons(sizeof(struct tcphdr));
ip6->ip6_src = inp->in6p_laddr;
ip6->ip6_dst = inp->in6p_faddr;
} else