Skip to content

Commit

Permalink
ipv6: Don't add routes to ipv6 disabled interfaces.
Browse files Browse the repository at this point in the history
If the interface has IPv6 disabled, don't add a multicast or
link-local route since we won't be adding a link-local address.

Reported-by: Mahesh Kelkar <maheshkelkar@gmail.com>
Signed-off-by: Brian Haley <brian.haley@hp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Brian Haley authored and davem330 committed Jul 22, 2010
1 parent be2b6e6 commit 64e724f
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions net/ipv6/addrconf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1760,7 +1760,10 @@ static struct inet6_dev *addrconf_add_dev(struct net_device *dev)

idev = ipv6_find_idev(dev);
if (!idev)
return NULL;
return ERR_PTR(-ENOBUFS);

if (idev->cnf.disable_ipv6)
return ERR_PTR(-EACCES);

/* Add default multicast route */
addrconf_add_mroute(dev);
Expand Down Expand Up @@ -2129,8 +2132,9 @@ static int inet6_addr_add(struct net *net, int ifindex, struct in6_addr *pfx,
if (!dev)
return -ENODEV;

if ((idev = addrconf_add_dev(dev)) == NULL)
return -ENOBUFS;
idev = addrconf_add_dev(dev);
if (IS_ERR(idev))
return PTR_ERR(idev);

scope = ipv6_addr_scope(pfx);

Expand Down Expand Up @@ -2377,7 +2381,7 @@ static void addrconf_dev_config(struct net_device *dev)
}

idev = addrconf_add_dev(dev);
if (idev == NULL)
if (IS_ERR(idev))
return;

memset(&addr, 0, sizeof(struct in6_addr));
Expand Down Expand Up @@ -2468,7 +2472,7 @@ static void addrconf_ip6_tnl_config(struct net_device *dev)
ASSERT_RTNL();

idev = addrconf_add_dev(dev);
if (!idev) {
if (IS_ERR(idev)) {
printk(KERN_DEBUG "init ip6-ip6: add_dev failed\n");
return;
}
Expand Down

0 comments on commit 64e724f

Please sign in to comment.