summaryrefslogtreecommitdiffstats
path: root/sys/netinet
diff options
context:
space:
mode:
authorbz <bz@FreeBSD.org>2008-09-07 20:44:45 +0000
committerbz <bz@FreeBSD.org>2008-09-07 20:44:45 +0000
commit8aa58e5530462a60204cb3e32cd0a1646bcd3580 (patch)
treecabdffa2fcc20b04fa2fa3e781fdd1aeb79eed66 /sys/netinet
parentc609890a53fdaa4762db2916aa386874d4c18f8f (diff)
downloadFreeBSD-src-8aa58e5530462a60204cb3e32cd0a1646bcd3580.zip
FreeBSD-src-8aa58e5530462a60204cb3e32cd0a1646bcd3580.tar.gz
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
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/tcp_debug.c2
-rw-r--r--sys/netinet/tcp_subr.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/sys/netinet/tcp_debug.c b/sys/netinet/tcp_debug.c
index aaeac9d..a82943d 100644
--- a/sys/netinet/tcp_debug.c
+++ b/sys/netinet/tcp_debug.c
@@ -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) {
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c
index 1d24991..f349ecc 100644
--- a/sys/netinet/tcp_subr.c
+++ b/sys/netinet/tcp_subr.c
@@ -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
OpenPOWER on IntegriCloud