diff options
author | glebius <glebius@FreeBSD.org> | 2012-10-08 08:03:58 +0000 |
---|---|---|
committer | glebius <glebius@FreeBSD.org> | 2012-10-08 08:03:58 +0000 |
commit | 9086143e8c44d2b1e0e51b8ec7ca16698d37dc15 (patch) | |
tree | ed251f6dc49084fa197a5fcd1cfd8cde5bf56695 /sys/netgraph | |
parent | 5ab12d2aed81a42842ab0cda5a1843c0e23fb249 (diff) | |
download | FreeBSD-src-9086143e8c44d2b1e0e51b8ec7ca16698d37dc15.zip FreeBSD-src-9086143e8c44d2b1e0e51b8ec7ca16698d37dc15.tar.gz |
After r241245 it appeared that in_delayed_cksum(), which still expects
host byte order, was sometimes called with net byte order. Since we are
moving towards net byte order throughout the stack, the function was
converted to expect net byte order, and its consumers fixed appropriately:
- ip_output(), ipfilter(4) not changed, since already call
in_delayed_cksum() with header in net byte order.
- divert(4), ng_nat(4), ipfw_nat(4) now don't need to swap byte order
there and back.
- mrouting code and IPv6 ipsec now need to switch byte order there and
back, but I hope, this is temporary solution.
- In ipsec(4) shifted switch to net byte order prior to in_delayed_cksum().
- pf_route() catches up on r241245 changes to ip_output().
Diffstat (limited to 'sys/netgraph')
-rw-r--r-- | sys/netgraph/ng_nat.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/netgraph/ng_nat.c b/sys/netgraph/ng_nat.c index 59818d9..fc39e3e 100644 --- a/sys/netgraph/ng_nat.c +++ b/sys/netgraph/ng_nat.c @@ -756,18 +756,18 @@ ng_nat_rcvdata(hook_p hook, item_p item ) */ if (th->th_x2) { + uint16_t ip_len = ntohs(ip->ip_len); + th->th_x2 = 0; - ip->ip_len = ntohs(ip->ip_len); th->th_sum = in_pseudo(ip->ip_src.s_addr, ip->ip_dst.s_addr, htons(IPPROTO_TCP + - ip->ip_len - (ip->ip_hl << 2))); + ip_len - (ip->ip_hl << 2))); if ((m->m_pkthdr.csum_flags & CSUM_TCP) == 0) { m->m_pkthdr.csum_data = offsetof(struct tcphdr, th_sum); in_delayed_cksum(m); } - ip->ip_len = htons(ip->ip_len); } } |