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/xfrm_policy.c | |
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/xfrm_policy.c')
-rw-r--r-- | net/xfrm/xfrm_policy.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index 7c264a74edc..96895ef6185 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; |