aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@gmail.com>2008-11-25 20:56:49 -0500
committerDavid S. Miller <davem@davemloft.net>2008-11-25 20:56:49 -0500
commitfbda33b2b85941c1ae3a0d89522dec5c1b1bd98c (patch)
treef35036a6faf4fa549e45ff2b0407344e17cf9455
parentc5b3cf46eabe6e7459125fc6e2033b4222665017 (diff)
netns xfrm: ->get_saddr in netns
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/net/xfrm.h2
-rw-r--r--net/ipv4/xfrm4_policy.c5
-rw-r--r--net/ipv6/xfrm6_policy.c5
-rw-r--r--net/xfrm/xfrm_policy.c7
4 files changed, 11 insertions, 8 deletions
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index b16d4c0b16e0..d076f3d34278 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -269,7 +269,7 @@ struct xfrm_policy_afinfo {
269 struct dst_entry *(*dst_lookup)(struct net *net, int tos, 269 struct dst_entry *(*dst_lookup)(struct net *net, int tos,
270 xfrm_address_t *saddr, 270 xfrm_address_t *saddr,
271 xfrm_address_t *daddr); 271 xfrm_address_t *daddr);
272 int (*get_saddr)(xfrm_address_t *saddr, xfrm_address_t *daddr); 272 int (*get_saddr)(struct net *net, xfrm_address_t *saddr, xfrm_address_t *daddr);
273 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);
274 void (*decode_session)(struct sk_buff *skb, 274 void (*decode_session)(struct sk_buff *skb,
275 struct flowi *fl, 275 struct flowi *fl,
diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c
index e1cf9ed07d49..2ad24ba31f9d 100644
--- a/net/ipv4/xfrm4_policy.c
+++ b/net/ipv4/xfrm4_policy.c
@@ -44,12 +44,13 @@ static struct dst_entry *xfrm4_dst_lookup(struct net *net, int tos,
44 return dst; 44 return dst;
45} 45}
46 46
47static int xfrm4_get_saddr(xfrm_address_t *saddr, xfrm_address_t *daddr) 47static int xfrm4_get_saddr(struct net *net,
48 xfrm_address_t *saddr, xfrm_address_t *daddr)
48{ 49{
49 struct dst_entry *dst; 50 struct dst_entry *dst;
50 struct rtable *rt; 51 struct rtable *rt;
51 52
52 dst = xfrm4_dst_lookup(&init_net, 0, NULL, daddr); 53 dst = xfrm4_dst_lookup(net, 0, NULL, daddr);
53 if (IS_ERR(dst)) 54 if (IS_ERR(dst))
54 return -EHOSTUNREACH; 55 return -EHOSTUNREACH;
55 56
diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c
index d7a5b8bc3770..97ab068e8ccc 100644
--- a/net/ipv6/xfrm6_policy.c
+++ b/net/ipv6/xfrm6_policy.c
@@ -50,12 +50,13 @@ static struct dst_entry *xfrm6_dst_lookup(struct net *net, int tos,
50 return dst; 50 return dst;
51} 51}
52 52
53static int xfrm6_get_saddr(xfrm_address_t *saddr, xfrm_address_t *daddr) 53static int xfrm6_get_saddr(struct net *net,
54 xfrm_address_t *saddr, xfrm_address_t *daddr)
54{ 55{
55 struct dst_entry *dst; 56 struct dst_entry *dst;
56 struct net_device *dev; 57 struct net_device *dev;
57 58
58 dst = xfrm6_dst_lookup(&init_net, 0, NULL, daddr); 59 dst = xfrm6_dst_lookup(net, 0, NULL, daddr);
59 if (IS_ERR(dst)) 60 if (IS_ERR(dst))
60 return -EHOSTUNREACH; 61 return -EHOSTUNREACH;
61 62
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 2b0a80b6259b..7c7bb54f2265 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -1187,7 +1187,7 @@ int __xfrm_sk_clone_policy(struct sock *sk)
1187} 1187}
1188 1188
1189static int 1189static int
1190xfrm_get_saddr(xfrm_address_t *local, xfrm_address_t *remote, 1190xfrm_get_saddr(struct net *net, xfrm_address_t *local, xfrm_address_t *remote,
1191 unsigned short family) 1191 unsigned short family)
1192{ 1192{
1193 int err; 1193 int err;
@@ -1195,7 +1195,7 @@ xfrm_get_saddr(xfrm_address_t *local, xfrm_address_t *remote,
1195 1195
1196 if (unlikely(afinfo == NULL)) 1196 if (unlikely(afinfo == NULL))
1197 return -EINVAL; 1197 return -EINVAL;
1198 err = afinfo->get_saddr(local, remote); 1198 err = afinfo->get_saddr(net, local, remote);
1199 xfrm_policy_put_afinfo(afinfo); 1199 xfrm_policy_put_afinfo(afinfo);
1200 return err; 1200 return err;
1201} 1201}
@@ -1207,6 +1207,7 @@ xfrm_tmpl_resolve_one(struct xfrm_policy *policy, struct flowi *fl,
1207 struct xfrm_state **xfrm, 1207 struct xfrm_state **xfrm,
1208 unsigned short family) 1208 unsigned short family)
1209{ 1209{
1210 struct net *net = xp_net(policy);
1210 int nx; 1211 int nx;
1211 int i, error; 1212 int i, error;
1212 xfrm_address_t *daddr = xfrm_flowi_daddr(fl, family); 1213 xfrm_address_t *daddr = xfrm_flowi_daddr(fl, family);
@@ -1225,7 +1226,7 @@ xfrm_tmpl_resolve_one(struct xfrm_policy *policy, struct flowi *fl,
1225 local = &tmpl->saddr; 1226 local = &tmpl->saddr;
1226 family = tmpl->encap_family; 1227 family = tmpl->encap_family;
1227 if (xfrm_addr_any(local, family)) { 1228 if (xfrm_addr_any(local, family)) {
1228 error = xfrm_get_saddr(&tmp, remote, family); 1229 error = xfrm_get_saddr(net, &tmp, remote, family);
1229 if (error) 1230 if (error)
1230 goto fail; 1231 goto fail;
1231 local = &tmp; 1232 local = &tmp;