netfilter: kill redundant check code in which setting ip_summed value
authorShan Wei <shanwei@cn.fujitsu.com>
Mon, 14 Jun 2010 14:20:02 +0000 (16:20 +0200)
committerPatrick McHardy <kaber@trash.net>
Mon, 14 Jun 2010 14:20:02 +0000 (16:20 +0200)
If the returned csum value is 0, We has set ip_summed with
CHECKSUM_UNNECESSARY flag in __skb_checksum_complete_head().

So this patch kills the check and changes to return to upper
caller directly.

Signed-off-by: Shan Wei <shanwei@cn.fujitsu.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
net/ipv4/netfilter.c
net/ipv6/netfilter.c

index 07de855e2175ea1f40760c84388388d4676f30b0..acd1ea87ba51bda60f7aa3f14d809fa33eeffde5 100644 (file)
@@ -212,9 +212,7 @@ static __sum16 nf_ip_checksum_partial(struct sk_buff *skb, unsigned int hook,
                skb->csum = csum_tcpudp_nofold(iph->saddr, iph->daddr, protocol,
                                               skb->len - dataoff, 0);
                skb->ip_summed = CHECKSUM_NONE;
-               csum = __skb_checksum_complete_head(skb, dataoff + len);
-               if (!csum)
-                       skb->ip_summed = CHECKSUM_UNNECESSARY;
+               return __skb_checksum_complete_head(skb, dataoff + len);
        }
        return csum;
 }
index a74951c039b6abdcc8844202b082eefd15da7da1..7155b2451d7cf297ab2b87d244e217ccf82f4071 100644 (file)
@@ -151,9 +151,7 @@ static __sum16 nf_ip6_checksum_partial(struct sk_buff *skb, unsigned int hook,
                                                         protocol,
                                                         csum_sub(0, hsum)));
                skb->ip_summed = CHECKSUM_NONE;
-               csum = __skb_checksum_complete_head(skb, dataoff + len);
-               if (!csum)
-                       skb->ip_summed = CHECKSUM_UNNECESSARY;
+               return __skb_checksum_complete_head(skb, dataoff + len);
        }
        return csum;
 };