[NETNS]: Add netns to nl_info structure.
nl_info is used to track the end-user destination of routing change notification. This is a natural object to hold a namespace on. Place it there and utilize the context in the appropriate places. Acked-by: Benjamin Thery <benjamin.thery@bull.net> Acked-by: Daniel Lezcano <dlezcano@fr.ibm.com> Signed-off-by: Denis V. Lunev <den@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
6b175b26c1
commit
4d1169c1e7
@@ -320,11 +320,11 @@ void rtmsg_fib(int event, __be32 key, struct fib_alias *fa,
|
||||
kfree_skb(skb);
|
||||
goto errout;
|
||||
}
|
||||
err = rtnl_notify(skb, &init_net, info->pid, RTNLGRP_IPV4_ROUTE,
|
||||
err = rtnl_notify(skb, info->nl_net, info->pid, RTNLGRP_IPV4_ROUTE,
|
||||
info->nlh, GFP_KERNEL);
|
||||
errout:
|
||||
if (err < 0)
|
||||
rtnl_set_sk_err(&init_net, RTNLGRP_IPV4_ROUTE, err);
|
||||
rtnl_set_sk_err(info->nl_net, RTNLGRP_IPV4_ROUTE, err);
|
||||
}
|
||||
|
||||
/* Return the first fib alias matching TOS with
|
||||
@@ -531,9 +531,11 @@ static int fib_check_nh(struct fib_config *cfg, struct fib_info *fi,
|
||||
|
||||
if (cfg->fc_scope >= RT_SCOPE_LINK)
|
||||
return -EINVAL;
|
||||
if (inet_addr_type(&init_net, nh->nh_gw) != RTN_UNICAST)
|
||||
if (inet_addr_type(cfg->fc_nlinfo.nl_net,
|
||||
nh->nh_gw) != RTN_UNICAST)
|
||||
return -EINVAL;
|
||||
if ((dev = __dev_get_by_index(&init_net, nh->nh_oif)) == NULL)
|
||||
if ((dev = __dev_get_by_index(cfg->fc_nlinfo.nl_net,
|
||||
nh->nh_oif)) == NULL)
|
||||
return -ENODEV;
|
||||
if (!(dev->flags&IFF_UP))
|
||||
return -ENETDOWN;
|
||||
@@ -795,7 +797,8 @@ struct fib_info *fib_create_info(struct fib_config *cfg)
|
||||
if (nhs != 1 || nh->nh_gw)
|
||||
goto err_inval;
|
||||
nh->nh_scope = RT_SCOPE_NOWHERE;
|
||||
nh->nh_dev = dev_get_by_index(&init_net, fi->fib_nh->nh_oif);
|
||||
nh->nh_dev = dev_get_by_index(cfg->fc_nlinfo.nl_net,
|
||||
fi->fib_nh->nh_oif);
|
||||
err = -ENODEV;
|
||||
if (nh->nh_dev == NULL)
|
||||
goto failure;
|
||||
@@ -809,7 +812,8 @@ struct fib_info *fib_create_info(struct fib_config *cfg)
|
||||
if (fi->fib_prefsrc) {
|
||||
if (cfg->fc_type != RTN_LOCAL || !cfg->fc_dst ||
|
||||
fi->fib_prefsrc != cfg->fc_dst)
|
||||
if (inet_addr_type(&init_net, fi->fib_prefsrc) != RTN_LOCAL)
|
||||
if (inet_addr_type(cfg->fc_nlinfo.nl_net,
|
||||
fi->fib_prefsrc) != RTN_LOCAL)
|
||||
goto err_inval;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user