aboutsummaryrefslogtreecommitdiff
path: root/sys/netgraph/ng_nat.c
diff options
context:
space:
mode:
authorGleb Smirnoff <glebius@FreeBSD.org>2012-10-08 08:03:58 +0000
committerGleb Smirnoff <glebius@FreeBSD.org>2012-10-08 08:03:58 +0000
commit23e9c6dc1ecc5660dbf815858ca2291f550c0951 (patch)
treeed251f6dc49084fa197a5fcd1cfd8cde5bf56695 /sys/netgraph/ng_nat.c
parente010b0551764c84c848f5b1c31896f017ff3cbfd (diff)
downloadsrc-23e9c6dc1ecc5660dbf815858ca2291f550c0951.tar.gz
src-23e9c6dc1ecc5660dbf815858ca2291f550c0951.zip
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().
Notes
Notes: svn path=/head/; revision=241344
Diffstat (limited to 'sys/netgraph/ng_nat.c')
-rw-r--r--sys/netgraph/ng_nat.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/netgraph/ng_nat.c b/sys/netgraph/ng_nat.c
index 59818d9ced83..fc39e3e0799a 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);
}
}