netns xfrm: KM reporting in netns
authorAlexey Dobriyan <adobriyan@gmail.com>
Wed, 26 Nov 2008 01:51:01 +0000 (17:51 -0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 26 Nov 2008 01:51:01 +0000 (17:51 -0800)
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/xfrm.h
net/ipv6/mip6.c
net/xfrm/xfrm_state.c
net/xfrm/xfrm_user.c

index 52e784fa2c50b7efec69d6ef855dac584300ca5c..f3ea1607c595456114ff7c6453a92c667d3446b4 100644 (file)
@@ -552,7 +552,7 @@ struct xfrm_mgr
        struct xfrm_policy      *(*compile_policy)(struct sock *sk, int opt, u8 *data, int len, int *dir);
        int                     (*new_mapping)(struct xfrm_state *x, xfrm_address_t *ipaddr, __be16 sport);
        int                     (*notify_policy)(struct xfrm_policy *x, int dir, struct km_event *c);
-       int                     (*report)(u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr);
+       int                     (*report)(struct net *net, u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr);
        int                     (*migrate)(struct xfrm_selector *sel, u8 dir, u8 type, struct xfrm_migrate *m, int num_bundles, struct xfrm_kmaddress *k);
 };
 
@@ -1471,7 +1471,7 @@ extern int xfrm_migrate(struct xfrm_selector *sel, u8 dir, u8 type,
 
 extern int km_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, __be16 sport);
 extern void km_policy_expired(struct xfrm_policy *pol, int dir, int hard, u32 pid);
-extern int km_report(u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr);
+extern int km_report(struct net *net, u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr);
 
 extern void xfrm_input_init(void);
 extern int xfrm_parse_spi(struct sk_buff *skb, u8 nexthdr, __be32 *spi, __be32 *seq);
index 31295c8f619688099477dd5e230c61f8199d51da..f995e19c87a96d29995d7de530e0f996160ff980 100644 (file)
@@ -205,6 +205,7 @@ static inline int mip6_report_rl_allow(struct timeval *stamp,
 
 static int mip6_destopt_reject(struct xfrm_state *x, struct sk_buff *skb, struct flowi *fl)
 {
+       struct net *net = xs_net(x);
        struct inet6_skb_parm *opt = (struct inet6_skb_parm *)skb->cb;
        struct ipv6_destopt_hao *hao = NULL;
        struct xfrm_selector sel;
@@ -247,7 +248,7 @@ static int mip6_destopt_reject(struct xfrm_state *x, struct sk_buff *skb, struct
                sel.sport_mask = htons(~0);
        sel.ifindex = fl->oif;
 
-       err = km_report(IPPROTO_DSTOPTS, &sel,
+       err = km_report(net, IPPROTO_DSTOPTS, &sel,
                        (hao ? (xfrm_address_t *)&hao->addr : NULL));
 
  out:
index 21db37ab0a2f1191cb2fa9da47b0f4786f78253d..d594b5af5f6b1bece8d1b81e79350faf372cf133 100644 (file)
@@ -1833,7 +1833,7 @@ int km_migrate(struct xfrm_selector *sel, u8 dir, u8 type,
 EXPORT_SYMBOL(km_migrate);
 #endif
 
-int km_report(u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr)
+int km_report(struct net *net, u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr)
 {
        int err = -EINVAL;
        int ret;
@@ -1842,7 +1842,7 @@ int km_report(u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr)
        read_lock(&xfrm_km_lock);
        list_for_each_entry(km, &xfrm_km_list, list) {
                if (km->report) {
-                       ret = km->report(proto, sel, addr);
+                       ret = km->report(net, proto, sel, addr);
                        if (!ret)
                                err = ret;
                }
index 3e32ec2ea1ad777e1d4bee7a42c5a3e10962e287..b7240d5b77ad0d9101b0297541b6f64248fb0471 100644 (file)
@@ -2520,10 +2520,9 @@ nla_put_failure:
        return -EMSGSIZE;
 }
 
-static int xfrm_send_report(u8 proto, struct xfrm_selector *sel,
-                           xfrm_address_t *addr)
+static int xfrm_send_report(struct net *net, u8 proto,
+                           struct xfrm_selector *sel, xfrm_address_t *addr)
 {
-       struct net *net = &init_net;
        struct sk_buff *skb;
 
        skb = nlmsg_new(xfrm_report_msgsize(), GFP_ATOMIC);