diff options
author | glebius <glebius@FreeBSD.org> | 2010-09-06 13:17:01 +0000 |
---|---|---|
committer | glebius <glebius@FreeBSD.org> | 2010-09-06 13:17:01 +0000 |
commit | d14214d82c78bb3c7777f40611a72c143116ecd0 (patch) | |
tree | ac56ef88c5ed5a8aff70da3f068fe7b42d4c7c60 /sys/netinet | |
parent | 7a9b1a4d4217898357011517c5c227a353fd3cb7 (diff) | |
download | FreeBSD-src-d14214d82c78bb3c7777f40611a72c143116ecd0.zip FreeBSD-src-d14214d82c78bb3c7777f40611a72c143116ecd0.tar.gz |
in_delayed_cksum() requires host byte order.
Reported by: Alexander Levin <amindomao googlemail.com>
MFC after: 1 week
Diffstat (limited to 'sys/netinet')
-rw-r--r-- | sys/netinet/ipfw/ip_fw_nat.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/sys/netinet/ipfw/ip_fw_nat.c b/sys/netinet/ipfw/ip_fw_nat.c index f30b754..6f223ed 100644 --- a/sys/netinet/ipfw/ip_fw_nat.c +++ b/sys/netinet/ipfw/ip_fw_nat.c @@ -295,12 +295,9 @@ ipfw_nat(struct ip_fw_args *args, struct cfg_nat *t, struct mbuf *m) struct udphdr *uh; u_short cksum; - /* XXX check if ip_len can stay in net format */ - cksum = in_pseudo( - ip->ip_src.s_addr, - ip->ip_dst.s_addr, - htons(ip->ip_p + ntohs(ip->ip_len) - (ip->ip_hl << 2)) - ); + ip->ip_len = ntohs(ip->ip_len); + cksum = in_pseudo(ip->ip_src.s_addr, ip->ip_dst.s_addr, + htons(ip->ip_p + ip->ip_len - (ip->ip_hl << 2))); switch (ip->ip_p) { case IPPROTO_TCP: @@ -326,6 +323,7 @@ ipfw_nat(struct ip_fw_args *args, struct cfg_nat *t, struct mbuf *m) in_delayed_cksum(mcl); mcl->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA; } + ip->ip_len = htons(ip->ip_len); } args->m = mcl; return (IP_FW_NAT); |