netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [0/7] IPsec: Preparatory patcheds for async crypto on output
@ 2007-10-08 11:28 Herbert Xu
  2007-10-08 11:29 ` [PATCH 1/7] [IPSEC] esp: Remove keys from esp_data structure Herbert Xu
                   ` (7 more replies)
  0 siblings, 8 replies; 20+ messages in thread
From: Herbert Xu @ 2007-10-08 11:28 UTC (permalink / raw)
  To: David S. Miller, netdev

Hi Dave:

Here is a bunch of patches paving the way for removal of the
state spin lock on the output path so that we can let the crypto
complete asynchronously.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

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

* [PATCH 1/7] [IPSEC] esp: Remove keys from esp_data structure
  2007-10-08 11:28 [0/7] IPsec: Preparatory patcheds for async crypto on output Herbert Xu
@ 2007-10-08 11:29 ` Herbert Xu
  2007-10-09  0:14   ` David Miller
  2007-10-08 11:29 ` [PATCH 2/7] [IPSEC] ah: Remove keys from ah_data structure Herbert Xu
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 20+ messages in thread
From: Herbert Xu @ 2007-10-08 11:29 UTC (permalink / raw)
  To: David S. Miller, netdev

[IPSEC] esp: Remove keys from esp_data structure

The keys are only used during initialisation so we don't need to carry them
in esp_data.  Since we don't have to allocate them again, there is no need
to place a limit on the authentication key length anymore.

This patch also kills the unused auth.icv member.

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

 include/net/esp.h |    7 -------
 net/ipv4/esp4.c   |   16 +++++-----------
 net/ipv6/esp6.c   |   15 ++++-----------
 3 files changed, 9 insertions(+), 29 deletions(-)

diff --git a/include/net/esp.h b/include/net/esp.h
index d05d8d2..e793d76 100644
--- a/include/net/esp.h
+++ b/include/net/esp.h
@@ -13,8 +13,6 @@ struct esp_data
 
 	/* Confidentiality */
 	struct {
-		u8			*key;		/* Key */
-		int			key_len;	/* Key length */
 		int			padlen;		/* 0..255 */
 		/* ivlen is offset from enc_data, where encrypted data start.
 		 * It is logically different of crypto_tfm_alg_ivsize(tfm).
@@ -28,14 +26,9 @@ struct esp_data
 
 	/* Integrity. It is active when icv_full_len != 0 */
 	struct {
-		u8			*key;		/* Key */
-		int			key_len;	/* Length of the key */
 		u8			*work_icv;
 		int			icv_full_len;
 		int			icv_trunc_len;
-		void			(*icv)(struct esp_data*,
-		                               struct sk_buff *skb,
-		                               int offset, int len, u8 *icv);
 		struct crypto_hash	*tfm;
 	} auth;
 };
diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c
index 98767a4..d233e2e 100644
--- a/net/ipv4/esp4.c
+++ b/net/ipv4/esp4.c
@@ -343,11 +343,6 @@ static int esp_init_state(struct xfrm_state *x)
 	struct crypto_blkcipher *tfm;
 	u32 align;
 
-	/* null auth and encryption can have zero length keys */
-	if (x->aalg) {
-		if (x->aalg->alg_key_len > 512)
-			goto error;
-	}
 	if (x->ealg == NULL)
 		goto error;
 
@@ -359,15 +354,14 @@ static int esp_init_state(struct xfrm_state *x)
 		struct xfrm_algo_desc *aalg_desc;
 		struct crypto_hash *hash;
 
-		esp->auth.key = x->aalg->alg_key;
-		esp->auth.key_len = (x->aalg->alg_key_len+7)/8;
 		hash = crypto_alloc_hash(x->aalg->alg_name, 0,
 					 CRYPTO_ALG_ASYNC);
 		if (IS_ERR(hash))
 			goto error;
 
 		esp->auth.tfm = hash;
-		if (crypto_hash_setkey(hash, esp->auth.key, esp->auth.key_len))
+		if (crypto_hash_setkey(hash, x->aalg->alg_key,
+				       (x->aalg->alg_key_len + 7) / 8))
 			goto error;
 
 		aalg_desc = xfrm_aalg_get_byname(x->aalg->alg_name, 0);
@@ -389,8 +383,7 @@ static int esp_init_state(struct xfrm_state *x)
 		if (!esp->auth.work_icv)
 			goto error;
 	}
-	esp->conf.key = x->ealg->alg_key;
-	esp->conf.key_len = (x->ealg->alg_key_len+7)/8;
+
 	tfm = crypto_alloc_blkcipher(x->ealg->alg_name, 0, CRYPTO_ALG_ASYNC);
 	if (IS_ERR(tfm))
 		goto error;
@@ -403,7 +396,8 @@ static int esp_init_state(struct xfrm_state *x)
 			goto error;
 		esp->conf.ivinitted = 0;
 	}
-	if (crypto_blkcipher_setkey(tfm, esp->conf.key, esp->conf.key_len))
+	if (crypto_blkcipher_setkey(tfm, x->ealg->alg_key,
+				    (x->ealg->alg_key_len + 7) / 8))
 		goto error;
 	x->props.header_len = sizeof(struct ip_esp_hdr) + esp->conf.ivlen;
 	if (x->props.mode == XFRM_MODE_TUNNEL)
diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c
index 2db31ce..7728106 100644
--- a/net/ipv6/esp6.c
+++ b/net/ipv6/esp6.c
@@ -297,11 +297,6 @@ static int esp6_init_state(struct xfrm_state *x)
 	struct esp_data *esp = NULL;
 	struct crypto_blkcipher *tfm;
 
-	/* null auth and encryption can have zero length keys */
-	if (x->aalg) {
-		if (x->aalg->alg_key_len > 512)
-			goto error;
-	}
 	if (x->ealg == NULL)
 		goto error;
 
@@ -316,15 +311,14 @@ static int esp6_init_state(struct xfrm_state *x)
 		struct xfrm_algo_desc *aalg_desc;
 		struct crypto_hash *hash;
 
-		esp->auth.key = x->aalg->alg_key;
-		esp->auth.key_len = (x->aalg->alg_key_len+7)/8;
 		hash = crypto_alloc_hash(x->aalg->alg_name, 0,
 					 CRYPTO_ALG_ASYNC);
 		if (IS_ERR(hash))
 			goto error;
 
 		esp->auth.tfm = hash;
-		if (crypto_hash_setkey(hash, esp->auth.key, esp->auth.key_len))
+		if (crypto_hash_setkey(hash, x->aalg->alg_key,
+				       (x->aalg->alg_key_len + 7) / 8))
 			goto error;
 
 		aalg_desc = xfrm_aalg_get_byname(x->aalg->alg_name, 0);
@@ -346,8 +340,6 @@ static int esp6_init_state(struct xfrm_state *x)
 		if (!esp->auth.work_icv)
 			goto error;
 	}
-	esp->conf.key = x->ealg->alg_key;
-	esp->conf.key_len = (x->ealg->alg_key_len+7)/8;
 	tfm = crypto_alloc_blkcipher(x->ealg->alg_name, 0, CRYPTO_ALG_ASYNC);
 	if (IS_ERR(tfm))
 		goto error;
@@ -360,7 +352,8 @@ static int esp6_init_state(struct xfrm_state *x)
 			goto error;
 		esp->conf.ivinitted = 0;
 	}
-	if (crypto_blkcipher_setkey(tfm, esp->conf.key, esp->conf.key_len))
+	if (crypto_blkcipher_setkey(tfm, x->ealg->alg_key,
+				    (x->ealg->alg_key_len + 7) / 8))
 		goto error;
 	x->props.header_len = sizeof(struct ipv6_esp_hdr) + esp->conf.ivlen;
 	if (x->props.mode == XFRM_MODE_TUNNEL)

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

* [PATCH 2/7] [IPSEC] ah: Remove keys from ah_data structure
  2007-10-08 11:28 [0/7] IPsec: Preparatory patcheds for async crypto on output Herbert Xu
  2007-10-08 11:29 ` [PATCH 1/7] [IPSEC] esp: Remove keys from esp_data structure Herbert Xu
