summaryrefslogtreecommitdiffstats
path: root/net/xfrm/xfrm_policy.c
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@gmail.com>2008-11-25 17:29:47 -0800
committerDavid S. Miller <davem@davemloft.net>2008-11-25 17:29:47 -0800
commit98806f75ba2afc716e4d2f915d3ac7687546f9c0 (patch)
treeb874e64635822f95adbc630379a50c1932c1dae2 /net/xfrm/xfrm_policy.c
parent64d0cd009718ce64cf0f388142ead7ea41f1f3c8 (diff)
downloadop-kernel-dev-98806f75ba2afc716e4d2f915d3ac7687546f9c0.zip
op-kernel-dev-98806f75ba2afc716e4d2f915d3ac7687546f9c0.tar.gz
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 1d30086..3d931f5 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
static void __xfrm_policy_link(struct xfrm_policy *pol, int dir)
{
+ struct net *net = xp_net(pol);
struct hlist_head *chain = policy_hash_bysel(&pol->selector,
pol->family, dir);
- list_add(&pol->walk.all, &init_net.xfrm.policy_all);
+ list_add(&pol->walk.all, &net->xfrm.policy_all);
hlist_add_head(&pol->bydst, chain);
- hlist_add_head(&pol->byidx, init_net.xfrm.policy_byidx+idx_hash(pol->index));
- init_net.xfrm.policy_count[dir]++;
+ hlist_add_head(&pol->byidx, net->xfrm.policy_byidx+idx_hash(pol->index));
+ net->xfrm.policy_count[dir]++;
xfrm_pol_hold(pol);
- if (xfrm_bydst_should_resize(&init_net, dir, NULL))
- schedule_work(&init_net.xfrm.policy_hash_work);
+ if (xfrm_bydst_should_resize(net, dir, NULL))
+ schedule_work(&net->xfrm.policy_hash_work);
}
static struct xfrm_policy *__xfrm_policy_unlink(struct xfrm_policy *pol,
int dir)
{
+ struct net *net = xp_net(pol);
+
if (hlist_unhashed(&pol->bydst))
return NULL;
hlist_del(&pol->bydst);
hlist_del(&pol->byidx);
list_del(&pol->walk.all);
- init_net.xfrm.policy_count[dir]--;
+ net->xfrm.policy_count[dir]--;
return pol;
}
OpenPOWER on IntegriCloud