[NET]: Modify all rtnetlink methods to only work in the initial namespace (v2)
Before I can enable rtnetlink to work in all network namespaces I need to be certain that something won't break. So this patch deliberately disables all of the rtnletlink methods in everything except the initial network namespace. After the methods have been audited this extra check can be disabled. Changes from v1: - added IPv6 addrlabel protection Signed-off-by: Denis V. Lunev <den@openvz.org> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
committed by
David S. Miller
parent
ad5d20a639
commit
b854272b3c
@@ -2003,9 +2003,13 @@ errout:
|
||||
|
||||
static int inet6_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
|
||||
{
|
||||
struct net *net = skb->sk->sk_net;
|
||||
struct fib6_config cfg;
|
||||
int err;
|
||||
|
||||
if (net != &init_net)
|
||||
return -EINVAL;
|
||||
|
||||
err = rtm_to_fib6_config(skb, nlh, &cfg);
|
||||
if (err < 0)
|
||||
return err;
|
||||
@@ -2015,9 +2019,13 @@ static int inet6_rtm_delroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *a
|
||||
|
||||
static int inet6_rtm_newroute(struct sk_buff *skb, struct nlmsghdr* nlh, void *arg)
|
||||
{
|
||||
struct net *net = skb->sk->sk_net;
|
||||
struct fib6_config cfg;
|
||||
int err;
|
||||
|
||||
if (net != &init_net)
|
||||
return -EINVAL;
|
||||
|
||||
err = rtm_to_fib6_config(skb, nlh, &cfg);
|
||||
if (err < 0)
|
||||
return err;
|
||||
@@ -2152,6 +2160,7 @@ int rt6_dump_route(struct rt6_info *rt, void *p_arg)
|
||||
|
||||
static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void *arg)
|
||||
{
|
||||
struct net *net = in_skb->sk->sk_net;
|
||||
struct nlattr *tb[RTA_MAX+1];
|
||||
struct rt6_info *rt;
|
||||
struct sk_buff *skb;
|
||||
@@ -2159,6 +2168,9 @@ static int inet6_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void
|
||||
struct flowi fl;
|
||||
int err, iif = 0;
|
||||
|
||||
if (net != &init_net)
|
||||
return -EINVAL;
|
||||
|
||||
err = nlmsg_parse(nlh, sizeof(*rtm), tb, RTA_MAX, rtm_ipv6_policy);
|
||||
if (err < 0)
|
||||
goto errout;
|
||||
|
Reference in New Issue
Block a user