@ 2007-10-08 11:29 ` Herbert Xu
  2007-10-09  0:14   ` David Miller
  2007-10-08 11:29 ` [PATCH 3/7] [IPSEC]: Move common output code to xfrm_output Herbert Xu
                   ` (5 subsequent siblings)
  7 siblings, 1 reply; 20+ messages in thread
From: Herbert Xu @ 2007-10-08 11:29 UTC (permalink / raw)
  To: David S. Miller, netdev

[IPSEC] ah: Remove keys from ah_data structure

The keys are only used during initialisation so we don't need to carry them
in esp_data.  Since we don't have to allocate them again, there is no need
to place a limit on the authentication key length anymore.

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

 include/net/ah.h |    2 --
 net/ipv4/ah4.c   |    9 ++-------
 net/ipv6/ah6.c   |    9 ++-------
 3 files changed, 4 insertions(+), 16 deletions(-)

diff --git a/include/net/ah.h b/include/net/ah.h
index 8f257c1..5e758c2 100644
--- a/include/net/ah.h
+++ b/include/net/ah.h
@@ -9,8 +9,6 @@
 
 struct ah_data
 {
-	u8			*key;
-	int			key_len;
 	u8			*work_icv;
 	int			icv_full_len;
 	int			icv_trunc_len;
diff --git a/net/ipv4/ah4.c b/net/ipv4/ah4.c
index 39f6211..dc1d8e8 100644
--- a/net/ipv4/ah4.c
+++ b/net/ipv4/ah4.c
@@ -219,10 +219,6 @@ static int ah_init_state(struct xfrm_state *x)
 	if (!x->aalg)
 		goto error;
 
-	/* null auth can use a zero length key */
-	if (x->aalg->alg_key_len > 512)
-		goto error;
-
 	if (x->encap)
 		goto error;
 
@@ -230,14 +226,13 @@ static int ah_init_state(struct xfrm_state *x)
 	if (ahp == NULL)
 		return -ENOMEM;
 
-	ahp->key = x->aalg->alg_key;
-	ahp->key_len = (x->aalg->alg_key_len+7)/8;
 	tfm = crypto_alloc_hash(x->aalg->alg_name, 0, CRYPTO_ALG_ASYNC);
 	if (IS_ERR(tfm))
 		goto error;
 
 	ahp->tfm = tfm;
-	if (crypto_hash_setkey(tfm, ahp->key, ahp->key_len))
+	if (crypto_hash_setkey(tfm, x->aalg->alg_key,
+			       (x->aalg->alg_key_len + 7) / 8))
 		goto error;
 
 	/*
diff --git a/net/ipv6/ah6.c b/net/ipv6/ah6.c
index 53f46ab..69a2030 100644
--- a/net/ipv6/ah6.c
+++ b/net/ipv6/ah6.c
@@ -429,10 +429,6 @@ static int ah6_init_state(struct xfrm_state *x)
 	if (!x->aalg)
 		goto error;
 
-	/* null auth can use a zero length key */
-	if (x->aalg->alg_key_len > 512)
-		goto error;
-
 	if (x->encap)
 		goto error;
 
@@ -440,14 +436,13 @@ static int ah6_init_state(struct xfrm_state *x)
 	if (ahp == NULL)
 		return -ENOMEM;
 
-	ahp->key = x->aalg->alg_key;
-	ahp->key_len = (x->aalg->alg_key_len+7)/8;
 	tfm = crypto_alloc_hash(x->aalg->alg_name, 0, CRYPTO_ALG_ASYNC);
 	if (IS_ERR(tfm))
 		goto error;
 
 	ahp->tfm = tfm;
-	if (crypto_hash_setkey(tfm, ahp->key, ahp->key_len))
+	if (crypto_hash_setkey(tfm, x->aalg->alg_key,
+			       (x->aalg->alg_key_len + 7) / 8))
 		goto error;
 
 	/*

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

* [PATCH 3/7] [IPSEC]: Move common output code to xfrm_output
  2007-10-08 11:28 [0/7] IPsec: Preparatory patcheds for async crypto on output Herbert Xu
  2007-10-08 11:29 ` [PATCH 1/7] [IPSEC] esp: Remove keys from esp_data structure Herbert Xu
  2007-10-08 11:29 ` [PATCH 2/7] [IPSEC] ah: Remove keys from ah_data structure Herbert Xu
@ 2007-10-08 11:29 ` Herbert Xu
  2007-10-09  0:17   ` David Miller
  2007-10-08 11:29 ` [PATCH 4/7] [IPSEC]: Move xfrm_state_check into xfrm_output.c Herbert Xu
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 20+ messages in thread
From: Herbert Xu @ 2007-10-08 11:29 UTC (permalink / raw)
  To: David S. Miller, netdev

[IPSEC]: Move common output code to xfrm_output

Most of the code in xfrm4_output_one and xfrm6_output_one are identical so
this patch moves them into a common xfrm_output function which will live
in net/xfrm.

In fact this would seem to fix a bug as on IPv4 we never reset the network
header after a transform which may upset netfilter later on.

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

 include/net/xfrm.h      |    1 
 net/ipv4/xfrm4_output.c |   40 ++------------------------
 net/ipv6/xfrm6_output.c |   45 +++--------------------------
 net/xfrm/Makefile       |    2 -
 net/xfrm/xfrm_output.c  |   73 ++++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 84 insertions(+), 77 deletions(-)

diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 760d243..f5147dd 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -1016,6 +1016,7 @@ extern void xfrm_replay_notify(struct xfrm_state *x, int event);
 extern int xfrm_state_check(struct xfrm_state *x, struct sk_buff *skb);
 extern int xfrm_state_mtu(struct xfrm_state *x, int mtu);
 extern int xfrm_init_state(struct xfrm_state *x);
+extern int xfrm_output(struct sk_buff *skb);
 extern int xfrm4_rcv(struct sk_buff *skb);
 extern int xfrm4_output(struct sk_buff *skb);
 extern int xfrm4_tunnel_register(struct xfrm_tunnel *handler, unsigned short family);
diff --git a/net/ipv4/xfrm4_output.c b/net/ipv4/xfrm4_output.c
index 44ef208..04805c7 100644
--- a/net/ipv4/xfrm4_output.c
+++ b/net/ipv4/xfrm4_output.c
@@ -12,7 +12,6 @@
 #include <linux/if_ether.h>
 #include <linux/kernel.h>
 #include <linux/skbuff.h>
-#include <linux/spinlock.h>
 #include <linux/netfilter_ipv4.h>
 #include <net/ip.h>
 #include <net/xfrm.h>
@@ -41,58 +40,27 @@ out:
 	return ret;
 }
 
-static int xfrm4_output_one(struct sk_buff *skb)
+static inline int xfrm4_output_one(struct sk_buff *skb)
 {
 	struct dst_entry *dst = skb->dst;
 	struct xfrm_state *x = dst->xfrm;
 	int err;
 
-	if (skb->ip_summed == CHECKSUM_PARTIAL) {
-		err = skb_checksum_help(skb);
-		if (err)
-			goto error_nolock;
-	}
-
 	if (x->props.mode == XFRM_MODE_TUNNEL) {
 		err = xfrm4_tunnel_check_size(skb);
 		if (err)
 			goto error_nolock;
 	}
 
-	do {
-		spin_lock_bh(&x->lock);
-		err = xfrm_state_check(x, skb);
-		if (err)
-			goto error;
-
-		err = x->mode->output(x, skb);
-		if (err)
-			goto error;
-
-		err = x->type->output(x, skb);
-		if (err)
-			goto error;
-
-		x->curlft.bytes += skb->len;
-		x->curlft.packets++;
-
-		spin_unlock_bh(&x->lock);
-
-		if (!(skb->dst = dst_pop(dst))) {
-			err = -EHOSTUNREACH;
-			goto error_nolock;
-		}
-		dst = skb->dst;
-		x = dst->xfrm;
-	} while (x && (x->props.mode != XFRM_MODE_TUNNEL));
+	err = xfrm_output(skb);
+	if (err)
+		goto error_nolock;
 
 	IPCB(skb)->flags |= IPSKB_XFRM_TRANSFORMED;
 	err = 0;
 
 out_exit:
 	return err;
-error:
-	spin_unlock_bh(&x->lock);
 error_nolock:
 	kfree_skb(skb);
 	goto out_exit;
diff --git a/net/ipv6/xfrm6_output.c b/net/ipv6/xfrm6_output.c
index 56364a5..f21596f 100644
--- a/net/ipv6/xfrm6_output.c
+++ b/net/ipv6/xfrm6_output.c
@@ -9,9 +9,9 @@
  * 2 of the License, or (at your option) any later version.
  */
 
+#include <linux/if_ether.h>
 #include <linux/compiler.h>
 #include <linux/skbuff.h>
-#include <linux/spinlock.h>
 #include <linux/icmpv6.h>
 #include <linux/netfilter_ipv6.h>
 #include <net/ipv6.h>
@@ -43,62 +43,27 @@ static int xfrm6_tunnel_check_size(struct sk_buff *skb)
 	return ret;
 }
 
