From patchwork Tue Jul 20 20:34:30 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Haley X-Patchwork-Id: 59369 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id EA7401007D7 for ; Wed, 21 Jul 2010 06:34:46 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757423Ab0GTUee (ORCPT ); Tue, 20 Jul 2010 16:34:34 -0400 Received: from g1t0028.austin.hp.com ([15.216.28.35]:9292 "EHLO g1t0028.austin.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755406Ab0GTUed (ORCPT ); Tue, 20 Jul 2010 16:34:33 -0400 Received: from g1t0038.austin.hp.com (g1t0038.austin.hp.com [16.236.32.44]) by g1t0028.austin.hp.com (Postfix) with ESMTP id 891921C630; Tue, 20 Jul 2010 20:34:32 +0000 (UTC) Received: from [16.1.1.102] (squirrel.fc.hp.com [15.11.146.57]) by g1t0038.austin.hp.com (Postfix) with ESMTP id 0F31B30044; Tue, 20 Jul 2010 20:34:31 +0000 (UTC) Message-ID: <4C460856.5090701@hp.com> Date: Tue, 20 Jul 2010 16:34:30 -0400 From: Brian Haley Organization: Open Source and Linux Organization User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.10) Gecko/20100527 Lightning/1.0b1 Thunderbird/3.0.5 MIME-Version: 1.0 To: Mahesh Kelkar CC: "netdev@vger.kernel.org" Subject: Re: With disable_ipv6 set to 1 on an interface, ff00:/8 and fe80::/64 are still added on device UP References: In-Reply-To: Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Hi Mahesh, Cc-ing netdev... On 07/20/2010 12:07 PM, Mahesh Kelkar wrote: > Brian, > > I came across a patch that you submitted in 2009 (2009-05-29 20:48:49): > IPv6: Add 'autoconf' and 'disable_ipv6' module parameters > > Question: > With disable_ipv6 set to 1 on the interface, when device/interface > reaches UP state, the link local address is not added, but ipv6 routes > i.e. ff00::/8 & fe80::/64 routes are still added to the route table: > In net/ipv6/addrconf.c > addrconf_notify => addrconf_dev_config => addrconf_add_dev => > addrconf_add_mroute & addrconf_add_lroute > The link local address is not assigned because of the check > (idev->cnf.disable_ipv6) added in ipv6_add_addr. > > - Is there any particular reason for doing this? (i.e. not assigning > the link local address to interface, but adding link local & mcast > routes) > - when disable_ipv6 is set to 1, is there any reason not to skip the > NETDEV_UP processing in the addrconf_notify in addrconf.c I believe the easiest way to fix this is the following patch, can you please test it? Thanks, -Brian --- 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 Signed-off-by: Brian Haley --- -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index e81155d..ab70a3f 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c @@ -1763,7 +1763,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); @@ -2132,8 +2135,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); @@ -2380,7 +2384,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)); @@ -2471,7 +2475,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; }