aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2014-03-18 14:09:07 -0400
committerDavid S. Miller <davem@davemloft.net>2014-03-18 14:09:07 -0400
commit995dca4ce9dddf48597bd3e0427447acd4509f1d (patch)
treeea74e64d0cf2b957ff4dc22e53f4140eabfb0495 /include
parentd70e941bff5f223017ba7001b8eb0423a636c070 (diff)
parent61220ab349485d911083d0b7990ccd3db6c63297 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec-next
Steffen Klassert says: ==================== One patch to rename a newly introduced struct. The rest is the rework of the IPsec virtual tunnel interface for ipv6 to support inter address family tunneling and namespace crossing. 1) Rename the newly introduced struct xfrm_filter to avoid a conflict with iproute2. From Nicolas Dichtel. 2) Introduce xfrm_input_afinfo to access the address family dependent tunnel callback functions properly. 3) Add and use a IPsec protocol multiplexer for ipv6. 4) Remove dst_entry caching. vti can lookup multiple different dst entries, dependent of the configured xfrm states. Therefore it does not make to cache a dst_entry. 5) Remove caching of flow informations. vti6 does not use the the tunnel endpoint addresses to do route and xfrm lookups. 6) Update the vti6 to use its own receive hook. 7) Remove the now unused xfrm_tunnel_notifier. This was used from vti and is replaced by the IPsec protocol multiplexer hooks. 8) Support inter address family tunneling for vti6. 9) Check if the tunnel endpoints of the xfrm state and the vti interface are matching and return an error otherwise. 10) Enable namespace crossing for vti devices. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r--include/net/xfrm.h50
-rw-r--r--include/uapi/linux/xfrm.h4
2 files changed, 30 insertions, 24 deletions
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 23bfd4591e8b..32682ae47b3f 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -121,7 +121,7 @@ struct xfrm_state_walk {
121 u8 dying; 121 u8 dying;
122 u8 proto; 122 u8 proto;
123 u32 seq; 123 u32 seq;
124 struct xfrm_filter *filter; 124 struct xfrm_address_filter *filter;
125}; 125};
126 126
127/* Full description of state of transformer. */ 127/* Full description of state of transformer. */
@@ -349,6 +349,16 @@ int xfrm_state_unregister_afinfo(struct xfrm_state_afinfo *afinfo);
349struct xfrm_state_afinfo *xfrm_state_get_afinfo(unsigned int family); 349struct xfrm_state_afinfo *xfrm_state_get_afinfo(unsigned int family);
350void xfrm_state_put_afinfo(struct xfrm_state_afinfo *afinfo); 350void xfrm_state_put_afinfo(struct xfrm_state_afinfo *afinfo);
351 351
352struct xfrm_input_afinfo {
353 unsigned int family;
354 struct module *owner;
355 int (*callback)(struct sk_buff *skb, u8 protocol,
356 int err);
357};
358
359int xfrm_input_register_afinfo(struct xfrm_input_afinfo *afinfo);
360int xfrm_input_unregister_afinfo(struct xfrm_input_afinfo *afinfo);
361
352void xfrm_state_delete_tunnel(struct xfrm_state *x); 362void xfrm_state_delete_tunnel(struct xfrm_state *x);
353 363
354struct xfrm_type { 364struct xfrm_type {
@@ -1364,18 +1374,22 @@ struct xfrm4_protocol {
1364 int priority; 1374 int priority;
1365}; 1375};
1366 1376
1367/* XFRM tunnel handlers. */ 1377struct xfrm6_protocol {
1368struct xfrm_tunnel {
1369 int (*handler)(struct sk_buff *skb); 1378 int (*handler)(struct sk_buff *skb);
1370 int (*err_handler)(struct sk_buff *skb, u32 info); 1379 int (*cb_handler)(struct sk_buff *skb, int err);
1380 int (*err_handler)(struct sk_buff *skb, struct inet6_skb_parm *opt,
1381 u8 type, u8 code, int offset, __be32 info);
1371 1382
1372 struct xfrm_tunnel __rcu *next; 1383 struct xfrm6_protocol __rcu *next;
1373 int priority; 1384 int priority;
1374}; 1385};
1375 1386
1376struct xfrm_tunnel_notifier { 1387/* XFRM tunnel handlers. */
1388struct xfrm_tunnel {
1377 int (*handler)(struct sk_buff *skb); 1389 int (*handler)(struct sk_buff *skb);
1378 struct xfrm_tunnel_notifier __rcu *next; 1390 int (*err_handler)(struct sk_buff *skb, u32 info);
1391
1392 struct xfrm_tunnel __rcu *next;
1379 int priority; 1393 int priority;
1380}; 1394};
1381 1395
@@ -1392,11 +1406,14 @@ void xfrm4_init(void);
1392int xfrm_state_init(struct net *net); 1406int xfrm_state_init(struct net *net);
1393void xfrm_state_fini(struct net *net); 1407void xfrm_state_fini(struct net *net);
1394void xfrm4_state_init(void); 1408void xfrm4_state_init(void);
1409void xfrm4_protocol_init(void);
1395#ifdef CONFIG_XFRM 1410#ifdef CONFIG_XFRM
1396int xfrm6_init(void); 1411int xfrm6_init(void);
1397void xfrm6_fini(void); 1412void xfrm6_fini(void);
1398int xfrm6_state_init(void); 1413int xfrm6_state_init(void);
1399void xfrm6_state_fini(void); 1414void xfrm6_state_fini(void);
1415int xfrm6_protocol_init(void);
1416void xfrm6_protocol_fini(void);
1400#else 1417#else
1401static inline int xfrm6_init(void) 1418static inline int xfrm6_init(void)
1402{ 1419{
@@ -1423,7 +1440,7 @@ static inline void xfrm_sysctl_fini(struct net *net)
1423#endif 1440#endif
1424 1441
1425void xfrm_state_walk_init(struct xfrm_state_walk *walk, u8 proto, 1442void xfrm_state_walk_init(struct xfrm_state_walk *walk, u8 proto,
1426 struct xfrm_filter *filter); 1443 struct xfrm_address_filter *filter);
1427int xfrm_state_walk(struct net *net, struct xfrm_state_walk *walk, 1444int xfrm_state_walk(struct net *net, struct xfrm_state_walk *walk,
1428 int (*func)(struct xfrm_state *, int, void*), void *); 1445 int (*func)(struct xfrm_state *, int, void*), void *);
1429void xfrm_state_walk_done(struct xfrm_state_walk *walk, struct net *net); 1446void xfrm_state_walk_done(struct xfrm_state_walk *walk, struct net *net);
@@ -1531,8 +1548,6 @@ int xfrm4_protocol_deregister(struct xfrm4_protocol *handler, unsigned char prot
1531int xfrm4_tunnel_register(struct xfrm_tunnel *handler, unsigned short family); 1548int xfrm4_tunnel_register(struct xfrm_tunnel *handler, unsigned short family);
1532int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler, unsigned short family); 1549int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler, unsigned short family);
1533void xfrm4_local_error(struct sk_buff *skb, u32 mtu); 1550void xfrm4_local_error(struct sk_buff *skb, u32 mtu);
1534int xfrm6_mode_tunnel_input_register(struct xfrm_tunnel_notifier *handler);
1535int xfrm6_mode_tunnel_input_deregister(struct xfrm_tunnel_notifier *handler);
1536int xfrm6_extract_header(struct sk_buff *skb); 1551int xfrm6_extract_header(struct sk_buff *skb);
1537int xfrm6_extract_input(struct xfrm_state *x, struct sk_buff *skb); 1552int xfrm6_extract_input(struct xfrm_state *x, struct sk_buff *skb);
1538int xfrm6_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi); 1553int xfrm6_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi);
@@ -1541,6 +1556,9 @@ int xfrm6_rcv(struct sk_buff *skb);
1541int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr, 1556int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr,
1542 xfrm_address_t *saddr, u8 proto); 1557 xfrm_address_t *saddr, u8 proto);
1543void xfrm6_local_error(struct sk_buff *skb, u32 mtu); 1558void xfrm6_local_error(struct sk_buff *skb, u32 mtu);
1559int xfrm6_rcv_cb(struct sk_buff *skb, u8 protocol, int err);
1560int xfrm6_protocol_register(struct xfrm6_protocol *handler, unsigned char protocol);
1561int xfrm6_protocol_deregister(struct xfrm6_protocol *handler, unsigned char protocol);
1544int xfrm6_tunnel_register(struct xfrm6_tunnel *handler, unsigned short family); 1562int xfrm6_tunnel_register(struct xfrm6_tunnel *handler, unsigned short family);
1545int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler, unsigned short family); 1563int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler, unsigned short family);
1546__be32 xfrm6_tunnel_alloc_spi(struct net *net, xfrm_address_t *saddr); 1564__be32 xfrm6_tunnel_alloc_spi(struct net *net, xfrm_address_t *saddr);
@@ -1784,18 +1802,6 @@ static inline int xfrm_mark_put(struct sk_buff *skb, const struct xfrm_mark *m)
1784 return ret; 1802 return ret;
1785} 1803}
1786 1804
1787static inline int xfrm_rcv_cb(struct sk_buff *skb, unsigned int family,
1788 u8 protocol, int err)
1789{
1790 switch(family) {
1791#ifdef CONFIG_INET
1792 case AF_INET:
1793 return xfrm4_rcv_cb(skb, protocol, err);
1794#endif
1795 }
1796 return 0;
1797}
1798
1799static inline int xfrm_tunnel_check(struct sk_buff *skb, struct xfrm_state *x, 1805static inline int xfrm_tunnel_check(struct sk_buff *skb, struct xfrm_state *x,
1800 unsigned int family) 1806 unsigned int family)
1801{ 1807{
diff --git a/include/uapi/linux/xfrm.h b/include/uapi/linux/xfrm.h
index 6550c679584f..25e5dd916ba4 100644
--- a/include/uapi/linux/xfrm.h
+++ b/include/uapi/linux/xfrm.h
@@ -299,7 +299,7 @@ enum xfrm_attr_type_t {
299 XFRMA_REPLAY_ESN_VAL, /* struct xfrm_replay_esn */ 299 XFRMA_REPLAY_ESN_VAL, /* struct xfrm_replay_esn */
300 XFRMA_SA_EXTRA_FLAGS, /* __u32 */ 300 XFRMA_SA_EXTRA_FLAGS, /* __u32 */
301 XFRMA_PROTO, /* __u8 */ 301 XFRMA_PROTO, /* __u8 */
302 XFRMA_FILTER, /* struct xfrm_filter */ 302 XFRMA_ADDRESS_FILTER, /* struct xfrm_address_filter */
303 __XFRMA_MAX 303 __XFRMA_MAX
304 304
305#define XFRMA_MAX (__XFRMA_MAX - 1) 305#define XFRMA_MAX (__XFRMA_MAX - 1)
@@ -476,7 +476,7 @@ struct xfrm_user_mapping {
476 __be16 new_sport; 476 __be16 new_sport;
477}; 477};
478 478
479struct xfrm_filter { 479struct xfrm_address_filter {
480 xfrm_address_t saddr; 480 xfrm_address_t saddr;
481 xfrm_address_t daddr; 481 xfrm_address_t daddr;
482 __u16 family; 482 __u16 family;