-static int xfrm6_output_one(struct sk_buff *skb)
+static inline int xfrm6_output_one(struct sk_buff *skb)
 {
 	struct dst_entry *dst = skb->dst;
 	struct xfrm_state *x = dst->xfrm;
 	int err;
 
-	if (skb->ip_summed == CHECKSUM_PARTIAL) {
-		err = skb_checksum_help(skb);
-		if (err)
-			goto error_nolock;
-	}
-
 	if (x->props.mode == XFRM_MODE_TUNNEL) {
 		err = xfrm6_tunnel_check_size(skb);
 		if (err)
 			goto error_nolock;
 	}
 
-	do {
-		spin_lock_bh(&x->lock);
-		err = xfrm_state_check(x, skb);
-		if (err)
-			goto error;
-
-		err = x->mode->output(x, skb);
-		if (err)
-			goto error;
-
-		err = x->type->output(x, skb);
-		if (err)
-			goto error;
-
-		x->curlft.bytes += skb->len;
-		x->curlft.packets++;
-		if (x->props.mode == XFRM_MODE_ROUTEOPTIMIZATION)
-			x->lastused = get_seconds();
-
-		spin_unlock_bh(&x->lock);
-
-		skb_reset_network_header(skb);
-
-		if (!(skb->dst = dst_pop(dst))) {
-			err = -EHOSTUNREACH;
-			goto error_nolock;
-		}
-		dst = skb->dst;
-		x = dst->xfrm;
-	} while (x && (x->props.mode != XFRM_MODE_TUNNEL));
+	err = xfrm_output(skb);
+	if (err)
+		goto error_nolock;
 
 	IP6CB(skb)->flags |= IP6SKB_XFRM_TRANSFORMED;
 	err = 0;
 
 out_exit:
 	return err;
-error:
-	spin_unlock_bh(&x->lock);
 error_nolock:
 	kfree_skb(skb);
 	goto out_exit;
diff --git a/net/xfrm/Makefile b/net/xfrm/Makefile
index de3c1a6..45744a3 100644
--- a/net/xfrm/Makefile
+++ b/net/xfrm/Makefile
@@ -3,6 +3,6 @@
 #
 
 obj-$(CONFIG_XFRM) := xfrm_policy.o xfrm_state.o xfrm_hash.o \
-		      xfrm_input.o xfrm_algo.o
+		      xfrm_input.o xfrm_output.o xfrm_algo.o
 obj-$(CONFIG_XFRM_USER) += xfrm_user.o
 
diff --git a/net/xfrm/xfrm_output.c b/net/xfrm/xfrm_output.c
new file mode 100644
index 0000000..75f289b
--- /dev/null
+++ b/net/xfrm/xfrm_output.c
@@ -0,0 +1,73 @@
+/*
+ * xfrm_output.c - Common IPsec encapsulation code.
+ *
+ * Copyright (c) 2007 Herbert Xu <herbert@gondor.apana.org.au>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+#include <linux/errno.h>
+#include <linux/module.h>
+#include <linux/netdevice.h>
+#include <linux/skbuff.h>
+#include <linux/spinlock.h>
+#include <linux/time.h>
+#include <net/dst.h>
+#include <net/xfrm.h>
+
+int xfrm_output(struct sk_buff *skb)
+{
+	struct dst_entry *dst = skb->dst;
+	struct xfrm_state *x = dst->xfrm;
+	int err;
+
+	if (skb->ip_summed == CHECKSUM_PARTIAL) {
+		err = skb_checksum_help(skb);
+		if (err)
+			goto error_nolock;
+	}
+
+	do {
+		spin_lock_bh(&x->lock);
+		err = xfrm_state_check(x, skb);
+		if (err)
+			goto error;
+
+		err = x->mode->output(x, skb);
+		if (err)
+			goto error;
+
+		err = x->type->output(x, skb);
+		if (err)
+			goto error;
+
+		x->curlft.bytes += skb->len;
+		x->curlft.packets++;
+
+		if (x->props.mode == XFRM_MODE_ROUTEOPTIMIZATION)
+			x->lastused = get_seconds();
+
+		spin_unlock_bh(&x->lock);
+
+		skb_reset_network_header(skb);
+
+		if (!(skb->dst = dst_pop(dst))) {
+			err = -EHOSTUNREACH;
+			goto error_nolock;
+		}
+		dst = skb->dst;
+		x = dst->xfrm;
+	} while (x && (x->props.mode != XFRM_MODE_TUNNEL));
+
+	err = 0;
+
+error_nolock:
+	return err;
+error:
+	spin_unlock_bh(&x->lock);
+	goto error_nolock;
+}
+EXPORT_SYMBOL_GPL(xfrm_output);

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

* [PATCH 4/7] [IPSEC]: Move xfrm_state_check into xfrm_output.c
  2007-10-08 11:28 [0/7] IPsec: Preparatory patcheds for async crypto on output Herbert Xu
                   ` (2 preceding siblings ...)
  2007-10-08 11:29 ` [PATCH 3/7] [IPSEC]: Move common output code to xfrm_output Herbert Xu
@ 2007-10-08 11:29 ` Herbert Xu
  2007-10-09  0:25   ` David Miller
  2007-10-08 11:29 ` [PATCH 5/7] [IPSEC]: Move output replay code into xfrm_output Herbert Xu
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 20+ messages in thread
From: Herbert Xu @ 2007-10-08 11:29 UTC (permalink / raw)
  To: David S. Miller, netdev

[IPSEC]: Move xfrm_state_check into xfrm_output.c

The functions xfrm_state_check and xfrm_state_check_space are only used by
the output code in xfrm_output.c so we can move them over.

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

 include/net/xfrm.h     |    1 -
 net/xfrm/xfrm_output.c |   22 ++++++++++++++++++++++
 net/xfrm/xfrm_state.c  |   23 -----------------------
 3 files changed, 22 insertions(+), 24 deletions(-)

diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index f5147dd..bb91934 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -1013,7 +1013,6 @@ extern void xfrm_spd_getinfo(struct xfrmk_spdinfo *si);
 extern int xfrm_replay_check(struct xfrm_state *x, __be32 seq);
 extern void xfrm_replay_advance(struct xfrm_state *x, __be32 seq);
 extern void xfrm_replay_notify(struct xfrm_state *x, int event);
-extern int xfrm_state_check(struct xfrm_state *x, struct sk_buff *skb);
 extern int xfrm_state_mtu(struct xfrm_state *x, int mtu);
 extern int xfrm_init_state(struct xfrm_state *x);
 extern int xfrm_output(struct sk_buff *skb);
diff --git a/net/xfrm/xfrm_output.c b/net/xfrm/xfrm_output.c
index 75f289b..5b1c978 100644
--- a/net/xfrm/xfrm_output.c
+++ b/net/xfrm/xfrm_output.c
@@ -18,6 +18,28 @@
 #include <net/dst.h>
 #include <net/xfrm.h>
 
+static int xfrm_state_check_space(struct xfrm_state *x, struct sk_buff *skb)
+{
+	int nhead = x->props.header_len + LL_RESERVED_SPACE(skb->dst->dev)
+		- skb_headroom(skb);
+
+	if (nhead > 0)
+		return pskb_expand_head(skb, nhead, 0, GFP_ATOMIC);
+
+	/* Check tail too... */
+	return 0;
+}
+
+static int xfrm_state_check(struct xfrm_state *x, struct sk_buff *skb)
+{
+	int err = xfrm_state_check_expire(x);
+	if (err < 0)
+		goto err;
+	err = xfrm_state_check_space(x, skb);
+err:
+	return err;
+}
+
 int xfrm_output(struct sk_buff *skb)
 {
 	struct dst_entry *dst = skb->dst;
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index 15734ad..0ecec34 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -1152,29 +1152,6 @@ int xfrm_state_check_expire(struct xfrm_state *x)
 }
 EXPORT_SYMBOL(xfrm_state_check_expire);
 
