All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: "David S. Miller" <davem@davemloft.net>
Cc: Netfilter Development Mailinglist <netfilter-devel@lists.netfilter.org>
Subject: [NETFILTER 1/4]: Fix HW checksum handling in ip_queue/ip6_queue
Date: Mon, 22 Aug 2005 02:03:57 +0200	[thread overview]
Message-ID: <4309166D.9010706@trash.net> (raw)

[-- 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;
 }

             reply	other threads:[~2005-08-22  0:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-22  0:03 Patrick McHardy [this message]
2005-08-22  6:32 ` [NETFILTER 1/4]: Fix HW checksum handling in ip_queue/ip6_queue 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4309166D.9010706@trash.net \
    --to=kaber@trash.net \
    --cc=davem@davemloft.net \
    --cc=netfilter-devel@lists.netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.