diff options
-rw-r--r-- | include/net/xfrm.h | 3 | ||||
-rw-r--r-- | net/ipv4/xfrm4_policy.c | 7 | ||||
-rw-r--r-- | net/ipv6/xfrm6_policy.c | 7 | ||||
-rw-r--r-- | net/xfrm/xfrm_policy.c | 7 |
4 files changed, 14 insertions, 10 deletions
diff --git a/include/net/xfrm.h b/include/net/xfrm.h index f3ea1607c595..b16d4c0b16e0 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h | |||
@@ -266,7 +266,8 @@ struct xfrm_policy_afinfo { | |||
266 | unsigned short family; | 266 | unsigned short family; |
267 | struct dst_ops *dst_ops; | 267 | struct dst_ops *dst_ops; |
268 | void (*garbage_collect)(struct net *net); | 268 | void (*garbage_collect)(struct net *net); |
269 | struct dst_entry *(*dst_lookup)(int tos, xfrm_address_t *saddr, | 269 | struct dst_entry *(*dst_lookup)(struct net *net, int tos, |
270 | xfrm_address_t *saddr, | ||
270 | xfrm_address_t *daddr); | 271 | xfrm_address_t *daddr); |
271 | int (*get_saddr)(xfrm_address_t *saddr, xfrm_address_t *daddr); | 272 | int (*get_saddr)(xfrm_address_t *saddr, xfrm_address_t *daddr); |
272 | struct dst_entry *(*find_bundle)(struct flowi *fl, struct xfrm_policy *policy); | 273 | struct dst_entry *(*find_bundle)(struct flowi *fl, struct xfrm_policy *policy); |
diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c index a881ca38dddb..e1cf9ed07d49 100644 --- a/net/ipv4/xfrm4_policy.c +++ b/net/ipv4/xfrm4_policy.c | |||
@@ -18,7 +18,8 @@ | |||
18 | static struct dst_ops xfrm4_dst_ops; | 18 | static struct dst_ops xfrm4_dst_ops; |
19 | static struct xfrm_policy_afinfo xfrm4_policy_afinfo; | 19 | static struct xfrm_policy_afinfo xfrm4_policy_afinfo; |
20 | 20 | ||
21 | static struct dst_entry *xfrm4_dst_lookup(int tos, xfrm_address_t *saddr, | 21 | static struct dst_entry *xfrm4_dst_lookup(struct net *net, int tos, |
22 | xfrm_address_t *saddr, | ||
22 | xfrm_address_t *daddr) | 23 | xfrm_address_t *daddr) |
23 | { | 24 | { |
24 | struct flowi fl = { | 25 | struct flowi fl = { |
@@ -36,7 +37,7 @@ static struct dst_entry *xfrm4_dst_lookup(int tos, xfrm_address_t *saddr, | |||
36 | if (saddr) | 37 | if (saddr) |
37 | fl.fl4_src = saddr->a4; | 38 | fl.fl4_src = saddr->a4; |
38 | 39 | ||
39 | err = __ip_route_output_key(&init_net, &rt, &fl); | 40 | err = __ip_route_output_key(net, &rt, &fl); |
40 | dst = &rt->u.dst; | 41 | dst = &rt->u.dst; |
41 | if (err) | 42 | if (err) |
42 | dst = ERR_PTR(err); | 43 | dst = ERR_PTR(err); |
@@ -48,7 +49,7 @@ static int xfrm4_get_saddr(xfrm_address_t *saddr, xfrm_address_t *daddr) | |||
48 | struct dst_entry *dst; | 49 | struct dst_entry *dst; |
49 | struct rtable *rt; | 50 | struct rtable *rt; |
50 | 51 | ||
51 | dst = xfrm4_dst_lookup(0, NULL, daddr); | 52 | dst = xfrm4_dst_lookup(&init_net, 0, NULL, daddr); |
52 | if (IS_ERR(dst)) | 53 | if (IS_ERR(dst)) |
53 | return -EHOSTUNREACH; | 54 | return -EHOSTUNREACH; |
54 | 55 | ||
diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c index 2df8a78fc3df..d7a5b8bc3770 100644 --- a/net/ipv6/xfrm6_policy.c +++ b/net/ipv6/xfrm6_policy.c | |||
@@ -27,7 +27,8 @@ | |||
27 | static struct dst_ops xfrm6_dst_ops; | 27 | static struct dst_ops xfrm6_dst_ops; |
28 | static struct xfrm_policy_afinfo xfrm6_policy_afinfo; | 28 | static struct xfrm_policy_afinfo xfrm6_policy_afinfo; |
29 | 29 | ||
30 | static struct dst_entry *xfrm6_dst_lookup(int tos, xfrm_address_t *saddr, | 30 | static struct dst_entry *xfrm6_dst_lookup(struct net *net, int tos, |
31 | xfrm_address_t *saddr, | ||
31 | xfrm_address_t *daddr) | 32 | xfrm_address_t *daddr) |
32 | { | 33 | { |
33 | struct flowi fl = {}; | 34 | struct flowi fl = {}; |
@@ -38,7 +39,7 @@ static struct dst_entry *xfrm6_dst_lookup(int tos, xfrm_address_t *saddr, | |||
38 | if (saddr) | 39 | if (saddr) |
39 | memcpy(&fl.fl6_src, saddr, sizeof(fl.fl6_src)); | 40 | memcpy(&fl.fl6_src, saddr, sizeof(fl.fl6_src)); |
40 | 41 | ||
41 | dst = ip6_route_output(&init_net, NULL, &fl); | 42 | dst = ip6_route_output(net, NULL, &fl); |
42 | 43 | ||
43 | err = dst->error; | 44 | err = dst->error; |
44 | if (dst->error) { | 45 | if (dst->error) { |
@@ -54,7 +55,7 @@ static int xfrm6_get_saddr(xfrm_address_t *saddr, xfrm_address_t *daddr) | |||
54 | struct dst_entry *dst; | 55 | struct dst_entry *dst; |
55 | struct net_device *dev; | 56 | struct net_device *dev; |
56 | 57 | ||
57 | dst = xfrm6_dst_lookup(0, NULL, daddr); | 58 | dst = xfrm6_dst_lookup(&init_net, 0, NULL, daddr); |
58 | if (IS_ERR(dst)) | 59 | if (IS_ERR(dst)) |
59 | return -EHOSTUNREACH; | 60 | return -EHOSTUNREACH; |
60 | 61 | ||
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index 7ebbdd63fca0..2b0a80b6259b 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
@@ -92,7 +92,7 @@ int xfrm_selector_match(struct xfrm_selector *sel, struct flowi *fl, | |||
92 | return 0; | 92 | return 0; |
93 | } | 93 | } |
94 | 94 | ||
95 | static inline struct dst_entry *__xfrm_dst_lookup(int tos, | 95 | static inline struct dst_entry *__xfrm_dst_lookup(struct net *net, int tos, |
96 | xfrm_address_t *saddr, | 96 | xfrm_address_t *saddr, |
97 | xfrm_address_t *daddr, | 97 | xfrm_address_t *daddr, |
98 | int family) | 98 | int family) |
@@ -104,7 +104,7 @@ static inline struct dst_entry *__xfrm_dst_lookup(int tos, | |||
104 | if (unlikely(afinfo == NULL)) | 104 | if (unlikely(afinfo == NULL)) |
105 | return ERR_PTR(-EAFNOSUPPORT); | 105 | return ERR_PTR(-EAFNOSUPPORT); |
106 | 106 | ||
107 | dst = afinfo->dst_lookup(tos, saddr, daddr); | 107 | dst = afinfo->dst_lookup(net, tos, saddr, daddr); |
108 | 108 | ||
109 | xfrm_policy_put_afinfo(afinfo); | 109 | xfrm_policy_put_afinfo(afinfo); |
110 | 110 | ||
@@ -116,6 +116,7 @@ static inline struct dst_entry *xfrm_dst_lookup(struct xfrm_state *x, int tos, | |||
116 | xfrm_address_t *prev_daddr, | 116 | xfrm_address_t *prev_daddr, |
117 | int family) | 117 | int family) |
118 | { | 118 | { |
119 | struct net *net = xs_net(x); | ||
119 | xfrm_address_t *saddr = &x->props.saddr; | 120 | xfrm_address_t *saddr = &x->props.saddr; |
120 | xfrm_address_t *daddr = &x->id.daddr; | 121 | xfrm_address_t *daddr = &x->id.daddr; |
121 | struct dst_entry *dst; | 122 | struct dst_entry *dst; |
@@ -129,7 +130,7 @@ static inline struct dst_entry *xfrm_dst_lookup(struct xfrm_state *x, int tos, | |||
129 | daddr = x->coaddr; | 130 | daddr = x->coaddr; |
130 | } | 131 | } |
131 | 132 | ||
132 | dst = __xfrm_dst_lookup(tos, saddr, daddr, family); | 133 | dst = __xfrm_dst_lookup(net, tos, saddr, daddr, family); |
133 | 134 | ||
134 | if (!IS_ERR(dst)) { | 135 | if (!IS_ERR(dst)) { |
135 | if (prev_saddr != saddr) | 136 | if (prev_saddr != saddr) |