-static int xfrm_state_check_space(struct xfrm_state *x, struct sk_buff *skb)
-{
-	int nhead = x->props.header_len + LL_RESERVED_SPACE(skb->dst->dev)
-		- skb_headroom(skb);
-
-	if (nhead > 0)
-		return pskb_expand_head(skb, nhead, 0, GFP_ATOMIC);
-
-	/* Check tail too... */
-	return 0;
-}
-
-int xfrm_state_check(struct xfrm_state *x, struct sk_buff *skb)
-{
-	int err = xfrm_state_check_expire(x);
-	if (err < 0)
-		goto err;
-	err = xfrm_state_check_space(x, skb);
-err:
-	return err;
-}
-EXPORT_SYMBOL(xfrm_state_check);
-
 struct xfrm_state *
 xfrm_state_lookup(xfrm_address_t *daddr, __be32 spi, u8 proto,
 		  unsigned short family)

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

* [PATCH 5/7] [IPSEC]: Move output replay code into xfrm_output
  2007-10-08 11:28 [0/7] IPsec: Preparatory patcheds for async crypto on output Herbert Xu
                   ` (3 preceding siblings ...)
  2007-10-08 11:29 ` [PATCH 4/7] [IPSEC]: Move xfrm_state_check into xfrm_output.c Herbert Xu
