Skip to contentSkip to conversation

pull request (net-next): ipsec-next 2013-10-18

PATCH New Steffen Klassert 2 participants 6 messages Oct 18, 2013

Subsystems (4)
lore
Share & tools
lore

Steffen Klassert

author maintainer
#0 lore raw

1) Don't use a wildcard SA if a more precise one is in acquire state, from Fan Du.

2) Simplify the SA lookup when using wildcard source. We need to check only the destination in this case, from Fan Du.

3) Add a receive path hook for IPsec virtual tunnel interfaces to xfrm6_mode_tunnel.

4) Add support for IPsec virtual tunnel interfaces to ipv6.

Please pull or let me know if there are problems.

Thanks!

The following changes since commit b32418705107265dfca5edfe2b547643e53a732e:

bonding: RCUify bond_set_rx_mode() (2013-09-30 22:26:41 -0700)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec-next.git master

for you to fetch changes up to ed1efb2aefbbc6f5a3da5b42158bfb753ba6fe82:

ipv6: Add support for IPsec virtual tunnel interfaces (2013-10-10 12:00:01 +0200)

----------------------------------------------------------------
Fan Du (2):
xfrm: Force SA to be lookup again if SA in acquire state
xfrm: Simplify SA looking up when using wildcard source

Steffen Klassert (2):
ipv6: Add a receive path hook for vti6 in xfrm6_mode_tunnel.
ipv6: Add support for IPsec virtual tunnel interfaces

 include/net/xfrm.h           |    2 +
 net/ipv6/Kconfig             |   11 +
 net/ipv6/Makefile            |    1 +
 net/ipv6/ip6_vti.c           | 1056 ++++++++++++++++++++++++++++++++++++++++++
 net/ipv6/xfrm6_mode_tunnel.c |   69 +++
 net/xfrm/xfrm_state.c        |    4 +-
 6 files changed, 1141 insertions(+), 2 deletions(-)
 create mode 100644 net/ipv6/ip6_vti.c
author maintainer
#1 lore raw

PATCH 1/4 xfrm: Force SA to be lookup again if SA in acquire state

From: Fan Du <[email protected]>

If SA is in the process of acquiring, which indicates this SA is more promising and precise than the fall back option, i.e. using wild card source address for searching less suitable SA.

So, here bail out, and try again.

---
 net/xfrm/xfrm_state.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/xfrm/xfrm_state.c +1 -1
index d6e7f98..b2117a1 100644
@@ -815,7 +815,7 @@ xfrm_state_find(const xfrm_address_t *daddr, const xfrm_address_t *saddr,
 			xfrm_state_look_at(pol, x, fl, encap_family,
 					   &best, &acquire_in_progress, &error);
 	}
-	if (best)
+	if (best || acquire_in_progress)
 		goto found;
 
 	h_wildcard = xfrm_dst_hash(net, daddr, &saddr_wildcard, tmpl->reqid, encap_family);
Signature · 1 line
1.7.9.5
author maintainer
#2 lore raw

PATCH 2/4 xfrm: Simplify SA looking up when using wildcard source

In reply to Steffen Klassert

From: Fan Du <[email protected]>

__xfrm4/6_state_addr_check is a four steps check, all we need to do is checking whether the destination address match when looking SA using wildcard source address. Passing saddr from flow is worst option, as the checking needs to reach the fourth step while actually only one time checking will do the work.

So, simplify this process by only checking destination address when using wildcard source address for looking up SAs.

---
 net/xfrm/xfrm_state.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/xfrm/xfrm_state.c +1 -1
index b2117a1..68c2f35 100644
@@ -824,7 +824,7 @@ xfrm_state_find(const xfrm_address_t *daddr, const xfrm_address_t *saddr,
 		    x->props.reqid == tmpl->reqid &&
 		    (mark & x->mark.m) == x->mark.v &&
 		    !(x->props.flags & XFRM_STATE_WILDRECV) &&
-		    xfrm_state_addr_check(x, daddr, saddr, encap_family) &&
+		    xfrm_addr_equal(&x->id.daddr, daddr, encap_family) &&
 		    tmpl->mode == x->props.mode &&
 		    tmpl->id.proto == x->id.proto &&
 		    (tmpl->id.spi == x->id.spi || !tmpl->id.spi))
Signature · 1 line
1.7.9.5
author maintainer
#3 lore raw

PATCH 3/4 ipv6: Add a receive path hook for vti6 in xfrm6_mode_tunnel.

In reply to Steffen Klassert

Add a receive path hook for the IPsec vritual tunnel interface.

---
 include/net/xfrm.h           |    2 ++
 net/ipv6/xfrm6_mode_tunnel.c |   69 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 71 insertions(+)
include/net/xfrm.h +2 -0
index b8a9ed8..6b82fdf 100644
@@ -1508,6 +1508,8 @@ int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler, unsigned short family);
 void xfrm4_local_error(struct sk_buff *skb, u32 mtu);
 int xfrm4_mode_tunnel_input_register(struct xfrm_tunnel_notifier *handler);
 int xfrm4_mode_tunnel_input_deregister(struct xfrm_tunnel_notifier *handler);
+int xfrm6_mode_tunnel_input_register(struct xfrm_tunnel_notifier *handler);
+int xfrm6_mode_tunnel_input_deregister(struct xfrm_tunnel_notifier *handler);
 int xfrm6_extract_header(struct sk_buff *skb);
 int xfrm6_extract_input(struct xfrm_state *x, struct sk_buff *skb);
 int xfrm6_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi);
net/ipv6/xfrm6_mode_tunnel.c +69 -0

89 lines not on this page · raw message

Signature · 1 line
1.7.9.5
author maintainer
#4 lore raw

PATCH 4/4 ipv6: Add support for IPsec virtual tunnel interfaces

In reply to Steffen Klassert

This patch adds IPv6 support for IPsec virtual tunnel interfaces (vti). IPsec virtual tunnel interfaces provide a routable interface for IPsec tunnel endpoints.

---
 net/ipv6/Kconfig   |   11 +
 net/ipv6/Makefile  |    1 +
 net/ipv6/ip6_vti.c | 1056 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 1068 insertions(+)
 create mode 100644 net/ipv6/ip6_vti.c
net/ipv6/Kconfig +11 -0
index 11b13ea..e1a8d90 100644
@@ -153,6 +153,17 @@ config INET6_XFRM_MODE_ROUTEOPTIMIZATION
 	---help---
 	  Support for MIPv6 route optimization mode.
 
+config IPV6_VTI
+tristate "Virtual (secure) IPv6: tunneling"
+	select IPV6_TUNNEL
+	depends on INET6_XFRM_MODE_TUNNEL
+	---help---
+	Tunneling means encapsulating data of one protocol type within
+	another protocol and sending it over a channel that understands the
+	encapsulating protocol. This can be used with xfrm mode tunnel to give
+	the notion of a secure tunnel for IPSEC and then use routing protocol
+	on top.
+
 config IPV6_SIT
 	tristate "IPv6: IPv6-in-IPv4 tunnel (SIT driver)"
 	select INET_TUNNEL
net/ipv6/Makefile +1 -0
index 470a9c0..17bb830 100644
@@ -36,6 +36,7 @@ obj-$(CONFIG_INET6_XFRM_MODE_BEET) += xfrm6_mode_beet.o
 obj-$(CONFIG_IPV6_MIP6) += mip6.o
 obj-$(CONFIG_NETFILTER)	+= netfilter/
 
+obj-$(CONFIG_IPV6_VTI) += ip6_vti.o
 obj-$(CONFIG_IPV6_SIT) += sit.o
 obj-$(CONFIG_IPV6_TUNNEL) += ip6_tunnel.o
 obj-$(CONFIG_IPV6_GRE) += ip6_gre.o
net/ipv6/ip6_vti.c new file +1056 -0

1,056 lines not on this page · raw message

Signature · 1 line
1.7.9.5
maintainer
#5 lore raw
In reply to Steffen Klassert

From: Steffen Klassert <[email protected]>
Date: Fri, 18 Oct 2013 10:42:06 +0200

Quoted 6 lines

1) Don't use a wildcard SA if a more precise one is in acquire state, from Fan Du.

2) Simplify the SA lookup when using wildcard source. We need to check only the destination in this case, from Fan Du.

Quoted 6 lines

3) Add a receive path hook for IPsec virtual tunnel interfaces to xfrm6_mode_tunnel.

4) Add support for IPsec virtual tunnel interfaces to ipv6.

Please pull or let me know if there are problems.

Pulled, thanks Steffen.