diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2008-11-25 20:34:49 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-11-25 20:34:49 -0500 |
commit | cdcbca7c1f1946758cfacb69bc1c7eeaccb11e2d (patch) | |
tree | 1ee0f5edf7fb9e50f7f70c680044be33d41a0d41 | |
parent | 8d1211a6aaea43ea36151c17b0193eb763ff2d7e (diff) |
netns xfrm: policy walking 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.h | 2 | ||||
-rw-r--r-- | net/key/af_key.c | 4 | ||||
-rw-r--r-- | net/xfrm/xfrm_policy.c | 6 | ||||
-rw-r--r-- | net/xfrm/xfrm_user.c | 2 |
4 files changed, 7 insertions, 7 deletions
diff --git a/include/net/xfrm.h b/include/net/xfrm.h index ec2b7a9b3aa9..1dc4ff0f4851 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h | |||
@@ -1435,7 +1435,7 @@ static inline int xfrm4_udp_encap_rcv(struct sock *sk, struct sk_buff *skb) | |||
1435 | struct xfrm_policy *xfrm_policy_alloc(struct net *net, gfp_t gfp); | 1435 | struct xfrm_policy *xfrm_policy_alloc(struct net *net, gfp_t gfp); |
1436 | 1436 | ||
1437 | extern void xfrm_policy_walk_init(struct xfrm_policy_walk *walk, u8 type); | 1437 | extern void xfrm_policy_walk_init(struct xfrm_policy_walk *walk, u8 type); |
1438 | extern int xfrm_policy_walk(struct xfrm_policy_walk *walk, | 1438 | extern int xfrm_policy_walk(struct net *net, struct xfrm_policy_walk *walk, |
1439 | int (*func)(struct xfrm_policy *, int, int, void*), void *); | 1439 | int (*func)(struct xfrm_policy *, int, int, void*), void *); |
1440 | extern void xfrm_policy_walk_done(struct xfrm_policy_walk *walk); | 1440 | extern void xfrm_policy_walk_done(struct xfrm_policy_walk *walk); |
1441 | int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl); | 1441 | int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl); |
diff --git a/net/key/af_key.c b/net/key/af_key.c index ca268116ac11..a0d849848ddd 100644 --- a/net/key/af_key.c +++ b/net/key/af_key.c | |||
@@ -1846,7 +1846,7 @@ static u32 gen_reqid(void) | |||
1846 | if (reqid == 0) | 1846 | if (reqid == 0) |
1847 | reqid = IPSEC_MANUAL_REQID_MAX+1; | 1847 | reqid = IPSEC_MANUAL_REQID_MAX+1; |
1848 | xfrm_policy_walk_init(&walk, XFRM_POLICY_TYPE_MAIN); | 1848 | xfrm_policy_walk_init(&walk, XFRM_POLICY_TYPE_MAIN); |
1849 | rc = xfrm_policy_walk(&walk, check_reqid, (void*)&reqid); | 1849 | rc = xfrm_policy_walk(&init_net, &walk, check_reqid, (void*)&reqid); |
1850 | xfrm_policy_walk_done(&walk); | 1850 | xfrm_policy_walk_done(&walk); |
1851 | if (rc != -EEXIST) | 1851 | if (rc != -EEXIST) |
1852 | return reqid; | 1852 | return reqid; |
@@ -2633,7 +2633,7 @@ static int dump_sp(struct xfrm_policy *xp, int dir, int count, void *ptr) | |||
2633 | 2633 | ||
2634 | static int pfkey_dump_sp(struct pfkey_sock *pfk) | 2634 | static int pfkey_dump_sp(struct pfkey_sock *pfk) |
2635 | { | 2635 | { |
2636 | return xfrm_policy_walk(&pfk->dump.u.policy, dump_sp, (void *) pfk); | 2636 | return xfrm_policy_walk(&init_net, &pfk->dump.u.policy, dump_sp, (void *) pfk); |
2637 | } | 2637 | } |
2638 | 2638 | ||
2639 | static void pfkey_dump_sp_done(struct pfkey_sock *pfk) | 2639 | static void pfkey_dump_sp_done(struct pfkey_sock *pfk) |
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index 96895ef61858..6165218fd7c2 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
@@ -851,7 +851,7 @@ out: | |||
851 | } | 851 | } |
852 | EXPORT_SYMBOL(xfrm_policy_flush); | 852 | EXPORT_SYMBOL(xfrm_policy_flush); |
853 | 853 | ||
854 | int xfrm_policy_walk(struct xfrm_policy_walk *walk, | 854 | int xfrm_policy_walk(struct net *net, struct xfrm_policy_walk *walk, |
855 | int (*func)(struct xfrm_policy *, int, int, void*), | 855 | int (*func)(struct xfrm_policy *, int, int, void*), |
856 | void *data) | 856 | void *data) |
857 | { | 857 | { |
@@ -868,10 +868,10 @@ int xfrm_policy_walk(struct xfrm_policy_walk *walk, | |||
868 | 868 | ||
869 | write_lock_bh(&xfrm_policy_lock); | 869 | write_lock_bh(&xfrm_policy_lock); |
870 | if (list_empty(&walk->walk.all)) | 870 | if (list_empty(&walk->walk.all)) |
871 | x = list_first_entry(&init_net.xfrm.policy_all, struct xfrm_policy_walk_entry, all); | 871 | x = list_first_entry(&net->xfrm.policy_all, struct xfrm_policy_walk_entry, all); |
872 | else | 872 | else |
873 | x = list_entry(&walk->walk.all, struct xfrm_policy_walk_entry, all); | 873 | x = list_entry(&walk->walk.all, struct xfrm_policy_walk_entry, all); |
874 | list_for_each_entry_from(x, &init_net.xfrm.policy_all, all) { | 874 | list_for_each_entry_from(x, &net->xfrm.policy_all, all) { |
875 | if (x->dead) | 875 | if (x->dead) |
876 | continue; | 876 | continue; |
877 | pol = container_of(x, struct xfrm_policy, walk); | 877 | pol = container_of(x, struct xfrm_policy, walk); |
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c index efd6ab5c0aca..f6e02726cf1b 100644 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c | |||
@@ -1279,7 +1279,7 @@ static int xfrm_dump_policy(struct sk_buff *skb, struct netlink_callback *cb) | |||
1279 | xfrm_policy_walk_init(walk, XFRM_POLICY_TYPE_ANY); | 1279 | xfrm_policy_walk_init(walk, XFRM_POLICY_TYPE_ANY); |
1280 | } | 1280 | } |
1281 | 1281 | ||
1282 | (void) xfrm_policy_walk(walk, dump_one_policy, &info); | 1282 | (void) xfrm_policy_walk(&init_net, walk, dump_one_policy, &info); |
1283 | 1283 | ||
1284 | return skb->len; | 1284 | return skb->len; |
1285 | } | 1285 | } |