@ 2007-10-08 11:29 ` Herbert Xu
  2007-10-09  0:26   ` David Miller
  2007-10-08 11:29 ` [PATCH 6/7] [IPSEC]: Unexport xfrm_replay_notify Herbert Xu
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 20+ messages in thread
From: Herbert Xu @ 2007-10-08 11:29 UTC (permalink / raw)
  To: David S. Miller, netdev

[IPSEC]: Move output replay code into xfrm_output

The replay counter is one of only two remaining things in the output code
that requires a lock on the xfrm state (the other being the crypto).  This
patch moves it into the generic xfrm_output so we can remove the lock from
the transforms themselves.

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

 include/net/xfrm.h     |   20 +++++++++++++++++++-
 net/ipv4/ah4.c         |    4 ++--
 net/ipv4/esp4.c        |    4 ++--
 net/ipv6/ah6.c         |    4 ++--
 net/ipv6/esp6.c        |    4 ++--
 net/xfrm/xfrm_output.c |    5 +++++
 6 files changed, 32 insertions(+), 9 deletions(-)

diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index bb91934..a267725 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -2,7 +2,6 @@
 #define _NET_XFRM_H
 
 #include <linux/compiler.h>
-#include <linux/in.h>
 #include <linux/xfrm.h>
 #include <linux/spinlock.h>
 #include <linux/list.h>
@@ -16,6 +15,7 @@
 
 #include <net/sock.h>
 #include <net/dst.h>
+#include <net/ip.h>
 #include <net/route.h>
 #include <net/ipv6.h>
 #include <net/ip6_fib.h>
@@ -279,6 +279,7 @@ struct xfrm_type
 	__u8			proto;
 	__u8			flags;
 #define XFRM_TYPE_NON_FRAGMENT	1
+#define XFRM_TYPE_REPLAY_PROT	2
 
 	int			(*init_state)(struct xfrm_state *x);
 	void			(*destructor)(struct xfrm_state *);
@@ -419,6 +420,23 @@ extern int xfrm_unregister_km(struct xfrm_mgr *km);
 
 extern unsigned int xfrm_policy_count[XFRM_POLICY_MAX*2];
 
+/*
+ * This structure is used for the duration where packets are being
+ * transformed by IPsec.  As soon as the packet leaves IPsec the
+ * area beyond the generic IP part may be overwritten.
+ */
+struct xfrm_skb_cb {
+	union {
+		struct inet_skb_parm h4;
+		struct inet6_skb_parm h6;
+        } header;
+
+        /* Sequence number for replay protection. */
+        u64 seq;
+};
+
+#define XFRM_SKB_CB(__skb) ((struct xfrm_skb_cb *)&((__skb)->cb[0]))
+
 /* Audit Information */
 struct xfrm_audit
 {
diff --git a/net/ipv4/ah4.c b/net/ipv4/ah4.c
index dc1d8e8..58af298 100644
--- a/net/ipv4/ah4.c
+++ b/net/ipv4/ah4.c
@@ -96,8 +96,7 @@ static int ah_output(struct xfrm_state *x, struct sk_buff *skb)
 
 	ah->reserved = 0;
 	ah->spi = x->id.spi;
-	ah->seq_no = htonl(++x->replay.oseq);
-	xfrm_aevent_doreplay(x);
+	ah->seq_no = htonl(XFRM_SKB_CB(skb)->seq);
 	err = ah_mac_digest(ahp, skb, ah->auth_data);
 	if (err)
 		goto error;
@@ -297,6 +296,7 @@ static struct xfrm_type ah_type =
 	.description	= "AH4",
 	.owner		= THIS_MODULE,
 	.proto	     	= IPPROTO_AH,
+	.flags		= XFRM_TYPE_REPLAY_PROT,
 	.init_state	= ah_init_state,
 	.destructor	= ah_destroy,
 	.input		= ah_input,
diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c
index d233e2e..0f62af9 100644
--- a/net/ipv4/esp4.c
+++ b/net/ipv4/esp4.c
@@ -95,8 +95,7 @@ static int esp_output(struct xfrm_state *x, struct sk_buff *skb)
 		top_iph->protocol = IPPROTO_ESP;
 
 	esph->spi = x->id.spi;
-	esph->seq_no = htonl(++x->replay.oseq);
-	xfrm_aevent_doreplay(x);
+	esph->seq_no = htonl(XFRM_SKB_CB(skb)->seq);
 
 	if (esp->conf.ivlen) {
 		if (unlikely(!esp->conf.ivinitted)) {
@@ -437,6 +436,7 @@ static struct xfrm_type esp_type =
 	.description	= "ESP4",
 	.owner		= THIS_MODULE,
 	.proto	     	= IPPROTO_ESP,
+	.flags		= XFRM_TYPE_REPLAY_PROT,
 	.init_state	= esp_init_state,
 	.destructor	= esp_destroy,
 	.get_mtu	= esp4_get_mtu,
diff --git a/net/ipv6/ah6.c b/net/ipv6/ah6.c
index 69a2030..ae68a90 100644
--- a/net/ipv6/ah6.c
+++ b/net/ipv6/ah6.c
@@ -283,8 +283,7 @@ static int ah6_output(struct xfrm_state *x, struct sk_buff *skb)
 
 	ah->reserved = 0;
 	ah->spi = x->id.spi;
-	ah->seq_no = htonl(++x->replay.oseq);
-	xfrm_aevent_doreplay(x);
+	ah->seq_no = htonl(XFRM_SKB_CB(skb)->seq);
 	err = ah_mac_digest(ahp, skb, ah->auth_data);
 	if (err)
 		goto error_free_iph;
@@ -506,6 +505,7 @@ static struct xfrm_type ah6_type =
 	.description	= "AH6",
 	.owner		= THIS_MODULE,
 	.proto	     	= IPPROTO_AH,
+	.flags		= XFRM_TYPE_REPLAY_PROT,
 	.init_state	= ah6_init_state,
 	.destructor	= ah6_destroy,
 	.input		= ah6_input,
diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c
index 7728106..0c5fb81 100644
--- a/net/ipv6/esp6.c
+++ b/net/ipv6/esp6.c
@@ -95,8 +95,7 @@ static int esp6_output(struct xfrm_state *x, struct sk_buff *skb)
 	*skb_network_header(skb) = IPPROTO_ESP;
 
 	esph->spi = x->id.spi;
-	esph->seq_no = htonl(++x->replay.oseq);
-	xfrm_aevent_doreplay(x);
+	esph->seq_no = htonl(XFRM_SKB_CB(skb)->seq);
 
 	if (esp->conf.ivlen) {
 		if (unlikely(!esp->conf.ivinitted)) {
@@ -373,6 +372,7 @@ static struct xfrm_type esp6_type =
 	.description	= "ESP6",
 	.owner	     	= THIS_MODULE,
 	.proto	     	= IPPROTO_ESP,
+	.flags		= XFRM_TYPE_REPLAY_PROT,
 	.init_state	= esp6_init_state,
 	.destructor	= esp6_destroy,
 	.get_mtu	= esp6_get_mtu,
diff --git a/net/xfrm/xfrm_output.c b/net/xfrm/xfrm_output.c
index 5b1c978..20e789d 100644
--- a/net/xfrm/xfrm_output.c
+++ b/net/xfrm/xfrm_output.c
@@ -58,6 +58,11 @@ int xfrm_output(struct sk_buff *skb)
 		if (err)
 			goto error;
 
+		if (x->type->flags & XFRM_TYPE_REPLAY_PROT) {
+			XFRM_SKB_CB(skb)->seq = ++x->replay.oseq;
+			xfrm_aevent_doreplay(x);
+		}
+
 		err = x->mode->output(x, skb);
 		if (err)
 			goto error;

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

* [PATCH 6/7] [IPSEC]: Unexport xfrm_replay_notify
  2007-10-08 11:28 [0/7] IPsec: Preparatory patcheds for async crypto on output Herbert Xu
                   ` (4 preceding siblings ...)
  2007-10-08 11:29 ` [PATCH 5/7] [IPSEC]: Move output replay code into xfrm_output Herbert Xu
@ 2007-10-08 11:29 ` Herbert Xu
  2007-10-09  0:26   ` David Miller
  2007-10-08 11:29 ` [PATCH 7/7] [IPSEC]: Move RO-specific output code into xfrm6_mode_ro.c Herbert Xu
  2007-10-08 12:20 ` [0/7] IPsec: Preparatory patcheds for async crypto on output Evgeniy Polyakov
  7 siblings, 1 reply; 20+ messages in thread
From: Herbert Xu @ 2007-10-08 11:29 UTC (permalink / raw)
  To: David S. Miller, netdev

[IPSEC]: Unexport xfrm_replay_notify

Now that the only callers of xfrm_replay_notify are in xfrm, we can remove
the export.

This patch also removes xfrm_aevent_doreplay since it's now called in just
one spot.

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

 include/net/xfrm.h     |    6 ------
 net/xfrm/xfrm_output.c |    3 ++-
 net/xfrm/xfrm_state.c  |    1 -
 3 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index a267725..064a4ca 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -1163,12 +1163,6 @@ static inline int xfrm_aevent_is_on(void)
 	return ret;
 }
 
-static inline void xfrm_aevent_doreplay(struct xfrm_state *x)
-{
-	if (xfrm_aevent_is_on())
-		xfrm_replay_notify(x, XFRM_REPLAY_UPDATE);
-}
-
 #ifdef CONFIG_XFRM_MIGRATE
 static inline struct xfrm_algo *xfrm_algo_clone(struct xfrm_algo *orig)
 {
diff --git a/net/xfrm/xfrm_output.c b/net/xfrm/xfrm_output.c
index 20e789d..40d75ec 100644
--- a/net/xfrm/xfrm_output.c
+++ b/net/xfrm/xfrm_output.c
@@ -60,7 +60,8 @@ int xfrm_output(struct sk_buff *skb)
 
 		if (x->type->flags & XFRM_TYPE_REPLAY_PROT) {
 			XFRM_SKB_CB(skb)->seq = ++x->replay.oseq;
-			xfrm_aevent_doreplay(x);
+			if (xfrm_aevent_is_on())
+				xfrm_replay_notify(x, XFRM_REPLAY_UPDATE);
 		}
 
 		err = x->mode->output(x, skb);
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index 0ecec34..a00745a 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -1397,7 +1397,6 @@ void xfrm_replay_notify(struct xfrm_state *x, int event)
 	    !mod_timer(&x->rtimer, jiffies + x->replay_maxage))
 		x->xflags &= ~XFRM_TIME_DEFER;
 }
-EXPORT_SYMBOL(xfrm_replay_notify);
 
 static void xfrm_replay_timer_handler(unsigned long data)
 {

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

* [PATCH 7/7] [IPSEC]: Move RO-specific output code into xfrm6_mode_ro.c
  2007-10-08 11:28 [0/7] IPsec: Preparatory patcheds for async crypto on output Herbert Xu
                   ` (5 preceding siblings ...)
  2007-10-08 11:29 ` [PATCH 6/7] [IPSEC]: Unexport xfrm_replay_notify Herbert Xu
@ 2007-10-08 11:29 ` Herbert Xu
  2007-10-09  0:27   ` David Miller
  2007-10-08 12:20 ` [0/7] IPsec: Preparatory patcheds for async crypto on output Evgeniy Polyakov
  7 siblings, 1 reply; 20+ messages in thread
