aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@gmail.com>2008-11-25 20:50:36 -0500
committerDavid S. Miller <davem@davemloft.net>2008-11-25 20:50:36 -0500
commit7067802e262457a9737521e5669b622028b2283a (patch)
treef6f94b1429700979cb1407fc1f96de487f6bf085
parentfc34acd36eecdec95171b98ef2516e3d4daa5c41 (diff)
netns xfrm: pass netns with KM notifications
SA and SPD flush are executed with NULL SA and SPD respectively, for these cases pass netns explicitly from userspace socket. Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/net/xfrm.h1
-rw-r--r--net/key/af_key.c2
-rw-r--r--net/xfrm/xfrm_user.c6
3 files changed, 7 insertions, 2 deletions
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index e027179e8199..52e784fa2c50 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -256,6 +256,7 @@ struct km_event
256 u32 seq; 256 u32 seq;
257 u32 pid; 257 u32 pid;
258 u32 event; 258 u32 event;
259 struct net *net;
259}; 260};
260 261
261struct net_device; 262struct net_device;
diff --git a/net/key/af_key.c b/net/key/af_key.c
index a0d849848ddd..ea7755ab7e6a 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -1739,6 +1739,7 @@ static int pfkey_flush(struct sock *sk, struct sk_buff *skb, struct sadb_msg *hd
1739 c.seq = hdr->sadb_msg_seq; 1739 c.seq = hdr->sadb_msg_seq;
1740 c.pid = hdr->sadb_msg_pid; 1740 c.pid = hdr->sadb_msg_pid;
1741 c.event = XFRM_MSG_FLUSHSA; 1741 c.event = XFRM_MSG_FLUSHSA;
1742 c.net = &init_net;
1742 km_state_notify(NULL, &c); 1743 km_state_notify(NULL, &c);
1743 1744
1744 return 0; 1745 return 0;
@@ -2693,6 +2694,7 @@ static int pfkey_spdflush(struct sock *sk, struct sk_buff *skb, struct sadb_msg
2693 c.event = XFRM_MSG_FLUSHPOLICY; 2694 c.event = XFRM_MSG_FLUSHPOLICY;
2694 c.pid = hdr->sadb_msg_pid; 2695 c.pid = hdr->sadb_msg_pid;
2695 c.seq = hdr->sadb_msg_seq; 2696 c.seq = hdr->sadb_msg_seq;
2697 c.net = &init_net;
2696 km_policy_notify(NULL, 0, &c); 2698 km_policy_notify(NULL, 0, &c);
2697 2699
2698 return 0; 2700 return 0;
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index ab8b138e5e2f..3e32ec2ea1ad 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -1418,6 +1418,7 @@ static int xfrm_flush_sa(struct sk_buff *skb, struct nlmsghdr *nlh,
1418 c.event = nlh->nlmsg_type; 1418 c.event = nlh->nlmsg_type;
1419 c.seq = nlh->nlmsg_seq; 1419 c.seq = nlh->nlmsg_seq;
1420 c.pid = nlh->nlmsg_pid; 1420 c.pid = nlh->nlmsg_pid;
1421 c.net = net;
1421 km_state_notify(NULL, &c); 1422 km_state_notify(NULL, &c);
1422 1423
1423 return 0; 1424 return 0;
@@ -1569,6 +1570,7 @@ static int xfrm_flush_policy(struct sk_buff *skb, struct nlmsghdr *nlh,
1569 c.event = nlh->nlmsg_type; 1570 c.event = nlh->nlmsg_type;
1570 c.seq = nlh->nlmsg_seq; 1571 c.seq = nlh->nlmsg_seq;
1571 c.pid = nlh->nlmsg_pid; 1572 c.pid = nlh->nlmsg_pid;
1573 c.net = net;
1572 km_policy_notify(NULL, 0, &c); 1574 km_policy_notify(NULL, 0, &c);
1573 return 0; 1575 return 0;
1574} 1576}
@@ -2084,7 +2086,7 @@ static int xfrm_aevent_state_notify(struct xfrm_state *x, struct km_event *c)
2084 2086
2085static int xfrm_notify_sa_flush(struct km_event *c) 2087static int xfrm_notify_sa_flush(struct km_event *c)
2086{ 2088{
2087 struct net *net = &init_net; 2089 struct net *net = c->net;
2088 struct xfrm_usersa_flush *p; 2090 struct xfrm_usersa_flush *p;
2089 struct nlmsghdr *nlh; 2091 struct nlmsghdr *nlh;
2090 struct sk_buff *skb; 2092 struct sk_buff *skb;
@@ -2446,7 +2448,7 @@ nlmsg_failure:
2446 2448
2447static int xfrm_notify_policy_flush(struct km_event *c) 2449static int xfrm_notify_policy_flush(struct km_event *c)
2448{ 2450{
2449 struct net *net = &init_net; 2451 struct net *net = c->net;
2450 struct nlmsghdr *nlh; 2452 struct nlmsghdr *nlh;
2451 struct sk_buff *skb; 2453 struct sk_buff *skb;
2452 2454