aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@gmail.com>2008-11-25 20:57:44 -0500
committerDavid S. Miller <davem@davemloft.net>2008-11-25 20:57:44 -0500
commit7c2776ee21a60e0d370538bd08b9ed82979f6e3a (patch)
treec8b9757f6989216c00b5ca9e09ee074662fff586
parentfbda33b2b85941c1ae3a0d89522dec5c1b1bd98c (diff)
netns xfrm: flush SA/SPDs on netns stop
SA/SPD doesn't pin netns (and it shouldn't), so get rid of them by hand. Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/xfrm/xfrm_policy.c14
-rw-r--r--net/xfrm/xfrm_state.c8
2 files changed, 22 insertions, 0 deletions
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 7c7bb54f2265..fcf8c928285a 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -2441,9 +2441,23 @@ out_byidx:
2441 2441
2442static void xfrm_policy_fini(struct net *net) 2442static void xfrm_policy_fini(struct net *net)
2443{ 2443{
2444 struct xfrm_audit audit_info;
2444 unsigned int sz; 2445 unsigned int sz;
2445 int dir; 2446 int dir;
2446 2447
2448 flush_work(&net->xfrm.policy_hash_work);
2449#ifdef CONFIG_XFRM_SUB_POLICY
2450 audit_info.loginuid = -1;
2451 audit_info.sessionid = -1;
2452 audit_info.secid = 0;
2453 xfrm_policy_flush(net, XFRM_POLICY_TYPE_SUB, &audit_info);
2454#endif
2455 audit_info.loginuid = -1;
2456 audit_info.sessionid = -1;
2457 audit_info.secid = 0;
2458 xfrm_policy_flush(net, XFRM_POLICY_TYPE_MAIN, &audit_info);
2459 flush_work(&xfrm_policy_gc_work);
2460
2447 WARN_ON(!list_empty(&net->xfrm.policy_all)); 2461 WARN_ON(!list_empty(&net->xfrm.policy_all));
2448 2462
2449 for (dir = 0; dir < XFRM_POLICY_MAX * 2; dir++) { 2463 for (dir = 0; dir < XFRM_POLICY_MAX * 2; dir++) {
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index d594b5af5f6b..662e47b0bcc3 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -2114,8 +2114,16 @@ out_bydst:
2114 2114
2115void xfrm_state_fini(struct net *net) 2115void xfrm_state_fini(struct net *net)
2116{ 2116{
2117 struct xfrm_audit audit_info;
2117 unsigned int sz; 2118 unsigned int sz;
2118 2119
2120 flush_work(&net->xfrm.state_hash_work);
2121 audit_info.loginuid = -1;
2122 audit_info.sessionid = -1;
2123 audit_info.secid = 0;
2124 xfrm_state_flush(net, IPSEC_PROTO_ANY, &audit_info);
2125 flush_work(&net->xfrm.state_gc_work);
2126
2119 WARN_ON(!list_empty(&net->xfrm.state_all)); 2127 WARN_ON(!list_empty(&net->xfrm.state_all));
2120 2128
2121 sz = (net->xfrm.state_hmask + 1) * sizeof(struct hlist_head); 2129 sz = (net->xfrm.state_hmask + 1) * sizeof(struct hlist_head);