From: Herbert Xu @ 2007-10-08 11:29 UTC (permalink / raw)
  To: David S. Miller, netdev

[IPSEC]: Move RO-specific output code into xfrm6_mode_ro.c

The lastused update check in xfrm_output can be done just as well in
the mode output function which is specific to RO.

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

 net/ipv6/xfrm6_mode_ro.c |    4 ++++
 net/xfrm/xfrm_output.c   |    4 ----
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/ipv6/xfrm6_mode_ro.c b/net/ipv6/xfrm6_mode_ro.c
index 6ad6d7a..a156373 100644
--- a/net/ipv6/xfrm6_mode_ro.c
+++ b/net/ipv6/xfrm6_mode_ro.c
@@ -29,6 +29,7 @@
 #include <linux/module.h>
 #include <linux/skbuff.h>
 #include <linux/stringify.h>
+#include <linux/time.h>
 #include <net/ipv6.h>
 #include <net/xfrm.h>
 
@@ -57,6 +58,9 @@ static int xfrm6_ro_output(struct xfrm_state *x, struct sk_buff *skb)
 			       (prevhdr - x->props.header_len) - skb->data);
 	skb_set_transport_header(skb, hdr_len);
 	memmove(skb->data, iph, hdr_len);
+
+	x->lastused = get_seconds();
+
 	return 0;
 }
 
diff --git a/net/xfrm/xfrm_output.c b/net/xfrm/xfrm_output.c
index 40d75ec..8c85211 100644
--- a/net/xfrm/xfrm_output.c
+++ b/net/xfrm/xfrm_output.c
@@ -14,7 +14,6 @@
 #include <linux/netdevice.h>
 #include <linux/skbuff.h>
 #include <linux/spinlock.h>
-#include <linux/time.h>
 #include <net/dst.h>
 #include <net/xfrm.h>
 
@@ -75,9 +74,6 @@ int xfrm_output(struct sk_buff *skb)
 		x->curlft.bytes += skb->len;
 		x->curlft.packets++;
 
