All of lore.kernel.org
 help / color / mirror / Atom feed
* [NETFILTER 1/4]: Fix HW checksum handling in ip_queue/ip6_queue
@ 2005-08-22  0:03 Patrick McHardy
  2005-08-22  6:32 ` David S. Miller
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Patrick McHardy @ 2005-08-22  0:03 UTC (permalink / raw)
  To: David S. Miller; +Cc: Netfilter Development Mailinglist

[-- Attachment #1: Type: text/plain, Size: 354 bytes --]

Hi Dave,

following are a fix for ip_queue and HW checksums, Pablo's string
match and two new targets. Please apply to your net-2.6.14 tree
(the ip_queue fix could also go directly in 2.6.13 IMO).


[NETFILTER]: Fix HW checksum handling in ip_queue/ip6_queue
[NETFILTER]: Add string match
[NETFILTER]: Add IPv6 REJECT target
[NETFILTER]: Add goto target

[-- Attachment #2: 01.diff --]
[-- Type: text/x-patch, Size: 2233 bytes --]

[NETFILTER]: Fix HW checksum handling in ip_queue/ip6_queue

The checksum needs to be filled in on output, after mangling a packet
ip_summed needs to be reset.

Signed-off-by: Patrick McHardy <kaber@trash.net>

---
commit 8cf07748b0be017ee9776fa5cb25b7d07e771e37
tree 07e5170035c471f59c866d9df4453a2dad6dd667
parent 01d727422b4153699009a711905e86741f9080e4
author Patrick McHardy <kaber@trash.net> Sun, 21 Aug 2005 21:54:12 +0200
committer Patrick McHardy <kaber@trash.net> Sun, 21 Aug 2005 21:54:12 +0200

 net/ipv4/netfilter/ip_queue.c  |    7 +++++++
 net/ipv6/netfilter/ip6_queue.c |    7 +++++++
 2 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/net/ipv4/netfilter/ip_queue.c b/net/ipv4/netfilter/ip_queue.c
--- a/net/ipv4/netfilter/ip_queue.c
+++ b/net/ipv4/netfilter/ip_queue.c
@@ -207,6 +207,12 @@ ipq_build_packet_message(struct ipq_queu
 		break;
 	
 	case IPQ_COPY_PACKET:
+		if (entry->skb->ip_summed == CHECKSUM_HW &&
+		    (*errp = skb_checksum_help(entry->skb,
+		                               entry->info->outdev == NULL))) {
+			read_unlock_bh(&queue_lock);
+			return NULL;
+		}
 		if (copy_range == 0 || copy_range > entry->skb->len)
 			data_len = entry->skb->len;
 		else
@@ -371,6 +377,7 @@ ipq_mangle_ipv4(ipq_verdict_msg_t *v, st
 	if (!skb_make_writable(&e->skb, v->data_len))
 		return -ENOMEM;
 	memcpy(e->skb->data, v->payload, v->data_len);
+	e->skb->ip_summed = CHECKSUM_NONE;
 
 	return 0;
 }
diff --git a/net/ipv6/netfilter/ip6_queue.c b/net/ipv6/netfilter/ip6_queue.c
--- a/net/ipv6/netfilter/ip6_queue.c
+++ b/net/ipv6/netfilter/ip6_queue.c
@@ -205,6 +205,12 @@ ipq_build_packet_message(struct ipq_queu
 		break;
 	
 	case IPQ_COPY_PACKET:
+		if (entry->skb->ip_summed == CHECKSUM_HW &&
+		    (*errp = skb_checksum_help(entry->skb,
+		                               entry->info->outdev == NULL))) {
+			read_unlock_bh(&queue_lock);
+			return NULL;
+		}
 		if (copy_range == 0 || copy_range > entry->skb->len)
 			data_len = entry->skb->len;
 		else
@@ -369,6 +375,7 @@ ipq_mangle_ipv6(ipq_verdict_msg_t *v, st
 	if (!skb_make_writable(&e->skb, v->data_len))
 		return -ENOMEM;
 	memcpy(e->skb->data, v->payload, v->data_len);
+	e->skb->ip_summed = CHECKSUM_NONE;
 
 	return 0;
 }

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

* Re: [NETFILTER 1/4]: Fix HW checksum handling in ip_queue/ip6_queue
  2005-08-22  0:03 [NETFILTER 1/4]: Fix HW checksum handling in ip_queue/ip6_queue Patrick McHardy
@ 2005-08-22  6:32 ` David S. Miller
  2005-08-23 16:20 ` David S. Miller
  2005-08-26 11:11 ` Harald Welte
  2 siblings, 0 replies; 5+ messages in thread
From: David S. Miller @ 2005-08-22  6:32 UTC (permalink / raw)
  To: kaber; +Cc: netfilter-devel

From: Patrick McHardy <kaber@trash.net>
Date: Mon, 22 Aug 2005 02:03:57 +0200

> following are a fix for ip_queue and HW checksums, Pablo's string
> match and two new targets. Please apply to your net-2.6.14 tree
> (the ip_queue fix could also go directly in 2.6.13 IMO).

All applied to net-2.6.14 and I will push the ip_queue CHECKSUM_HW fix
into 2.6.13 if possible.

Thanks a lot Patrick.

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

