diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2008-11-25 20:36:51 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-11-25 20:36:51 -0500 |
commit | 3dd0b4997a1d4f3a3666e400cc75b0279ce96849 (patch) | |
tree | a4164c760e4ec1377da9d5f826ae4fe747caafe0 /net | |
parent | 99a66657b2f62ae8b2b1e6ffc6abed051e4561ca (diff) |
netns xfrm: flushing/pruning bundles in netns
Allow netdevice notifier as result.
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/xfrm/xfrm_policy.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index 54b50a20804f..49e089826f45 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
@@ -2137,7 +2137,7 @@ static void prune_one_bundle(struct xfrm_policy *pol, int (*func)(struct dst_ent | |||
2137 | write_unlock(&pol->lock); | 2137 | write_unlock(&pol->lock); |
2138 | } | 2138 | } |
2139 | 2139 | ||
2140 | static void xfrm_prune_bundles(int (*func)(struct dst_entry *)) | 2140 | static void xfrm_prune_bundles(struct net *net, int (*func)(struct dst_entry *)) |
2141 | { | 2141 | { |
2142 | struct dst_entry *gc_list = NULL; | 2142 | struct dst_entry *gc_list = NULL; |
2143 | int dir; | 2143 | int dir; |
@@ -2150,11 +2150,11 @@ static void xfrm_prune_bundles(int (*func)(struct dst_entry *)) | |||
2150 | int i; | 2150 | int i; |
2151 | 2151 | ||
2152 | hlist_for_each_entry(pol, entry, | 2152 | hlist_for_each_entry(pol, entry, |
2153 | &init_net.xfrm.policy_inexact[dir], bydst) | 2153 | &net->xfrm.policy_inexact[dir], bydst) |
2154 | prune_one_bundle(pol, func, &gc_list); | 2154 | prune_one_bundle(pol, func, &gc_list); |
2155 | 2155 | ||
2156 | table = init_net.xfrm.policy_bydst[dir].table; | 2156 | table = net->xfrm.policy_bydst[dir].table; |
2157 | for (i = init_net.xfrm.policy_bydst[dir].hmask; i >= 0; i--) { | 2157 | for (i = net->xfrm.policy_bydst[dir].hmask; i >= 0; i--) { |
2158 | hlist_for_each_entry(pol, entry, table + i, bydst) | 2158 | hlist_for_each_entry(pol, entry, table + i, bydst) |
2159 | prune_one_bundle(pol, func, &gc_list); | 2159 | prune_one_bundle(pol, func, &gc_list); |
2160 | } | 2160 | } |
@@ -2175,12 +2175,12 @@ static int unused_bundle(struct dst_entry *dst) | |||
2175 | 2175 | ||
2176 | static void __xfrm_garbage_collect(void) | 2176 | static void __xfrm_garbage_collect(void) |
2177 | { | 2177 | { |
2178 | xfrm_prune_bundles(unused_bundle); | 2178 | xfrm_prune_bundles(&init_net, unused_bundle); |
2179 | } | 2179 | } |
2180 | 2180 | ||
2181 | static int xfrm_flush_bundles(void) | 2181 | static int xfrm_flush_bundles(struct net *net) |
2182 | { | 2182 | { |
2183 | xfrm_prune_bundles(stale_bundle); | 2183 | xfrm_prune_bundles(net, stale_bundle); |
2184 | return 0; | 2184 | return 0; |
2185 | } | 2185 | } |
2186 | 2186 | ||
@@ -2366,12 +2366,9 @@ static int xfrm_dev_event(struct notifier_block *this, unsigned long event, void | |||
2366 | { | 2366 | { |
2367 | struct net_device *dev = ptr; | 2367 | struct net_device *dev = ptr; |
2368 | 2368 | ||
2369 | if (!net_eq(dev_net(dev), &init_net)) | ||
2370 | return NOTIFY_DONE; | ||
2371 | |||
2372 | switch (event) { | 2369 | switch (event) { |
2373 | case NETDEV_DOWN: | 2370 | case NETDEV_DOWN: |
2374 | xfrm_flush_bundles(); | 2371 | xfrm_flush_bundles(dev_net(dev)); |
2375 | } | 2372 | } |
2376 | return NOTIFY_DONE; | 2373 | return NOTIFY_DONE; |
2377 | } | 2374 | } |