-		if (x->props.mode == XFRM_MODE_ROUTEOPTIMIZATION)
-			x->lastused = get_seconds();
-
 		spin_unlock_bh(&x->lock);
 
 		skb_reset_network_header(skb);

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

* Re: [0/7] IPsec: Preparatory patcheds for async crypto on output
  2007-10-08 11:28 [0/7] IPsec: Preparatory patcheds for async crypto on output Herbert Xu
                   ` (6 preceding siblings ...)
  2007-10-08 11:29 ` [PATCH 7/7] [IPSEC]: Move RO-specific output code into xfrm6_mode_ro.c Herbert Xu
@ 2007-10-08 12:20 ` Evgeniy Polyakov
  2007-10-09  0:28   ` David Miller
  7 siblings, 1 reply; 20+ messages in thread
From: Evgeniy Polyakov @ 2007-10-08 12:20 UTC (permalink / raw)
  To: Herbert Xu; +Cc: David S. Miller, netdev

On Mon, Oct 08, 2007 at 07:28:18PM +0800, Herbert Xu (herbert@gondor.apana.org.au) wrote:
> Here is a bunch of patches paving the way for removal of the
> state spin lock on the output path so that we can let the crypto
> complete asynchronously.

Hi Herbert.

This looks great. I especially like xfrm output path generalization and
xfrm_skb_cb structure introduction (acrypto allocated a special
structure from slab for each packet).
Do you expect to complete full async processing before 2.6.24 and, Dave,
is there any chance it can be accepted for upcoming release?

-- 
	Evgeniy Polyakov

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

* Re: [PATCH 1/7] [IPSEC] esp: Remove keys from esp_data structure
  2007-10-08 11:29 ` [PATCH 1/7] [IPSEC] esp: Remove keys from esp_data structure Herbert Xu
@ 2007-10-09  0:14   ` David Miller
  0 siblings, 0 replies; 20+ messages in thread
From: David Miller @ 2007-10-09  0:14 UTC (permalink / raw)
  To: herbert; +Cc: netdev

From: Herbert Xu <herbert@gondor.apana.org.au>
Date: Mon, 08 Oct 2007 19:29:37 +0800

> [IPSEC] esp: Remove keys from esp_data structure
> 
> The keys are only used during initialisation so we don't need to carry them
> in esp_data.  Since we don't have to allocate them again, there is no need
> to place a limit on the authentication key length anymore.
> 
> This patch also kills the unused auth.icv member.
> 
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Nice cleanup, patch applied, thanks!

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

* Re: [PATCH 2/7] [IPSEC] ah: Remove keys from ah_data structure
  2007-10-08 11:29 ` [PATCH 2/7] [IPSEC] ah: Remove keys from ah_data structure Herbert Xu
@ 2007-10-09  0:14   ` David Miller
  0 siblings, 0 replies; 20+ messages in thread
From: David Miller @ 2007-10-09  0:14 UTC (permalink / raw)
  To: herbert; +Cc: netdev

From: Herbert Xu <herbert@gondor.apana.org.au>
Date: Mon, 08 Oct 2007 19:29:38 +0800

> [IPSEC] ah: Remove keys from ah_data structure
> 
> The keys are only used during initialisation so we don't need to carry them
> in esp_data.  Since we don't have to allocate them again, there is no need
> to place a limit on the authentication key length anymore.
> 
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

And if I liked the ESP side, how can I not like this patch :-)

Also applied, thanks Herbert!

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

* Re: [PATCH 3/7] [IPSEC]: Move common output code to xfrm_output
  2007-10-08 11:29 ` [PATCH 3/7] [IPSEC]: Move common output code to xfrm_output Herbert Xu
@ 2007-10-09  0:17   ` David Miller
  2007-10-09  1:02     ` Herbert Xu
  0 siblings, 1 reply; 20+ messages in thread
From: David Miller @ 2007-10-09  0:17 UTC (permalink / raw)
  To: herbert; +Cc: netdev

From: Herbert Xu <herbert@gondor.apana.org.au>
Date: Mon, 08 Oct 2007 19:29:39 +0800

> [IPSEC]: Move common output code to xfrm_output
> 
> Most of the code in xfrm4_output_one and xfrm6_output_one are identical so
> this patch moves them into a common xfrm_output function which will live
> in net/xfrm.
> 
> In fact this would seem to fix a bug as on IPv4 we never reset the network
> header after a transform which may upset netfilter later on.
> 
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Applied.

Could you submit a 2.6.23 version of just the ipv4 fix?
It might be interesting to determine why it was omitted,
perhaps it was an oversight, and it probably predates the
addition of skb_reset_*().

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

* Re: [PATCH 4/7] [IPSEC]: Move xfrm_state_check into xfrm_output.c
  2007-10-08 11:29 ` [PATCH 4/7] [IPSEC]: Move xfrm_state_check into xfrm_output.c Herbert Xu
@ 2007-10-09  0:25   ` David Miller
  0 siblings, 0 replies; 20+ messages in thread
From: David Miller @ 2007-10-09  0:25 UTC (permalink / raw)
  To: herbert; +Cc: netdev

From: Herbert Xu <herbert@gondor.apana.org.au>
Date: Mon, 08 Oct 2007 19:29:41 +0800

> [IPSEC]: Move xfrm_state_check into xfrm_output.c
> 
> The functions xfrm_state_check and xfrm_state_check_space are only used by
> the output code in xfrm_output.c so we can move them over.
> 
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Applied :)

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

* Re: [PATCH 5/7] [IPSEC]: Move output replay code into xfrm_output
  2007-10-08 11:29 ` [PATCH 5/7] [IPSEC]: Move output replay code into xfrm_output Herbert Xu
@ 2007-10-09  0:26   ` David Miller
  0 siblings, 0 replies; 20+ messages in thread
From: David Miller @ 2007-10-09  0:26 UTC (permalink / raw)
  To: herbert; +Cc: netdev

From: Herbert Xu <herbert@gondor.apana.org.au>
Date: Mon, 08 Oct 2007 19:29:42 +0800

> [IPSEC]: Move output replay code into xfrm_output
> 
> The replay counter is one of only two remaining things in the output code
> that requires a lock on the xfrm state (the other being the crypto).  This
> patch moves it into the generic xfrm_output so we can remove the lock from
> the transforms themselves.
> 
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Applied.

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

* Re: [PATCH 6/7] [IPSEC]: Unexport xfrm_replay_notify
  2007-10-08 11:29 ` [PATCH 6/7] [IPSEC]: Unexport xfrm_replay_notify Herbert Xu
