Commit db9863b9 authored by Rusty Russell's avatar Rusty Russell Committed by David S. Miller

[NETFILTER]: Fix skb_checksum args in ip_nat_core.c

parent 2983d523
...@@ -861,6 +861,7 @@ icmp_reply_translation(struct sk_buff **pskb, ...@@ -861,6 +861,7 @@ icmp_reply_translation(struct sk_buff **pskb,
} *inside; } *inside;
unsigned int i; unsigned int i;
struct ip_nat_info *info = &conntrack->nat.info; struct ip_nat_info *info = &conntrack->nat.info;
int hdrlen;
if (!skb_ip_make_writable(pskb,(*pskb)->nh.iph->ihl*4+sizeof(*inside))) if (!skb_ip_make_writable(pskb,(*pskb)->nh.iph->ihl*4+sizeof(*inside)))
return 0; return 0;
...@@ -868,10 +869,12 @@ icmp_reply_translation(struct sk_buff **pskb, ...@@ -868,10 +869,12 @@ icmp_reply_translation(struct sk_buff **pskb,
/* We're actually going to mangle it beyond trivial checksum /* We're actually going to mangle it beyond trivial checksum
adjustment, so make sure the current checksum is correct. */ adjustment, so make sure the current checksum is correct. */
if ((*pskb)->ip_summed != CHECKSUM_UNNECESSARY if ((*pskb)->ip_summed != CHECKSUM_UNNECESSARY) {
&& (u16)csum_fold(skb_checksum(*pskb, (*pskb)->nh.iph->ihl*4, hdrlen = (*pskb)->nh.iph->ihl * 4;
(*pskb)->len, 0))) if ((u16)csum_fold(skb_checksum(*pskb, hdrlen,
(*pskb)->len - hdrlen, 0)))
return 0; return 0;
}
/* Must be RELATED */ /* Must be RELATED */
IP_NF_ASSERT((*pskb)->nfct IP_NF_ASSERT((*pskb)->nfct
...@@ -948,10 +951,12 @@ icmp_reply_translation(struct sk_buff **pskb, ...@@ -948,10 +951,12 @@ icmp_reply_translation(struct sk_buff **pskb,
} }
READ_UNLOCK(&ip_nat_lock); READ_UNLOCK(&ip_nat_lock);
hdrlen = (*pskb)->nh.iph->ihl * 4;
inside->icmp.checksum = 0; inside->icmp.checksum = 0;
inside->icmp.checksum = csum_fold(skb_checksum(*pskb, inside->icmp.checksum = csum_fold(skb_checksum(*pskb, hdrlen,
(*pskb)->nh.iph->ihl*4, (*pskb)->len - hdrlen,
(*pskb)->len, 0)); 0));
return 1; return 1;
unlock_fail: unlock_fail:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment