[Jaunty] [PATCH 1/2] SRU: Fix administratively turn off ipv6

Leann Ogasawara leann.ogasawara at canonical.com
Thu Aug 6 11:13:24 UTC 2009


>From 1e3d5bdccd0801b725fd356fc53f7c6276e2b213 Mon Sep 17 00:00:00 2001
From: Leann Ogasawara <leann.ogasawara at canonical.com>
Date: Thu, 6 Aug 2009 11:36:37 +0100
Subject: [PATCH 1/2] Revert "ipv6: Fix incorrect disable_ipv6 behavior"

This reverts commit 261ff3e2a752d546a3cb38e632770315f2c7aedd.

Using upstream commit fe7ca2e1e847b65c12d245cbf402af89da96888a is
preferable.

Signed-off-by: Leann Ogasawara <leann.ogasawara at canonical.com>
---
 Documentation/networking/ip-sysctl.txt |    4 +---
 net/ipv6/addrconf.c                    |   21 +++++++--------------
 2 files changed, 8 insertions(+), 17 deletions(-)

diff --git a/Documentation/networking/ip-sysctl.txt b/Documentation/networking/ip-sysctl.txt
index 72ca722..d849326 100644
--- a/Documentation/networking/ip-sysctl.txt
+++ b/Documentation/networking/ip-sysctl.txt
@@ -1025,9 +1025,7 @@ max_addresses - INTEGER
 	Default: 16
 
 disable_ipv6 - BOOLEAN
-	Disable IPv6 operation.  If accept_dad is set to 2, this value
-	will be dynamically set to TRUE if DAD fails for the link-local
-	address.
+	Disable IPv6 operation.
 	Default: FALSE (enable IPv6 operation)
 
 accept_dad - INTEGER
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 9313745..d9da5eb 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -587,7 +587,6 @@ ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr, int pfxlen,
 {
 	struct inet6_ifaddr *ifa = NULL;
 	struct rt6_info *rt;
-	struct net *net = dev_net(idev->dev);
 	int hash;
 	int err = 0;
 	int addr_type = ipv6_addr_type(addr);
@@ -604,11 +603,6 @@ ipv6_add_addr(struct inet6_dev *idev, const struct in6_addr *addr, int pfxlen,
 		goto out2;
 	}
 
-	if (idev->cnf.disable_ipv6 || net->ipv6.devconf_all->disable_ipv6) {
-		err = -EACCES;
-		goto out2;
-	}
-
 	write_lock(&addrconf_hash_lock);
 
 	/* Ignore adding duplicate addresses on an interface */
@@ -1436,11 +1430,6 @@ static void addrconf_dad_stop(struct inet6_ifaddr *ifp)
 void addrconf_dad_failure(struct inet6_ifaddr *ifp)
 {
 	struct inet6_dev *idev = ifp->idev;
-
-	if (net_ratelimit())
-		printk(KERN_INFO "%s: IPv6 duplicate address detected!\n",
-			ifp->idev->dev->name);
-
 	if (idev->cnf.accept_dad > 1 && !idev->cnf.disable_ipv6) {
 		struct in6_addr addr;
 
@@ -1451,12 +1440,11 @@ void addrconf_dad_failure(struct inet6_ifaddr *ifp)
 		    ipv6_addr_equal(&ifp->addr, &addr)) {
 			/* DAD failed for link-local based on MAC address */
 			idev->cnf.disable_ipv6 = 1;
-
-			printk(KERN_INFO "%s: IPv6 being disabled!\n",
-				ifp->idev->dev->name);
 		}
 	}
 
+	if (net_ratelimit())
+		printk(KERN_INFO "%s: duplicate address detected!\n", ifp->idev->dev->name);
 	addrconf_dad_stop(ifp);
 }
 
@@ -2839,6 +2827,11 @@ static void addrconf_dad_timer(unsigned long data)
 		read_unlock_bh(&idev->lock);
 		goto out;
 	}
+	if (idev->cnf.accept_dad > 1 && idev->cnf.disable_ipv6) {
+		read_unlock_bh(&idev->lock);
+		addrconf_dad_failure(ifp);
+		return;
+	}
 	spin_lock_bh(&ifp->lock);
 	if (ifp->probes == 0) {
 		/*
-- 
1.6.3.3







More information about the kernel-team mailing list