All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] netfilter: kill redundant check code in which setting ip_summed value
@ 2010-06-10  8:14 Shan Wei
  2010-06-14 14:22 ` Patrick McHardy
  0 siblings, 1 reply; 2+ messages in thread
From: Shan Wei @ 2010-06-10  8:14 UTC (permalink / raw)
  To: Patrick McHardy; +Cc: netfilter-devel

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>
---
 net/ipv4/netfilter.c |    4 +---
 net/ipv6/netfilter.c |    4 +---
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/net/ipv4/netfilter.c b/net/ipv4/netfilter.c
index 07de855..acd1ea8 100644
--- a/net/ipv4/netfilter.c
+++ b/net/ipv4/netfilter.c
@@ -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;
 }
diff --git a/net/ipv6/netfilter.c b/net/ipv6/netfilter.c
index a74951c..7155b24 100644
--- a/net/ipv6/netfilter.c
+++ b/net/ipv6/netfilter.c
@@ -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;
 };
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] netfilter: kill redundant check code in which setting ip_summed value
  2010-06-10  8:14 [PATCH] netfilter: kill redundant check code in which setting ip_summed value Shan Wei
@ 2010-06-14 14:22 ` Patrick McHardy
  0 siblings, 0 replies; 2+ messages in thread
From: Patrick McHardy @ 2010-06-14 14:22 UTC (permalink / raw)
  To: Shan Wei; +Cc: netfilter-devel

Shan Wei wrote:
> 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.
>
>   

Applied, thanks.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-06-14 14:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-10  8:14 [PATCH] netfilter: kill redundant check code in which setting ip_summed value Shan Wei
2010-06-14 14:22 ` Patrick McHardy

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.