mirror of
https://github.com/FEX-Emu/linux.git
synced 2025-01-26 04:35:01 +00:00
[IPV6]: Always pass a valid nl_info to inet6_rt_notify.
This makes the code in the inet6_rt_notify more straightforward and provides groud for namespace passing. Signed-off-by: Denis V. Lunev <den@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
aef2178599
commit
528c4ceb42
@ -1315,6 +1315,7 @@ static int fib6_walk(struct fib6_walker_t *w)
|
|||||||
|
|
||||||
static int fib6_clean_node(struct fib6_walker_t *w)
|
static int fib6_clean_node(struct fib6_walker_t *w)
|
||||||
{
|
{
|
||||||
|
struct nl_info info = {};
|
||||||
int res;
|
int res;
|
||||||
struct rt6_info *rt;
|
struct rt6_info *rt;
|
||||||
struct fib6_cleaner_t *c = container_of(w, struct fib6_cleaner_t, w);
|
struct fib6_cleaner_t *c = container_of(w, struct fib6_cleaner_t, w);
|
||||||
@ -1323,7 +1324,7 @@ static int fib6_clean_node(struct fib6_walker_t *w)
|
|||||||
res = c->func(rt, c->arg);
|
res = c->func(rt, c->arg);
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
w->leaf = rt;
|
w->leaf = rt;
|
||||||
res = fib6_del(rt, NULL);
|
res = fib6_del(rt, &info);
|
||||||
if (res) {
|
if (res) {
|
||||||
#if RT6_DEBUG >= 2
|
#if RT6_DEBUG >= 2
|
||||||
printk(KERN_DEBUG "fib6_clean_node: del failed: rt=%p@%p err=%d\n", rt, rt->rt6i_node, res);
|
printk(KERN_DEBUG "fib6_clean_node: del failed: rt=%p@%p err=%d\n", rt, rt->rt6i_node, res);
|
||||||
|
@ -609,7 +609,8 @@ static int __ip6_ins_rt(struct rt6_info *rt, struct nl_info *info)
|
|||||||
|
|
||||||
int ip6_ins_rt(struct rt6_info *rt)
|
int ip6_ins_rt(struct rt6_info *rt)
|
||||||
{
|
{
|
||||||
return __ip6_ins_rt(rt, NULL);
|
struct nl_info info = {};
|
||||||
|
return __ip6_ins_rt(rt, &info);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct rt6_info *rt6_alloc_cow(struct rt6_info *ort, struct in6_addr *daddr,
|
static struct rt6_info *rt6_alloc_cow(struct rt6_info *ort, struct in6_addr *daddr,
|
||||||
@ -1266,7 +1267,8 @@ static int __ip6_del_rt(struct rt6_info *rt, struct nl_info *info)
|
|||||||
|
|
||||||
int ip6_del_rt(struct rt6_info *rt)
|
int ip6_del_rt(struct rt6_info *rt)
|
||||||
{
|
{
|
||||||
return __ip6_del_rt(rt, NULL);
|
struct nl_info info = {};
|
||||||
|
return __ip6_del_rt(rt, &info);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ip6_route_del(struct fib6_config *cfg)
|
static int ip6_route_del(struct fib6_config *cfg)
|
||||||
@ -2243,29 +2245,26 @@ errout:
|
|||||||
void inet6_rt_notify(int event, struct rt6_info *rt, struct nl_info *info)
|
void inet6_rt_notify(int event, struct rt6_info *rt, struct nl_info *info)
|
||||||
{
|
{
|
||||||
struct sk_buff *skb;
|
struct sk_buff *skb;
|
||||||
u32 pid = 0, seq = 0;
|
u32 seq;
|
||||||
struct nlmsghdr *nlh = NULL;
|
int err;
|
||||||
int err = -ENOBUFS;
|
|
||||||
|
|
||||||
if (info) {
|
err = -ENOBUFS;
|
||||||
pid = info->pid;
|
seq = info->nlh != NULL ? info->nlh->nlmsg_seq : 0;
|
||||||
nlh = info->nlh;
|
|
||||||
if (nlh)
|
|
||||||
seq = nlh->nlmsg_seq;
|
|
||||||
}
|
|
||||||
|
|
||||||
skb = nlmsg_new(rt6_nlmsg_size(), gfp_any());
|
skb = nlmsg_new(rt6_nlmsg_size(), gfp_any());
|
||||||
if (skb == NULL)
|
if (skb == NULL)
|
||||||
goto errout;
|
goto errout;
|
||||||
|
|
||||||
err = rt6_fill_node(skb, rt, NULL, NULL, 0, event, pid, seq, 0, 0);
|
err = rt6_fill_node(skb, rt, NULL, NULL, 0,
|
||||||
|
event, info->pid, seq, 0, 0);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
/* -EMSGSIZE implies BUG in rt6_nlmsg_size() */
|
/* -EMSGSIZE implies BUG in rt6_nlmsg_size() */
|
||||||
WARN_ON(err == -EMSGSIZE);
|
WARN_ON(err == -EMSGSIZE);
|
||||||
kfree_skb(skb);
|
kfree_skb(skb);
|
||||||
goto errout;
|
goto errout;
|
||||||
}
|
}
|
||||||
err = rtnl_notify(skb, &init_net, pid, RTNLGRP_IPV6_ROUTE, nlh, gfp_any());
|
err = rtnl_notify(skb, &init_net, info->pid,
|
||||||
|
RTNLGRP_IPV6_ROUTE, info->nlh, gfp_any());
|
||||||
errout:
|
errout:
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
rtnl_set_sk_err(&init_net, RTNLGRP_IPV6_ROUTE, err);
|
rtnl_set_sk_err(&init_net, RTNLGRP_IPV6_ROUTE, err);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user