[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1232523247-6893-1-git-send-email-timo.teras@iki.fi>
Date: Wed, 21 Jan 2009 09:34:07 +0200
From: Timo Teras <timo.teras@....fi>
To: netdev@...r.kernel.org
Cc: Timo Teras <timo.teras@....fi>
Subject: [PATCH] af_key: parse and send SADB_X_EXT_NAT_T_OA extension
Parse and send SADB_X_EXT_NAT_T_OA along with other NAT-T extensions.
Signed-off-by: Timo Teras <timo.teras@....fi>
---
net/key/af_key.c | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/net/key/af_key.c b/net/key/af_key.c
index f8bd8df..f3e9998 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -824,6 +824,7 @@ static struct sk_buff *__pfkey_xfrm_state2msg(struct xfrm_state *x,
size += sizeof(struct sadb_x_nat_t_type);
size += sizeof(struct sadb_x_nat_t_port);
size += sizeof(struct sadb_x_nat_t_port);
+ size += sizeof(struct sadb_address) + sockaddr_size;
}
skb = alloc_skb(size + 16, GFP_ATOMIC);
@@ -1031,6 +1032,20 @@ static struct sk_buff *__pfkey_xfrm_state2msg(struct xfrm_state *x,
n_port->sadb_x_nat_t_port_exttype = SADB_X_EXT_NAT_T_DPORT;
n_port->sadb_x_nat_t_port_port = natt->encap_dport;
n_port->sadb_x_nat_t_port_reserved = 0;
+
+ /* original address */
+ addr = (struct sadb_address*) skb_put(skb,
+ sizeof(struct sadb_address)+sockaddr_size);
+ addr->sadb_address_len =
+ (sizeof(struct sadb_address)+sockaddr_size)/
+ sizeof(uint64_t);
+ addr->sadb_address_exttype = SADB_X_EXT_NAT_T_OA;
+ addr->sadb_address_proto = 0;
+ addr->sadb_address_reserved = 0;
+ addr->sadb_address_prefixlen =
+ pfkey_sockaddr_fill(&natt->encap_oa, 0,
+ (struct sockaddr *) (addr + 1),
+ x->props.family);
}
/* security context */
@@ -1285,6 +1300,11 @@ static struct xfrm_state * pfkey_msg2xfrm_state(struct net *net,
ext_hdrs[SADB_X_EXT_NAT_T_DPORT-1];
natt->encap_dport = n_port->sadb_x_nat_t_port_port;
}
+ if (ext_hdrs[SADB_X_EXT_NAT_T_OA-1]) {
+ struct sadb_address* n_oa =
+ ext_hdrs[SADB_X_EXT_NAT_T_OA-1];
+ pfkey_sadb_addr2xfrm_addr(n_oa, &natt->encap_oa);
+ }
}
err = xfrm_init_state(x);
--
1.5.6.3
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists