]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
netns xfrm: policy walking in netns
authorAlexey Dobriyan <adobriyan@gmail.com>
Wed, 26 Nov 2008 01:34:49 +0000 (17:34 -0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 26 Nov 2008 01:34:49 +0000 (17:34 -0800)
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/xfrm.h
net/key/af_key.c
net/xfrm/xfrm_policy.c
net/xfrm/xfrm_user.c

index ec2b7a9b3aa900136deecad1d3cd3f4ce2fc6d96..1dc4ff0f4851107be50841e6c3c5a17bf9064a12 100644 (file)
@@ -1435,7 +1435,7 @@ static inline int xfrm4_udp_encap_rcv(struct sock *sk, struct sk_buff *skb)
 struct xfrm_policy *xfrm_policy_alloc(struct net *net, gfp_t gfp);
 
 extern void xfrm_policy_walk_init(struct xfrm_policy_walk *walk, u8 type);
-extern int xfrm_policy_walk(struct xfrm_policy_walk *walk,
+extern int xfrm_policy_walk(struct net *net, struct xfrm_policy_walk *walk,
        int (*func)(struct xfrm_policy *, int, int, void*), void *);
 extern void xfrm_policy_walk_done(struct xfrm_policy_walk *walk);
 int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl);
index ca268116ac1109573de81110d4c1fb9f568f6568..a0d849848dddd220bb9a9b94c9866d6d3b17ccde 100644 (file)
@@ -1846,7 +1846,7 @@ static u32 gen_reqid(void)
                if (reqid == 0)
                        reqid = IPSEC_MANUAL_REQID_MAX+1;
                xfrm_policy_walk_init(&walk, XFRM_POLICY_TYPE_MAIN);
-               rc = xfrm_policy_walk(&walk, check_reqid, (void*)&reqid);
+               rc = xfrm_policy_walk(&init_net, &walk, check_reqid, (void*)&reqid);
                xfrm_policy_walk_done(&walk);
                if (rc != -EEXIST)
                        return reqid;
@@ -2633,7 +2633,7 @@ static int dump_sp(struct xfrm_policy *xp, int dir, int count, void *ptr)
 
 static int pfkey_dump_sp(struct pfkey_sock *pfk)
 {
-       return xfrm_policy_walk(&pfk->dump.u.policy, dump_sp, (void *) pfk);
+       return xfrm_policy_walk(&init_net, &pfk->dump.u.policy, dump_sp, (void *) pfk);
 }
 
 static void pfkey_dump_sp_done(struct pfkey_sock *pfk)
index 96895ef618582f0706e31a15e4985dfa1d948081..6165218fd7c26f390eb53eafbcf6cb04a38e475e 100644 (file)
@@ -851,7 +851,7 @@ out:
 }
 EXPORT_SYMBOL(xfrm_policy_flush);
 
-int xfrm_policy_walk(struct xfrm_policy_walk *walk,
+int xfrm_policy_walk(struct net *net, struct xfrm_policy_walk *walk,
                     int (*func)(struct xfrm_policy *, int, int, void*),
                     void *data)
 {
@@ -868,10 +868,10 @@ int xfrm_policy_walk(struct xfrm_policy_walk *walk,
 
        write_lock_bh(&xfrm_policy_lock);
        if (list_empty(&walk->walk.all))
-               x = list_first_entry(&init_net.xfrm.policy_all, struct xfrm_policy_walk_entry, all);
+               x = list_first_entry(&net->xfrm.policy_all, struct xfrm_policy_walk_entry, all);
        else
                x = list_entry(&walk->walk.all, struct xfrm_policy_walk_entry, all);
-       list_for_each_entry_from(x, &init_net.xfrm.policy_all, all) {
+       list_for_each_entry_from(x, &net->xfrm.policy_all, all) {
                if (x->dead)
                        continue;
                pol = container_of(x, struct xfrm_policy, walk);
index efd6ab5c0aca494407e836d1151255d53cbec70a..f6e02726cf1bd0a854fa7162403c396136bd4428 100644 (file)
@@ -1279,7 +1279,7 @@ static int xfrm_dump_policy(struct sk_buff *skb, struct netlink_callback *cb)
                xfrm_policy_walk_init(walk, XFRM_POLICY_TYPE_ANY);
        }
 
-       (void) xfrm_policy_walk(walk, dump_one_policy, &info);
+       (void) xfrm_policy_walk(&init_net, walk, dump_one_policy, &info);
 
        return skb->len;
 }