Skip to contentSkip to conversation

STATE: Introduce care-of address.

PATCH In review Masahide NAKAMURA 1 participant 1 message Jul 29, 2006

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 12/23 STATE: Introduce care-of address.

Care-of address is carried by state as a transformation option like IPsec encryption/authentication algorithm.
Based on MIPL2 kernel patch.

---
 include/linux/xfrm.h  |    1 +
 include/net/xfrm.h    |    5 +++++
 net/xfrm/xfrm_state.c |   10 +++++++++
 net/xfrm/xfrm_user.c  |   53 ++++++++++++++++++++++++++++++++++++++++++++++++-
 4 files changed, 68 insertions(+), 1 deletions(-)
include/linux/xfrm.h +1 -0
index 47e39f6..597a7c7 100644
@@ -235,6 +235,7 @@ enum xfrm_attr_type_t {
 	XFRMA_REPLAY_VAL,
 	XFRMA_REPLAY_THRESH,
 	XFRMA_ETIMER_THRESH,
+	XFRMA_ADDR,		/* xfrm_address_t */
 	__XFRMA_MAX
 
 #define XFRMA_MAX (__XFRMA_MAX - 1)
include/net/xfrm.h +5 -0
index f551bc6..de62a8f 100644
@@ -135,6 +135,11 @@ #endif
 	/* Data for encapsulator */
 	struct xfrm_encap_tmpl	*encap;
 
+#ifdef CONFIG_XFRM_ADVANCED
+	/* Data for care-of address */
+	xfrm_address_t	*coaddr;
+#endif
+
 	/* IPComp needs an IPIP tunnel for handling uncompressed packets */
 	struct xfrm_state	*tunnel;
 
net/xfrm/xfrm_state.c +10 -0
index 60def7a..1bdeecf 100644
@@ -80,6 +80,9 @@ static void xfrm_state_gc_destroy(struct
 	kfree(x->ealg);
 	kfree(x->calg);
 	kfree(x->encap);
+#ifdef CONFIG_XFRM_ADVANCED
+	kfree(x->coaddr);
+#endif
 	if (x->type) {
 		x->type->destructor(x);
 		xfrm_put_type(x->type);
@@ -619,6 +622,13 @@ out:
 	if (likely(x1->km.state == XFRM_STATE_VALID)) {
 		if (x->encap && x1->encap)
 			memcpy(x1->encap, x->encap, sizeof(*x1->encap));
+#ifdef CONFIG_XFRM_ADVANCED
+		if (x->coaddr && x1->coaddr) {
+			memcpy(x1->coaddr, x->coaddr, sizeof(*x1->coaddr));
+		}
+		if (!use_spi && memcmp(&x1->sel, &x->sel, sizeof(x1->sel)))
+			memcpy(&x1->sel, &x->sel, sizeof(x1->sel));
+#endif
 		memcpy(&x1->lft, &x->lft, sizeof(x1->lft));
 		x1->km.dying = 0;
 
net/xfrm/xfrm_user.c +52 -1

88 lines not on this page · raw message

Signature · 1 line
1.4.1