* Re: [NETFILTER 1/4]: Fix HW checksum handling in ip_queue/ip6_queue
  2005-08-22  0:03 [NETFILTER 1/4]: Fix HW checksum handling in ip_queue/ip6_queue Patrick McHardy
  2005-08-22  6:32 ` David S. Miller
@ 2005-08-23 16:20 ` David S. Miller
  2005-08-26 11:11 ` Harald Welte
  2 siblings, 0 replies; 5+ messages in thread
From: David S. Miller @ 2005-08-23 16:20 UTC (permalink / raw)
  To: kaber; +Cc: netfilter-devel

From: Patrick McHardy <kaber@trash.net>
Date: Mon, 22 Aug 2005 02:03:57 +0200

> (the ip_queue fix could also go directly in 2.6.13 IMO).

I had to munge the patch a lot to get it to apply to
2.6.13 (too many 2.6.14 dependencies in the patch hunks
:-), but I did add it to my 2.6.13 tree.

Thanks.

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

* Re: [NETFILTER 1/4]: Fix HW checksum handling in ip_queue/ip6_queue
  2005-08-22  0:03 [NETFILTER 1/4]: Fix HW checksum handling in ip_queue/ip6_queue Patrick McHardy
  2005-08-22  6:32 ` David S. Miller
  2005-08-23 16:20 ` David S. Miller
@ 2005-08-26 11:11 ` Harald Welte
  2005-08-26 16:45   ` Patrick McHardy
  2 siblings, 1 reply; 5+ messages in thread
From: Harald Welte @ 2005-08-26 11:11 UTC (permalink / raw)
  To: Patrick McHardy; +Cc: Netfilter Development Mailinglist

[-- Attachment #1: Type: text/plain, Size: 947 bytes --]

On Mon, Aug 22, 2005 at 02:03:57AM +0200, Patrick McHardy wrote:

> [NETFILTER]: Fix HW checksum handling in ip_queue/ip6_queue
> 
> The checksum needs to be filled in on output, after mangling a packet
> ip_summed needs to be reset.

I think we're going to need the same fix for nfnetlink_queue, too.  I'm
not sure whether I could just copy+paste your code into the respective
section of the code, or whether there are some other issues that need to
be thought of, like "Is skb->ip_summed valid for non-ip-packets?".

Please advise or propose a patch, thanks!

-- 
- Harald Welte <laforge@netfilter.org>                 http://netfilter.org/
============================================================================
  "Fragmentation is like classful addressing -- an interesting early
   architectural error that shows how much experimentation was going
   on while IP was being designed."                    -- Paul Vixie

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: [NETFILTER 1/4]: Fix HW checksum handling in ip_queue/ip6_queue
  2005-08-26 11:11 ` Harald Welte
@ 2005-08-26 16:45   ` Patrick McHardy
  0 siblings, 0 replies; 5+ messages in thread
From: Patrick McHardy @ 2005-08-26 16:45 UTC (permalink / raw)
  To: Harald Welte; +Cc: Netfilter Development Mailinglist, David S. Miller

[-- Attachment #1: Type: text/plain, Size: 507 bytes --]

Harald Welte wrote:
> I think we're going to need the same fix for nfnetlink_queue, too.  I'm
> not sure whether I could just copy+paste your code into the respective
> section of the code, or whether there are some other issues that need to
> be thought of, like "Is skb->ip_summed valid for non-ip-packets?".
> 
> Please advise or propose a patch, thanks!

The same fix is fine for nfnetlink_queue, protocols that don't support
HW checksumming ip_summed is set to CHECKSUM_NONE and the fix does
nothing.


[-- Attachment #2: x --]
[-- Type: text/plain, Size: 1307 bytes --]

[NETFILTER]: Fix HW checksum handling in nfnetlink_queue

Signed-off-by: Patrick McHardy <kaber@trash.net>

---
commit fd32f6a1bad85e74e72ac603bce19da767b5928f
tree c69f2224f141fbb6085f9576a7b67a833f9a3d80
parent c233e993bb49e007b667659243f344172768a6c8
author Patrick McHardy <kaber@trash.net> Fri, 26 Aug 2005 18:43:17 +0200
committer Patrick McHardy <kaber@trash.net> Fri, 26 Aug 2005 18:43:17 +0200

 net/netfilter/nfnetlink_queue.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c
--- a/net/netfilter/nfnetlink_queue.c
+++ b/net/netfilter/nfnetlink_queue.c
@@ -382,6 +382,12 @@ nfqnl_build_packet_message(struct nfqnl_
 		break;
 	
 	case NFQNL_COPY_PACKET:
+		if (entry->skb->ip_summed == CHECKSUM_HW &&
+		    (*errp = skb_checksum_help(entry->skb,
+		                               entry->info->outdev == NULL))) {
+			spin_unlock_bh(&queue->lock);
+			return NULL;
+		}
 		if (queue->copy_range == 0 
 		    || queue->copy_range > entry->skb->len)
 			data_len = entry->skb->len;
@@ -647,7 +653,7 @@ nfqnl_mangle(void *data, int data_len, s
 	if (!skb_make_writable(&e->skb, data_len))
 		return -ENOMEM;
 	memcpy(e->skb->data, data, data_len);
-
+	e->skb->ip_summed = CHECKSUM_NONE;
 	return 0;
 }
 

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

end of thread, other threads:[~2005-08-26 16:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-22  0:03 [NETFILTER 1/4]: Fix HW checksum handling in ip_queue/ip6_queue Patrick McHardy
2005-08-22  6:32 ` David S. Miller
2005-08-23 16:20 ` David S. Miller
2005-08-26 11:11 ` Harald Welte
2005-08-26 16:45   ` 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.