All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: Netfilter Development Mailinglist <netfilter-devel@lists.netfilter.org>
Cc: Kernel Netdev Mailing List <netdev@vger.kernel.org>,
	Herbert Xu <herbert@gondor.apana.org.au>
Subject: [NF+IPsec 4/6]: Make IPsec input processing symetrical to output
Date: Mon, 17 Oct 2005 02:22:32 +0200	[thread overview]
Message-ID: <4352EEC8.9000602@trash.net> (raw)

[-- Attachment #1: 04.diff --]
[-- Type: text/x-patch, Size: 2294 bytes --]

[NETFILTER]: Make IPsec input processing symetrical to output

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

---
commit 9b2748c756fd805c0fe5b37505735e02f06ebb28
tree 440bd33a45b20a01481876c5b379017cceec0388
parent 92dffb4b8138637d28173cc9c10fe5990914cf5d
author Patrick McHardy <kaber@trash.net> Mon, 17 Oct 2005 01:32:19 +0200
committer Patrick McHardy <kaber@trash.net> Mon, 17 Oct 2005 01:32:19 +0200

 net/ipv4/xfrm4_input.c |   23 ++++++++++++++---------
 net/ipv6/xfrm6_input.c |   23 ++++++++++++++---------
 2 files changed, 28 insertions(+), 18 deletions(-)

diff --git a/net/ipv4/xfrm4_input.c b/net/ipv4/xfrm4_input.c
--- a/net/ipv4/xfrm4_input.c
+++ b/net/ipv4/xfrm4_input.c
@@ -137,16 +137,21 @@ int xfrm4_rcv_encap(struct sk_buff *skb,
 	memcpy(skb->sp->x+skb->sp->len, xfrm_vec, xfrm_nr*sizeof(struct sec_decap_state));
 	skb->sp->len += xfrm_nr;
 
-	if (decaps) {
-		if (!(skb->dev->flags&IFF_LOOPBACK)) {
-			dst_release(skb->dst);
-			skb->dst = NULL;
-		}
-		netif_rx(skb);
-		return 0;
-	} else {
-		return -skb->nh.iph->protocol;
+	if (!decaps) {
+		if (skb_cloned(skb) &&
+		    pskb_expand_head(skb, 0, 0, GFP_ATOMIC))
+			goto drop;
+		__skb_push(skb, skb->data - skb->nh.raw);
+		skb->nh.iph->tot_len = htons(skb->len);
+		ip_send_check(skb->nh.iph);
 	}
+	if (!(skb->dev->flags&IFF_LOOPBACK)) {
+		dst_release(skb->dst);
+		skb->dst = NULL;
+	}
+	nf_reset(skb);
+	netif_rx(skb);
+	return 0;
 
 drop_unlock:
 	spin_unlock(&x->lock);
diff --git a/net/ipv6/xfrm6_input.c b/net/ipv6/xfrm6_input.c
--- a/net/ipv6/xfrm6_input.c
+++ b/net/ipv6/xfrm6_input.c
@@ -121,16 +121,21 @@ int xfrm6_rcv_spi(struct sk_buff **pskb,
 	skb->sp->len += xfrm_nr;
 	skb->ip_summed = CHECKSUM_NONE;
 
-	if (decaps) {
-		if (!(skb->dev->flags&IFF_LOOPBACK)) {
-			dst_release(skb->dst);
-			skb->dst = NULL;
-		}
-		netif_rx(skb);
-		return -1;
-	} else {
-		return 1;
+	if (!decaps) {
+		if (skb_cloned(skb) &&
+		    pskb_expand_head(skb, 0, 0, GFP_ATOMIC))
+			goto drop;
+		/* FIXME: Jumbo payload option */
+		skb->nh.ipv6h->payload_len = htons(skb->len);
+		__skb_push(skb, skb->data - skb->nh.raw);
 	}
+	if (!(skb->dev->flags&IFF_LOOPBACK)) {
+		dst_release(skb->dst);
+		skb->dst = NULL;
+	}
+	nf_reset(skb);
+	netif_rx(skb);
+	return -1;
 
 drop_unlock:
 	spin_unlock(&x->lock);

             reply	other threads:[~2005-10-17  0:22 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-17  0:22 Patrick McHardy [this message]
2005-10-17  0:49 ` [NF+IPsec 4/6]: Make IPsec input processing symetrical to output YOSHIFUJI Hideaki / 吉藤英明
2005-10-17  1:24   ` Patrick McHardy
2005-10-17  1:46     ` Herbert Xu
2005-10-25 23:09       ` Patrick McHardy
2005-10-25 23:10         ` Herbert Xu
2005-10-25 23:14           ` Patrick McHardy
2005-10-26  0:39             ` Herbert Xu
2005-10-27 14:42               ` Patrick McHardy
2005-10-30 23:15                 ` Patrick McHardy
2005-10-31  3:19                   ` Yasuyuki KOZAKAI
2005-11-01 18:39                     ` Stephen Frost
     [not found]                   ` <200510310319.j9V3JHNl019752@toshiba.co.jp>
2005-11-01 18:23                     ` Patrick McHardy
2005-10-26  4:39             ` James Morris
2005-10-26  7:37             ` Ingo Oeser
2005-10-26 13:37             ` Stephen Frost
2005-10-27 12:15   ` Herbert Xu
2005-10-27 14:57     ` YOSHIFUJI Hideaki / 吉藤英明
2005-10-27 16:58       ` Patrick McHardy
2005-11-05  6:30       ` Herbert Xu
2005-11-05  7:55         ` Patrick McHardy
2005-11-05  8:39           ` Herbert Xu
2005-11-05  8:58             ` Patrick McHardy
2005-11-05  9:09               ` Herbert Xu
2005-11-05  9:19                 ` Patrick McHardy
2005-11-05  9:38                   ` Herbert Xu
2005-11-05  9:55                     ` Patrick McHardy
2005-11-05 10:01                       ` Herbert Xu
2005-11-05 10:05                         ` Patrick McHardy
2005-11-05 10:32                       ` Yasuyuki KOZAKAI
     [not found]                       ` <200511051032.jA5AWl2l000619@toshiba.co.jp>
2005-11-08 14:01                         ` Patrick McHardy
2005-11-05  8:23         ` YOSHIFUJI Hideaki / 吉藤英明

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=4352EEC8.9000602@trash.net \
    --to=kaber@trash.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=netdev@vger.kernel.org \
    --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.