@ 2007-10-09  0:26   ` David Miller
  0 siblings, 0 replies; 20+ messages in thread
From: David Miller @ 2007-10-09  0:26 UTC (permalink / raw)
  To: herbert; +Cc: netdev

From: Herbert Xu <herbert@gondor.apana.org.au>
Date: Mon, 08 Oct 2007 19:29:43 +0800

> [IPSEC]: Unexport xfrm_replay_notify
> 
> Now that the only callers of xfrm_replay_notify are in xfrm, we can remove
> the export.
> 
> This patch also removes xfrm_aevent_doreplay since it's now called in just
> one spot.
> 
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Applied.

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

* Re: [PATCH 7/7] [IPSEC]: Move RO-specific output code into xfrm6_mode_ro.c
  2007-10-08 11:29 ` [PATCH 7/7] [IPSEC]: Move RO-specific output code into xfrm6_mode_ro.c Herbert Xu
@ 2007-10-09  0:27   ` David Miller
  0 siblings, 0 replies; 20+ messages in thread
From: David Miller @ 2007-10-09  0:27 UTC (permalink / raw)
  To: herbert; +Cc: netdev

From: Herbert Xu <herbert@gondor.apana.org.au>
Date: Mon, 08 Oct 2007 19:29:44 +0800

> [IPSEC]: Move RO-specific output code into xfrm6_mode_ro.c
> 
> The lastused update check in xfrm_output can be done just as well in
> the mode output function which is specific to RO.
> 
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Also applied, thanks Herbert!

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

* Re: [0/7] IPsec: Preparatory patcheds for async crypto on output
  2007-10-08 12:20 ` [0/7] IPsec: Preparatory patcheds for async crypto on output Evgeniy Polyakov
@ 2007-10-09  0:28   ` David Miller
  2007-10-09  5:30     ` Evgeniy Polyakov
  0 siblings, 1 reply; 20+ messages in thread
From: David Miller @ 2007-10-09  0:28 UTC (permalink / raw)
  To: johnpol; +Cc: herbert, netdev

From: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
Date: Mon, 8 Oct 2007 16:20:40 +0400

> Dave, is there any chance it can be accepted for upcoming release?

Does a Russian drink vodka? :-)

I'm certainly willing to entertain the idea.

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

* Re: [PATCH 3/7] [IPSEC]: Move common output code to xfrm_output
  2007-10-09  0:17   ` David Miller
@ 2007-10-09  1:02     ` Herbert Xu
  2007-10-09  1:18       ` David Miller
  0 siblings, 1 reply; 20+ messages in thread
From: Herbert Xu @ 2007-10-09  1:02 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

On Mon, Oct 08, 2007 at 05:17:17PM -0700, David Miller wrote:
> 
> Could you submit a 2.6.23 version of just the ipv4 fix?
> It might be interesting to determine why it was omitted,
> perhaps it was an oversight, and it probably predates the
> addition of skb_reset_*().

OK I double-checked and it isn't necessary at all for IPv4 as
the mode output function already sets the correct value in it.

It's needed for IPv6 because the mode output functions there
uses it to store a pointer to the NH pointer.

So no changes are necessary.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

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

* Re: [PATCH 3/7] [IPSEC]: Move common output code to xfrm_output
  2007-10-09  1:02     ` Herbert Xu
@ 2007-10-09  1:18       ` David Miller
  0 siblings, 0 replies; 20+ messages in thread
From: David Miller @ 2007-10-09  1:18 UTC (permalink / raw)
  To: herbert; +Cc: netdev

From: Herbert Xu <herbert@gondor.apana.org.au>
Date: Tue, 9 Oct 2007 09:02:57 +0800

> On Mon, Oct 08, 2007 at 05:17:17PM -0700, David Miller wrote:
> > 
> > Could you submit a 2.6.23 version of just the ipv4 fix?
> > It might be interesting to determine why it was omitted,
> > perhaps it was an oversight, and it probably predates the
> > addition of skb_reset_*().
> 
> OK I double-checked and it isn't necessary at all for IPv4 as
> the mode output function already sets the correct value in it.
> 
> It's needed for IPv6 because the mode output functions there
> uses it to store a pointer to the NH pointer.
> 
> So no changes are necessary.

Thanks for doing this research.

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

* Re: [0/7] IPsec: Preparatory patcheds for async crypto on output
  2007-10-09  0:28   ` David Miller
@ 2007-10-09  5:30     ` Evgeniy Polyakov
  0 siblings, 0 replies; 20+ messages in thread
From: Evgeniy Polyakov @ 2007-10-09  5:30 UTC (permalink / raw)
  To: David Miller; +Cc: herbert, netdev

On Mon, Oct 08, 2007 at 05:28:21PM -0700, David Miller (davem@davemloft.net) wrote:
> From: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
> Date: Mon, 8 Oct 2007 16:20:40 +0400
> 
> > Dave, is there any chance it can be accepted for upcoming release?
> 
> Does a Russian drink vodka? :-)

I strongly feel there is some dirty trick in this question, but can not
find it... Usually I answer: "is it a rhetorical question?" :)

> I'm certainly willing to entertain the idea.

Great!

-- 
	Evgeniy Polyakov

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

end of thread, other threads:[~2007-10-09  5:30 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-08 11:28 [0/7] IPsec: Preparatory patcheds for async crypto on output Herbert Xu
2007-10-08 11:29 ` [PATCH 1/7] [IPSEC] esp: Remove keys from esp_data structure Herbert Xu
2007-10-09  0:14   ` David Miller
2007-10-08 11:29 ` [PATCH 2/7] [IPSEC] ah: Remove keys from ah_data structure Herbert Xu
2007-10-09  0:14   ` David Miller
2007-10-08 11:29 ` [PATCH 3/7] [IPSEC]: Move common output code to xfrm_output Herbert Xu
2007-10-09  0:17   ` David Miller
2007-10-09  1:02     ` Herbert Xu
2007-10-09  1:18       ` David Miller
2007-10-08 11:29 ` [PATCH 4/7] [IPSEC]: Move xfrm_state_check into xfrm_output.c Herbert Xu
2007-10-09  0:25   ` David Miller
2007-10-08 11:29 ` [PATCH 5/7] [IPSEC]: Move output replay code into xfrm_output Herbert Xu
2007-10-09  0:26   ` David Miller
2007-10-08 11:29 ` [PATCH 6/7] [IPSEC]: Unexport xfrm_replay_notify Herbert Xu
2007-10-09  0:26   ` David Miller
2007-10-08 11:29 ` [PATCH 7/7] [IPSEC]: Move RO-specific output code into xfrm6_mode_ro.c Herbert Xu
2007-10-09  0:27   ` David Miller
2007-10-08 12:20 ` [0/7] IPsec: Preparatory patcheds for async crypto on output Evgeniy Polyakov
2007-10-09  0:28   ` David Miller
2007-10-09  5:30     ` Evgeniy Polyakov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).