aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@gmail.com>2008-11-25 20:32:14 -0500
committerDavid S. Miller <davem@davemloft.net>2008-11-25 20:32:14 -0500
commit284fa7da300adcb700b44df2f64a536b434d4650 (patch)
tree382f31cff91d68085b03bd4df639fd7ad3c78051
parent5447c5e401c49aba0c36bb1066f2d25b152553b7 (diff)
netns xfrm: state 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.h2
-rw-r--r--net/key/af_key.c2
-rw-r--r--net/xfrm/xfrm_state.c6
-rw-r--r--net/xfrm/xfrm_user.c2
4 files changed, 6 insertions, 6 deletions
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 4cbd0557c698..40ed4878bc12 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -1307,7 +1307,7 @@ extern int xfrm_proc_init(void);
1307#endif 1307#endif
1308 1308
1309extern void xfrm_state_walk_init(struct xfrm_state_walk *walk, u8 proto); 1309extern void xfrm_state_walk_init(struct xfrm_state_walk *walk, u8 proto);
1310extern int xfrm_state_walk(struct xfrm_state_walk *walk, 1310extern int xfrm_state_walk(struct net *net, struct xfrm_state_walk *walk,
1311 int (*func)(struct xfrm_state *, int, void*), void *); 1311 int (*func)(struct xfrm_state *, int, void*), void *);
1312extern void xfrm_state_walk_done(struct xfrm_state_walk *walk); 1312extern void xfrm_state_walk_done(struct xfrm_state_walk *walk);
1313extern struct xfrm_state *xfrm_state_alloc(struct net *net); 1313extern struct xfrm_state *xfrm_state_alloc(struct net *net);
diff --git a/net/key/af_key.c b/net/key/af_key.c
index 4ef0827009e9..b74d939e2eed 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -1776,7 +1776,7 @@ static int dump_sa(struct xfrm_state *x, int count, void *ptr)
1776 1776
1777static int pfkey_dump_sa(struct pfkey_sock *pfk) 1777static int pfkey_dump_sa(struct pfkey_sock *pfk)
1778{ 1778{
1779 return xfrm_state_walk(&pfk->dump.u.state, dump_sa, (void *) pfk); 1779 return xfrm_state_walk(&init_net, &pfk->dump.u.state, dump_sa, (void *) pfk);
1780} 1780}
1781 1781
1782static void pfkey_dump_sa_done(struct pfkey_sock *pfk) 1782static void pfkey_dump_sa_done(struct pfkey_sock *pfk)
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index 0d974fc9dd6c..ea340bbbcc64 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -1544,7 +1544,7 @@ unlock:
1544} 1544}
1545EXPORT_SYMBOL(xfrm_alloc_spi); 1545EXPORT_SYMBOL(xfrm_alloc_spi);
1546 1546
1547int xfrm_state_walk(struct xfrm_state_walk *walk, 1547int xfrm_state_walk(struct net *net, struct xfrm_state_walk *walk,
1548 int (*func)(struct xfrm_state *, int, void*), 1548 int (*func)(struct xfrm_state *, int, void*),
1549 void *data) 1549 void *data)
1550{ 1550{
@@ -1557,10 +1557,10 @@ int xfrm_state_walk(struct xfrm_state_walk *walk,
1557 1557
1558 spin_lock_bh(&xfrm_state_lock); 1558 spin_lock_bh(&xfrm_state_lock);
1559 if (list_empty(&walk->all)) 1559 if (list_empty(&walk->all))
1560 x = list_first_entry(&init_net.xfrm.state_all, struct xfrm_state_walk, all); 1560 x = list_first_entry(&net->xfrm.state_all, struct xfrm_state_walk, all);
1561 else 1561 else
1562 x = list_entry(&walk->all, struct xfrm_state_walk, all); 1562 x = list_entry(&walk->all, struct xfrm_state_walk, all);
1563 list_for_each_entry_from(x, &init_net.xfrm.state_all, all) { 1563 list_for_each_entry_from(x, &net->xfrm.state_all, all) {
1564 if (x->state == XFRM_STATE_DEAD) 1564 if (x->state == XFRM_STATE_DEAD)
1565 continue; 1565 continue;
1566 state = container_of(x, struct xfrm_state, km); 1566 state = container_of(x, struct xfrm_state, km);
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index 3d577440b673..787b0ee65034 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -631,7 +631,7 @@ static int xfrm_dump_sa(struct sk_buff *skb, struct netlink_callback *cb)
631 xfrm_state_walk_init(walk, 0); 631 xfrm_state_walk_init(walk, 0);
632 } 632 }
633 633
634 (void) xfrm_state_walk(walk, dump_one_state, &info); 634 (void) xfrm_state_walk(&init_net, walk, dump_one_state, &info);
635 635
636 return skb->len; 636 return skb->len;
637} 637}