All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Manning <mmanning@brocade.com>
To: <netdev@vger.kernel.org>
Subject: [PATCH] net: ipv6: Do not fix up linklocal and loopback addresses
Date: Fri, 22 Apr 2016 17:14:35 +0100	[thread overview]
Message-ID: <571A4DEB.3090204@brocade.com> (raw)
In-Reply-To: <571A4D11.8070307@brocade.com>

commit f1705ec197e7 ("net: ipv6: Make address flushing on ifdown 
optional") added the option to retain user configured addresses on an
admin down. A comment to one of the later revisions suggested using
the IFA_F_PERMANENT flag rather than adding a user_managed boolean to
the ifaddr struct. A side effect of this change is that link local and
loopback addresses were also retained which was not part of the
objective of the original changes. The commit 70af921db6f8 ("net: ipv6: 
Do not keep linklocal and loopback addresses") ensures that these are
no longer kept. Similarly, the present fix ensures that these addresses
are not incorrectly fixed up. 

Testing also with the recent patch in place to delete host routes on
ifdown still shows that fixup of the LL & loopback addrs is incorrectly
being attempted (and without that patch was causing a crash in fib6).
Another approach to this is through code inspection by checking where
the user_managed flag in the original dahern patch (which we have been
using for nearly a year) has been replaced by checking IFA_F_PERMANENT.

Fixes: f1705ec197e7 ("net: ipv6: Make address flushing on ifdown optional")
Signed-off-by: Mike Manning <mmanning@brocade.com>
---
 net/ipv6/addrconf.c |   13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 23cec53..cba4e10 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -3200,6 +3200,12 @@ static void l3mdev_check_host_rt(struct inet6_dev *idev,
 }
 #endif
 
+static bool addr_is_local(const struct in6_addr *addr)
+{
+	return ipv6_addr_type(addr) &
+		(IPV6_ADDR_LINKLOCAL | IPV6_ADDR_LOOPBACK);
+}
+
 static int fixup_permanent_addr(struct inet6_dev *idev,
 				struct inet6_ifaddr *ifp)
 {
@@ -3238,6 +3244,7 @@ static void addrconf_permanent_addr(struct net_device *dev)
 
 	list_for_each_entry_safe(ifp, tmp, &idev->addr_list, if_list) {
 		if ((ifp->flags & IFA_F_PERMANENT) &&
+		    !addr_is_local(&ifp->addr) &&
 		    fixup_permanent_addr(idev, ifp) < 0) {
 			write_unlock_bh(&idev->lock);
 			ipv6_del_addr(ifp);
@@ -3448,12 +3455,6 @@ static void addrconf_type_change(struct net_device *dev, unsigned long event)
 		ipv6_mc_unmap(idev);
 }
 
-static bool addr_is_local(const struct in6_addr *addr)
-{
-	return ipv6_addr_type(addr) &
-		(IPV6_ADDR_LINKLOCAL | IPV6_ADDR_LOOPBACK);
-}
-
 static int addrconf_ifdown(struct net_device *dev, int how)
 {
 	struct net *net = dev_net(dev);
-- 
1.7.10.4

       reply	other threads:[~2016-04-22 16:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <571A4D11.8070307@brocade.com>
2016-04-22 16:14 ` Mike Manning [this message]
2016-04-22 22:14   ` [PATCH] net: ipv6: Do not fix up linklocal and loopback addresses David Ahern
     [not found] <5711AA52.6010400@brocade.com>
2016-04-16  3:13 ` Mike Manning
2016-04-16 14:31   ` Sergei Shtylyov
2016-04-16 18:26   ` David Ahern
2016-04-17 18:13     ` Mike Manning
2016-04-18 14:23   ` Mike Manning
2016-04-18 14:39     ` David Ahern
2016-04-18 15:14       ` Mike Manning
2016-04-18 15:19     ` Sergei Shtylyov
2016-04-18 15:28     ` Mike Manning

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=571A4DEB.3090204@brocade.com \
    --to=mmanning@brocade.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.