aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2013-12-19 18:37:49 -0500
committerDavid S. Miller <davem@davemloft.net>2013-12-19 18:37:49 -0500
commit1669cb9855050fe9d2a13391846f9aceccf42559 (patch)
tree80a2f1229902e9db7fd1552ee770372b351f2036 /include
parentcb4eae3d525abbe408e7e0efd7841b5c3c13cd0f (diff)
parentb3c6efbc36e2c5ac820b1a800ac17cc3e040de0c (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec-next
Steffen Klassert says: ==================== pull request (net-next): ipsec-next 2013-12-19 1) Use the user supplied policy index instead of a generated one if present. From Fan Du. 2) Make xfrm migration namespace aware. From Fan Du. 3) Make the xfrm state and policy locks namespace aware. From Fan Du. 4) Remove ancient sleeping when the SA is in acquire state, we now queue packets to the policy instead. This replaces the sleeping code. 5) Remove FLOWI_FLAG_CAN_SLEEP. This was used to notify xfrm about the posibility to sleep. The sleeping code is gone, so remove it. 6) Check user specified spi for IPComp. Thr spi for IPcomp is only 16 bit wide, so check for a valid value. From Fan Du. 7) Export verify_userspi_info to check for valid user supplied spi ranges with pfkey and netlink. From Fan Du. 8) RFC3173 states that if the total size of a compressed payload and the IPComp header is not smaller than the size of the original payload, the IP datagram must be sent in the original non-compressed form. These packets are dropped by the inbound policy check because they are not transformed. Document the need to set 'level use' for IPcomp to receive such packets anyway. From Fan Du. Please pull or let me know if there are problems. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r--include/net/flow.h3
-rw-r--r--include/net/ipv6.h6
-rw-r--r--include/net/netns/xfrm.h6
-rw-r--r--include/net/route.h8
-rw-r--r--include/net/xfrm.h14
5 files changed, 17 insertions, 20 deletions
diff --git a/include/net/flow.h b/include/net/flow.h
index 65ce471d2ab5..d23e7fa2042e 100644
--- a/include/net/flow.h
+++ b/include/net/flow.h
@@ -20,8 +20,7 @@ struct flowi_common {
20 __u8 flowic_proto; 20 __u8 flowic_proto;
21 __u8 flowic_flags; 21 __u8 flowic_flags;
22#define FLOWI_FLAG_ANYSRC 0x01 22#define FLOWI_FLAG_ANYSRC 0x01
23#define FLOWI_FLAG_CAN_SLEEP 0x02 23#define FLOWI_FLAG_KNOWN_NH 0x02
24#define FLOWI_FLAG_KNOWN_NH 0x04
25 __u32 flowic_secid; 24 __u32 flowic_secid;
26}; 25};
27 26
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index d0bfe3eeb824..e600b89811aa 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -718,11 +718,9 @@ void ip6_flush_pending_frames(struct sock *sk);
718 718
719int ip6_dst_lookup(struct sock *sk, struct dst_entry **dst, struct flowi6 *fl6); 719int ip6_dst_lookup(struct sock *sk, struct dst_entry **dst, struct flowi6 *fl6);
720struct dst_entry *ip6_dst_lookup_flow(struct sock *sk, struct flowi6 *fl6, 720struct dst_entry *ip6_dst_lookup_flow(struct sock *sk, struct flowi6 *fl6,
721 const struct in6_addr *final_dst, 721 const struct in6_addr *final_dst);
722 bool can_sleep);
723struct dst_entry *ip6_sk_dst_lookup_flow(struct sock *sk, struct flowi6 *fl6, 722struct dst_entry *ip6_sk_dst_lookup_flow(struct sock *sk, struct flowi6 *fl6,
724 const struct in6_addr *final_dst, 723 const struct in6_addr *final_dst);
725 bool can_sleep);
726struct dst_entry *ip6_blackhole_route(struct net *net, 724struct dst_entry *ip6_blackhole_route(struct net *net,
727 struct dst_entry *orig_dst); 725 struct dst_entry *orig_dst);
728 726
diff --git a/include/net/netns/xfrm.h b/include/net/netns/xfrm.h
index 5299e69a32af..1006a265beb3 100644
--- a/include/net/netns/xfrm.h
+++ b/include/net/netns/xfrm.h
@@ -33,8 +33,6 @@ struct netns_xfrm {
33 struct hlist_head state_gc_list; 33 struct hlist_head state_gc_list;
34 struct work_struct state_gc_work; 34 struct work_struct state_gc_work;
35 35
36 wait_queue_head_t km_waitq;
37
38 struct list_head policy_all; 36 struct list_head policy_all;
39 struct hlist_head *policy_byidx; 37 struct hlist_head *policy_byidx;
40 unsigned int policy_idx_hmask; 38 unsigned int policy_idx_hmask;
@@ -59,6 +57,10 @@ struct netns_xfrm {
59#if IS_ENABLED(CONFIG_IPV6) 57#if IS_ENABLED(CONFIG_IPV6)
60 struct dst_ops xfrm6_dst_ops; 58 struct dst_ops xfrm6_dst_ops;
61#endif 59#endif
60 spinlock_t xfrm_state_lock;
61 spinlock_t xfrm_policy_sk_bundle_lock;
62 rwlock_t xfrm_policy_lock;
63 struct mutex xfrm_cfg_mutex;
62}; 64};
63 65
64#endif 66#endif
diff --git a/include/net/route.h b/include/net/route.h
index f68c167280a7..638e3ebf76f3 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -239,14 +239,12 @@ static inline char rt_tos2priority(u8 tos)
239static inline void ip_route_connect_init(struct flowi4 *fl4, __be32 dst, __be32 src, 239static inline void ip_route_connect_init(struct flowi4 *fl4, __be32 dst, __be32 src,
240 u32 tos, int oif, u8 protocol, 240 u32 tos, int oif, u8 protocol,
241 __be16 sport, __be16 dport, 241 __be16 sport, __be16 dport,
242 struct sock *sk, bool can_sleep) 242 struct sock *sk)
243{ 243{
244 __u8 flow_flags = 0; 244 __u8 flow_flags = 0;
245 245
246 if (inet_sk(sk)->transparent) 246 if (inet_sk(sk)->transparent)
247 flow_flags |= FLOWI_FLAG_ANYSRC; 247 flow_flags |= FLOWI_FLAG_ANYSRC;
248 if (can_sleep)
249 flow_flags |= FLOWI_FLAG_CAN_SLEEP;
250 248
251 flowi4_init_output(fl4, oif, sk->sk_mark, tos, RT_SCOPE_UNIVERSE, 249 flowi4_init_output(fl4, oif, sk->sk_mark, tos, RT_SCOPE_UNIVERSE,
252 protocol, flow_flags, dst, src, dport, sport); 250 protocol, flow_flags, dst, src, dport, sport);
@@ -256,13 +254,13 @@ static inline struct rtable *ip_route_connect(struct flowi4 *fl4,
256 __be32 dst, __be32 src, u32 tos, 254 __be32 dst, __be32 src, u32 tos,
257 int oif, u8 protocol, 255 int oif, u8 protocol,
258 __be16 sport, __be16 dport, 256 __be16 sport, __be16 dport,
259 struct sock *sk, bool can_sleep) 257 struct sock *sk)
260{ 258{
261 struct net *net = sock_net(sk); 259 struct net *net = sock_net(sk);
262 struct rtable *rt; 260 struct rtable *rt;
263 261
264 ip_route_connect_init(fl4, dst, src, tos, oif, protocol, 262 ip_route_connect_init(fl4, dst, src, tos, oif, protocol,
265 sport, dport, sk, can_sleep); 263 sport, dport, sk);
266 264
267 if (!dst || !src) { 265 if (!dst || !src) {
268 rt = __ip_route_output_key(net, fl4); 266 rt = __ip_route_output_key(net, fl4);
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 6b82fdf4ba71..b7635ef4d436 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -53,7 +53,6 @@
53#define XFRM_INC_STATS_USER(net, field) ((void)(net)) 53#define XFRM_INC_STATS_USER(net, field) ((void)(net))
54#endif 54#endif
55 55
56extern struct mutex xfrm_cfg_mutex;
57 56
58/* Organization of SPD aka "XFRM rules" 57/* Organization of SPD aka "XFRM rules"
59 ------------------------------------ 58 ------------------------------------
@@ -1409,7 +1408,7 @@ static inline void xfrm_sysctl_fini(struct net *net)
1409void xfrm_state_walk_init(struct xfrm_state_walk *walk, u8 proto); 1408void xfrm_state_walk_init(struct xfrm_state_walk *walk, u8 proto);
1410int xfrm_state_walk(struct net *net, struct xfrm_state_walk *walk, 1409int xfrm_state_walk(struct net *net, struct xfrm_state_walk *walk,
1411 int (*func)(struct xfrm_state *, int, void*), void *); 1410 int (*func)(struct xfrm_state *, int, void*), void *);
1412void xfrm_state_walk_done(struct xfrm_state_walk *walk); 1411void xfrm_state_walk_done(struct xfrm_state_walk *walk, struct net *net);
1413struct xfrm_state *xfrm_state_alloc(struct net *net); 1412struct xfrm_state *xfrm_state_alloc(struct net *net);
1414struct xfrm_state *xfrm_state_find(const xfrm_address_t *daddr, 1413struct xfrm_state *xfrm_state_find(const xfrm_address_t *daddr,
1415 const xfrm_address_t *saddr, 1414 const xfrm_address_t *saddr,
@@ -1436,12 +1435,12 @@ struct xfrm_state *xfrm_state_lookup_byaddr(struct net *net, u32 mark,
1436 unsigned short family); 1435 unsigned short family);
1437#ifdef CONFIG_XFRM_SUB_POLICY 1436#ifdef CONFIG_XFRM_SUB_POLICY
1438int xfrm_tmpl_sort(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, int n, 1437int xfrm_tmpl_sort(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, int n,
1439 unsigned short family); 1438 unsigned short family, struct net *net);
1440int xfrm_state_sort(struct xfrm_state **dst, struct xfrm_state **src, int n, 1439int xfrm_state_sort(struct xfrm_state **dst, struct xfrm_state **src, int n,
1441 unsigned short family); 1440 unsigned short family);
1442#else 1441#else
1443static inline int xfrm_tmpl_sort(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, 1442static inline int xfrm_tmpl_sort(struct xfrm_tmpl **dst, struct xfrm_tmpl **src,
1444 int n, unsigned short family) 1443 int n, unsigned short family, struct net *net)
1445{ 1444{
1446 return -ENOSYS; 1445 return -ENOSYS;
1447} 1446}
@@ -1553,7 +1552,7 @@ void xfrm_policy_walk_init(struct xfrm_policy_walk *walk, u8 type);
1553int xfrm_policy_walk(struct net *net, struct xfrm_policy_walk *walk, 1552int xfrm_policy_walk(struct net *net, struct xfrm_policy_walk *walk,
1554 int (*func)(struct xfrm_policy *, int, int, void*), 1553 int (*func)(struct xfrm_policy *, int, int, void*),
1555 void *); 1554 void *);
1556void xfrm_policy_walk_done(struct xfrm_policy_walk *walk); 1555void xfrm_policy_walk_done(struct xfrm_policy_walk *walk, struct net *net);
1557int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl); 1556int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl);
1558struct xfrm_policy *xfrm_policy_bysel_ctx(struct net *net, u32 mark, 1557struct xfrm_policy *xfrm_policy_bysel_ctx(struct net *net, u32 mark,
1559 u8 type, int dir, 1558 u8 type, int dir,
@@ -1564,6 +1563,7 @@ struct xfrm_policy *xfrm_policy_byid(struct net *net, u32 mark, u8, int dir,
1564 u32 id, int delete, int *err); 1563 u32 id, int delete, int *err);
1565int xfrm_policy_flush(struct net *net, u8 type, struct xfrm_audit *audit_info); 1564int xfrm_policy_flush(struct net *net, u8 type, struct xfrm_audit *audit_info);
1566u32 xfrm_get_acqseq(void); 1565u32 xfrm_get_acqseq(void);
1566int verify_spi_info(u8 proto, u32 min, u32 max);
1567int xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi); 1567int xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi);
1568struct xfrm_state *xfrm_find_acq(struct net *net, const struct xfrm_mark *mark, 1568struct xfrm_state *xfrm_find_acq(struct net *net, const struct xfrm_mark *mark,
1569 u8 mode, u32 reqid, u8 proto, 1569 u8 mode, u32 reqid, u8 proto,
@@ -1576,12 +1576,12 @@ int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol);
1576int km_migrate(const struct xfrm_selector *sel, u8 dir, u8 type, 1576int km_migrate(const struct xfrm_selector *sel, u8 dir, u8 type,
1577 const struct xfrm_migrate *m, int num_bundles, 1577 const struct xfrm_migrate *m, int num_bundles,
1578 const struct xfrm_kmaddress *k); 1578 const struct xfrm_kmaddress *k);
1579struct xfrm_state *xfrm_migrate_state_find(struct xfrm_migrate *m); 1579struct xfrm_state *xfrm_migrate_state_find(struct xfrm_migrate *m, struct net *net);
1580struct xfrm_state *xfrm_state_migrate(struct xfrm_state *x, 1580struct xfrm_state *xfrm_state_migrate(struct xfrm_state *x,
1581 struct xfrm_migrate *m); 1581 struct xfrm_migrate *m);
1582int xfrm_migrate(const struct xfrm_selector *sel, u8 dir, u8 type, 1582int xfrm_migrate(const struct xfrm_selector *sel, u8 dir, u8 type,
1583 struct xfrm_migrate *m, int num_bundles, 1583 struct xfrm_migrate *m, int num_bundles,
1584 struct xfrm_kmaddress *k); 1584 struct xfrm_kmaddress *k, struct net *net);
1585#endif 1585#endif
1586 1586
1587int km_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, __be16 sport); 1587int km_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, __be16 sport);