diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2008-11-25 20:34:20 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-11-25 20:34:20 -0500 |
commit | 8d1211a6aaea43ea36151c17b0193eb763ff2d7e (patch) | |
tree | 8e58601a897ec0e2afb3b2b1df695560b0d76ed4 /net/xfrm | |
parent | 33ffbbd52c327225a3e28485c39dc5746d81be03 (diff) |
netns xfrm: finding policy in netns
Add netns parameter to xfrm_policy_bysel_ctx(), xfrm_policy_byidx().
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/xfrm')
-rw-r--r-- | net/xfrm/xfrm_policy.c | 14 | ||||
-rw-r--r-- | net/xfrm/xfrm_user.c | 8 |
2 files changed, 11 insertions, 11 deletions
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index 7c264a74edc0..96895ef61858 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
@@ -642,7 +642,7 @@ int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl) | |||
642 | } | 642 | } |
643 | EXPORT_SYMBOL(xfrm_policy_insert); | 643 | EXPORT_SYMBOL(xfrm_policy_insert); |
644 | 644 | ||
645 | struct xfrm_policy *xfrm_policy_bysel_ctx(u8 type, int dir, | 645 | struct xfrm_policy *xfrm_policy_bysel_ctx(struct net *net, u8 type, int dir, |
646 | struct xfrm_selector *sel, | 646 | struct xfrm_selector *sel, |
647 | struct xfrm_sec_ctx *ctx, int delete, | 647 | struct xfrm_sec_ctx *ctx, int delete, |
648 | int *err) | 648 | int *err) |
@@ -653,7 +653,7 @@ struct xfrm_policy *xfrm_policy_bysel_ctx(u8 type, int dir, | |||
653 | 653 | ||
654 | *err = 0; | 654 | *err = 0; |
655 | write_lock_bh(&xfrm_policy_lock); | 655 | write_lock_bh(&xfrm_policy_lock); |
656 | chain = policy_hash_bysel(&init_net, sel, sel->family, dir); | 656 | chain = policy_hash_bysel(net, sel, sel->family, dir); |
657 | ret = NULL; | 657 | ret = NULL; |
658 | hlist_for_each_entry(pol, entry, chain, bydst) { | 658 | hlist_for_each_entry(pol, entry, chain, bydst) { |
659 | if (pol->type == type && | 659 | if (pol->type == type && |
@@ -670,7 +670,7 @@ struct xfrm_policy *xfrm_policy_bysel_ctx(u8 type, int dir, | |||
670 | hlist_del(&pol->bydst); | 670 | hlist_del(&pol->bydst); |
671 | hlist_del(&pol->byidx); | 671 | hlist_del(&pol->byidx); |
672 | list_del(&pol->walk.all); | 672 | list_del(&pol->walk.all); |
673 | init_net.xfrm.policy_count[dir]--; | 673 | net->xfrm.policy_count[dir]--; |
674 | } | 674 | } |
675 | ret = pol; | 675 | ret = pol; |
676 | break; | 676 | break; |
@@ -686,8 +686,8 @@ struct xfrm_policy *xfrm_policy_bysel_ctx(u8 type, int dir, | |||
686 | } | 686 | } |
687 | EXPORT_SYMBOL(xfrm_policy_bysel_ctx); | 687 | EXPORT_SYMBOL(xfrm_policy_bysel_ctx); |
688 | 688 | ||
689 | struct xfrm_policy *xfrm_policy_byid(u8 type, int dir, u32 id, int delete, | 689 | struct xfrm_policy *xfrm_policy_byid(struct net *net, u8 type, int dir, u32 id, |
690 | int *err) | 690 | int delete, int *err) |
691 | { | 691 | { |
692 | struct xfrm_policy *pol, *ret; | 692 | struct xfrm_policy *pol, *ret; |
693 | struct hlist_head *chain; | 693 | struct hlist_head *chain; |
@@ -699,7 +699,7 @@ struct xfrm_policy *xfrm_policy_byid(u8 type, int dir, u32 id, int delete, | |||
699 | 699 | ||
700 | *err = 0; | 700 | *err = 0; |
701 | write_lock_bh(&xfrm_policy_lock); | 701 | write_lock_bh(&xfrm_policy_lock); |
702 | chain = init_net.xfrm.policy_byidx + idx_hash(&init_net, id); | 702 | chain = net->xfrm.policy_byidx + idx_hash(net, id); |
703 | ret = NULL; | 703 | ret = NULL; |
704 | hlist_for_each_entry(pol, entry, chain, byidx) { | 704 | hlist_for_each_entry(pol, entry, chain, byidx) { |
705 | if (pol->type == type && pol->index == id) { | 705 | if (pol->type == type && pol->index == id) { |
@@ -714,7 +714,7 @@ struct xfrm_policy *xfrm_policy_byid(u8 type, int dir, u32 id, int delete, | |||
714 | hlist_del(&pol->bydst); | 714 | hlist_del(&pol->bydst); |
715 | hlist_del(&pol->byidx); | 715 | hlist_del(&pol->byidx); |
716 | list_del(&pol->walk.all); | 716 | list_del(&pol->walk.all); |
717 | init_net.xfrm.policy_count[dir]--; | 717 | net->xfrm.policy_count[dir]--; |
718 | } | 718 | } |
719 | ret = pol; | 719 | ret = pol; |
720 | break; | 720 | break; |
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c index d4983e831c34..efd6ab5c0aca 100644 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c | |||
@@ -1330,7 +1330,7 @@ static int xfrm_get_policy(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
1330 | return err; | 1330 | return err; |
1331 | 1331 | ||
1332 | if (p->index) | 1332 | if (p->index) |
1333 | xp = xfrm_policy_byid(type, p->dir, p->index, delete, &err); | 1333 | xp = xfrm_policy_byid(&init_net, type, p->dir, p->index, delete, &err); |
1334 | else { | 1334 | else { |
1335 | struct nlattr *rt = attrs[XFRMA_SEC_CTX]; | 1335 | struct nlattr *rt = attrs[XFRMA_SEC_CTX]; |
1336 | struct xfrm_sec_ctx *ctx; | 1336 | struct xfrm_sec_ctx *ctx; |
@@ -1347,7 +1347,7 @@ static int xfrm_get_policy(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
1347 | if (err) | 1347 | if (err) |
1348 | return err; | 1348 | return err; |
1349 | } | 1349 | } |
1350 | xp = xfrm_policy_bysel_ctx(type, p->dir, &p->sel, ctx, | 1350 | xp = xfrm_policy_bysel_ctx(&init_net, type, p->dir, &p->sel, ctx, |
1351 | delete, &err); | 1351 | delete, &err); |
1352 | security_xfrm_policy_free(ctx); | 1352 | security_xfrm_policy_free(ctx); |
1353 | } | 1353 | } |
@@ -1571,7 +1571,7 @@ static int xfrm_add_pol_expire(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
1571 | return err; | 1571 | return err; |
1572 | 1572 | ||
1573 | if (p->index) | 1573 | if (p->index) |
1574 | xp = xfrm_policy_byid(type, p->dir, p->index, 0, &err); | 1574 | xp = xfrm_policy_byid(&init_net, type, p->dir, p->index, 0, &err); |
1575 | else { | 1575 | else { |
1576 | struct nlattr *rt = attrs[XFRMA_SEC_CTX]; | 1576 | struct nlattr *rt = attrs[XFRMA_SEC_CTX]; |
1577 | struct xfrm_sec_ctx *ctx; | 1577 | struct xfrm_sec_ctx *ctx; |
@@ -1588,7 +1588,7 @@ static int xfrm_add_pol_expire(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
1588 | if (err) | 1588 | if (err) |
1589 | return err; | 1589 | return err; |
1590 | } | 1590 | } |
1591 | xp = xfrm_policy_bysel_ctx(type, p->dir, &p->sel, ctx, 0, &err); | 1591 | xp = xfrm_policy_bysel_ctx(&init_net, type, p->dir, &p->sel, ctx, 0, &err); |
1592 | security_xfrm_policy_free(ctx); | 1592 | security_xfrm_policy_free(ctx); |
1593 | } | 1593 | } |
1594 | if (xp == NULL) | 1594 | if (xp == NULL) |