Patchwork netfilter: Only do skb_checksum_help on CHECKSUM_PARTIAL in ip_queue

login
register
mail settings
Submitter Herbert Xu
Date April 8, 2010, 12:35 p.m.
Message ID <20100408123545.GA23829@gondor.apana.org.au>
Download mbox | patch
Permalink /patch/49728/
State Not Applicable
Delegated to: David Miller
Headers show

Comments

Herbert Xu - April 8, 2010, 12:35 p.m.
Hi:

netfilter: Only do skb_checksum_help on CHECKSUM_PARTIAL in ip_queue

While doing yet another audit on ip_summed I noticed ip_queue
calling skb_checksum_help unnecessarily.  As we will set ip_summed
to CHECKSUM_NONE when necessary in ipq_mangle_ipv4, there is no
need to zap CHECKSUM_COMPLETE in ipq_build_packet_message.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>


Cheers,
Patrick McHardy - April 8, 2010, 12:53 p.m.
Herbert Xu wrote:
> Hi:
> 
> netfilter: Only do skb_checksum_help on CHECKSUM_PARTIAL in ip_queue
> 
> While doing yet another audit on ip_summed I noticed ip_queue
> calling skb_checksum_help unnecessarily.  As we will set ip_summed
> to CHECKSUM_NONE when necessary in ipq_mangle_ipv4, there is no
> need to zap CHECKSUM_COMPLETE in ipq_build_packet_message.

Applied, thanks Herbert.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/net/ipv4/netfilter/ip_queue.c b/net/ipv4/netfilter/ip_queue.c
index e278704..c838238 100644
--- a/net/ipv4/netfilter/ip_queue.c
+++ b/net/ipv4/netfilter/ip_queue.c
@@ -161,8 +161,7 @@  ipq_build_packet_message(struct nf_queue_entry *entry, int *errp)
 		break;
 
 	case IPQ_COPY_PACKET:
-		if ((entry->skb->ip_summed == CHECKSUM_PARTIAL ||
-		     entry->skb->ip_summed == CHECKSUM_COMPLETE) &&
+		if (entry->skb->ip_summed == CHECKSUM_PARTIAL &&
 		    (*errp = skb_checksum_help(entry->skb))) {
 			read_unlock_bh(&queue_lock);
 			return NULL;