aboutsummaryrefslogtreecommitdiffstats
path: root/net/xfrm/xfrm_policy.c
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@gmail.com>2008-11-25 20:29:47 -0500
committerDavid S. Miller <davem@davemloft.net>2008-11-25 20:29:47 -0500
commit98806f75ba2afc716e4d2f915d3ac7687546f9c0 (patch)
treeb874e64635822f95adbc630379a50c1932c1dae2 /net/xfrm/xfrm_policy.c
parent64d0cd009718ce64cf0f388142ead7ea41f1f3c8 (diff)
netns xfrm: trivial netns propagations
Take netns from xfrm_state or xfrm_policy. Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/xfrm/xfrm_policy.c')
-rw-r--r--net/xfrm/xfrm_policy.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 1d300862dc04..3d931f52f897 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -1069,29 +1069,32 @@ static struct xfrm_policy *xfrm_sk_policy_lookup(struct sock *sk, int dir, struc
1069 1069
1070static void __xfrm_policy_link(struct xfrm_policy *pol, int dir) 1070static void __xfrm_policy_link(struct xfrm_policy *pol, int dir)
1071{ 1071{
1072 struct net *net = xp_net(pol);
1072 struct hlist_head *chain = policy_hash_bysel(&pol->selector, 1073 struct hlist_head *chain = policy_hash_bysel(&pol->selector,
1073 pol->family, dir); 1074 pol->family, dir);
1074 1075
1075 list_add(&pol->walk.all, &init_net.xfrm.policy_all); 1076 list_add(&pol->walk.all, &net->xfrm.policy_all);
1076 hlist_add_head(&pol->bydst, chain); 1077 hlist_add_head(&pol->bydst, chain);
1077 hlist_add_head(&pol->byidx, init_net.xfrm.policy_byidx+idx_hash(pol->index)); 1078 hlist_add_head(&pol->byidx, net->xfrm.policy_byidx+idx_hash(pol->index));
1078 init_net.xfrm.policy_count[dir]++; 1079 net->xfrm.policy_count[dir]++;
1079 xfrm_pol_hold(pol); 1080 xfrm_pol_hold(pol);
1080 1081
1081 if (xfrm_bydst_should_resize(&init_net, dir, NULL)) 1082 if (xfrm_bydst_should_resize(net, dir, NULL))
1082 schedule_work(&init_net.xfrm.policy_hash_work); 1083 schedule_work(&net->xfrm.policy_hash_work);
1083} 1084}
1084 1085
1085static struct xfrm_policy *__xfrm_policy_unlink(struct xfrm_policy *pol, 1086static struct xfrm_policy *__xfrm_policy_unlink(struct xfrm_policy *pol,
1086 int dir) 1087 int dir)
1087{ 1088{
1089 struct net *net = xp_net(pol);
1090
1088 if (hlist_unhashed(&pol->bydst)) 1091 if (hlist_unhashed(&pol->bydst))
1089 return NULL; 1092 return NULL;
1090 1093
1091 hlist_del(&pol->bydst); 1094 hlist_del(&pol->bydst);
1092 hlist_del(&pol->byidx); 1095 hlist_del(&pol->byidx);
1093 list_del(&pol->walk.all); 1096 list_del(&pol->walk.all);
1094 init_net.xfrm.policy_count[dir]--; 1097 net->xfrm.policy_count[dir]--;
1095 1098
1096 return pol; 1099 return pol;
1097} 1100}