]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
netns xfrm: pass netns with KM notifications
authorAlexey Dobriyan <adobriyan@gmail.com>
Wed, 26 Nov 2008 01:50:36 +0000 (17:50 -0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 26 Nov 2008 01:50:36 +0000 (17:50 -0800)
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>
include/net/xfrm.h
net/key/af_key.c
net/xfrm/xfrm_user.c

index e027179e8199fb09aa50d5b6678c36d85ca8deb9..52e784fa2c50b7efec69d6ef855dac584300ca5c 100644 (file)
@@ -256,6 +256,7 @@ struct km_event
        u32     seq;
        u32     pid;
        u32     event;
+       struct net *net;
 };
 
 struct net_device;
index a0d849848dddd220bb9a9b94c9866d6d3b17ccde..ea7755ab7e6a5656f68c88f15708705044fa7398 100644 (file)
@@ -1739,6 +1739,7 @@ static int pfkey_flush(struct sock *sk, struct sk_buff *skb, struct sadb_msg *hd
        c.seq = hdr->sadb_msg_seq;
        c.pid = hdr->sadb_msg_pid;
        c.event = XFRM_MSG_FLUSHSA;
+       c.net = &init_net;
        km_state_notify(NULL, &c);
 
        return 0;
@@ -2693,6 +2694,7 @@ static int pfkey_spdflush(struct sock *sk, struct sk_buff *skb, struct sadb_msg
        c.event = XFRM_MSG_FLUSHPOLICY;
        c.pid = hdr->sadb_msg_pid;
        c.seq = hdr->sadb_msg_seq;
+       c.net = &init_net;
        km_policy_notify(NULL, 0, &c);
 
        return 0;
index ab8b138e5e2f806ba6e1efc26a1a471adec88a91..3e32ec2ea1ad777e1d4bee7a42c5a3e10962e287 100644 (file)
@@ -1418,6 +1418,7 @@ static int xfrm_flush_sa(struct sk_buff *skb, struct nlmsghdr *nlh,
        c.event = nlh->nlmsg_type;
        c.seq = nlh->nlmsg_seq;
        c.pid = nlh->nlmsg_pid;
+       c.net = net;
        km_state_notify(NULL, &c);
 
        return 0;
@@ -1569,6 +1570,7 @@ static int xfrm_flush_policy(struct sk_buff *skb, struct nlmsghdr *nlh,
        c.event = nlh->nlmsg_type;
        c.seq = nlh->nlmsg_seq;
        c.pid = nlh->nlmsg_pid;
+       c.net = net;
        km_policy_notify(NULL, 0, &c);
        return 0;
 }
@@ -2084,7 +2086,7 @@ static int xfrm_aevent_state_notify(struct xfrm_state *x, struct km_event *c)
 
 static int xfrm_notify_sa_flush(struct km_event *c)
 {
-       struct net *net = &init_net;
+       struct net *net = c->net;
        struct xfrm_usersa_flush *p;
        struct nlmsghdr *nlh;
        struct sk_buff *skb;
@@ -2446,7 +2448,7 @@ nlmsg_failure:
 
 static int xfrm_notify_policy_flush(struct km_event *c)
 {
-       struct net *net = &init_net;
+       struct net *net = c->net;
        struct nlmsghdr *nlh;
        struct sk_buff *skb;