提交 db983c11 编写于 作者: A Alexey Dobriyan 提交者: David S. Miller

netns xfrm: KM reporting in netns

Signed-off-by: NAlexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 7067802e
...@@ -552,7 +552,7 @@ struct xfrm_mgr ...@@ -552,7 +552,7 @@ struct xfrm_mgr
struct xfrm_policy *(*compile_policy)(struct sock *sk, int opt, u8 *data, int len, int *dir); 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 (*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 (*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); 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, ...@@ -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 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 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 void xfrm_input_init(void);
extern int xfrm_parse_spi(struct sk_buff *skb, u8 nexthdr, __be32 *spi, __be32 *seq); extern int xfrm_parse_spi(struct sk_buff *skb, u8 nexthdr, __be32 *spi, __be32 *seq);
......
...@@ -205,6 +205,7 @@ static inline int mip6_report_rl_allow(struct timeval *stamp, ...@@ -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) 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 inet6_skb_parm *opt = (struct inet6_skb_parm *)skb->cb;
struct ipv6_destopt_hao *hao = NULL; struct ipv6_destopt_hao *hao = NULL;
struct xfrm_selector sel; struct xfrm_selector sel;
...@@ -247,7 +248,7 @@ static int mip6_destopt_reject(struct xfrm_state *x, struct sk_buff *skb, struct ...@@ -247,7 +248,7 @@ static int mip6_destopt_reject(struct xfrm_state *x, struct sk_buff *skb, struct
sel.sport_mask = htons(~0); sel.sport_mask = htons(~0);
sel.ifindex = fl->oif; sel.ifindex = fl->oif;
err = km_report(IPPROTO_DSTOPTS, &sel, err = km_report(net, IPPROTO_DSTOPTS, &sel,
(hao ? (xfrm_address_t *)&hao->addr : NULL)); (hao ? (xfrm_address_t *)&hao->addr : NULL));
out: out:
......
...@@ -1833,7 +1833,7 @@ int km_migrate(struct xfrm_selector *sel, u8 dir, u8 type, ...@@ -1833,7 +1833,7 @@ int km_migrate(struct xfrm_selector *sel, u8 dir, u8 type,
EXPORT_SYMBOL(km_migrate); EXPORT_SYMBOL(km_migrate);
#endif #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 err = -EINVAL;
int ret; int ret;
...@@ -1842,7 +1842,7 @@ int km_report(u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr) ...@@ -1842,7 +1842,7 @@ int km_report(u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr)
read_lock(&xfrm_km_lock); read_lock(&xfrm_km_lock);
list_for_each_entry(km, &xfrm_km_list, list) { list_for_each_entry(km, &xfrm_km_list, list) {
if (km->report) { if (km->report) {
ret = km->report(proto, sel, addr); ret = km->report(net, proto, sel, addr);
if (!ret) if (!ret)
err = ret; err = ret;
} }
......
...@@ -2520,10 +2520,9 @@ static int build_report(struct sk_buff *skb, u8 proto, ...@@ -2520,10 +2520,9 @@ static int build_report(struct sk_buff *skb, u8 proto,
return -EMSGSIZE; return -EMSGSIZE;
} }
static int xfrm_send_report(u8 proto, struct xfrm_selector *sel, static int xfrm_send_report(struct net *net, u8 proto,
xfrm_address_t *addr) struct xfrm_selector *sel, xfrm_address_t *addr)
{ {
struct net *net = &init_net;
struct sk_buff *skb; struct sk_buff *skb;
skb = nlmsg_new(xfrm_report_msgsize(), GFP_ATOMIC); skb = nlmsg_new(xfrm_report_msgsize(), GFP_ATOMIC);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册