All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: ipv6: Do not keep linklocal and loopback addresses
@ 2016-04-08 19:01 David Ahern
  2016-04-14  3:00 ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: David Ahern @ 2016-04-08 19:01 UTC (permalink / raw)
  To: netdev; +Cc: David Ahern

f1705ec197e7 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 are also retained which is not part of the objective
of f1705ec197e7. Add check to drop those addresses.

Fixes: f1705ec197e7 ("net: ipv6: Make address flushing on ifdown optional")

Signed-off-by: David Ahern <dsa@cumulusnetworks.com>
---
 net/ipv6/addrconf.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 27aed1afcf81..2dd8c1ca3287 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -3438,6 +3438,12 @@ 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);
@@ -3495,7 +3501,8 @@ static int addrconf_ifdown(struct net_device *dev, int how)
 				 * address is retained on a down event
 				 */
 				if (!keep_addr ||
-				    !(ifa->flags & IFA_F_PERMANENT)) {
+				    !(ifa->flags & IFA_F_PERMANENT) ||
+				    addr_is_local(&ifa->addr)) {
 					hlist_del_init_rcu(&ifa->addr_lst);
 					goto restart;
 				}
@@ -3544,7 +3551,8 @@ static int addrconf_ifdown(struct net_device *dev, int how)
 		write_unlock_bh(&idev->lock);
 		spin_lock_bh(&ifa->lock);
 
-		if (keep_addr && (ifa->flags & IFA_F_PERMANENT)) {
+		if (keep_addr && (ifa->flags & IFA_F_PERMANENT) &&
+		    !addr_is_local(&ifa->addr)) {
 			/* set state to skip the notifier below */
 			state = INET6_IFADDR_STATE_DEAD;
 			ifa->state = 0;
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: ipv6: Do not keep linklocal and loopback addresses
  2016-04-08 19:01 [PATCH] net: ipv6: Do not keep linklocal and loopback addresses David Ahern
@ 2016-04-14  3:00 ` David Miller
  2016-04-14  3:13   ` David Ahern
  0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2016-04-14  3:00 UTC (permalink / raw)
  To: dsa; +Cc: netdev

From: David Ahern <dsa@cumulusnetworks.com>
Date: Fri,  8 Apr 2016 12:01:21 -0700

> f1705ec197e7 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 are also retained which is not part of the objective
> of f1705ec197e7. Add check to drop those addresses.
> 
> Fixes: f1705ec197e7 ("net: ipv6: Make address flushing on ifdown optional")
> 
> Signed-off-by: David Ahern <dsa@cumulusnetworks.com>

Applied, but two things:

Please do not put an empty line between the Fixes: and other tags.
All tags are equal and should be placed together as an unsegmented
unit.

Second, please be really sure this is the final set of semantics
you want.  If we flap again on this after 4.6-final goes out the
door, I will be very unpleased to say the least.

Thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: ipv6: Do not keep linklocal and loopback addresses
  2016-04-14  3:00 ` David Miller
@ 2016-04-14  3:13   ` David Ahern
  0 siblings, 0 replies; 3+ messages in thread
From: David Ahern @ 2016-04-14  3:13 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

On 4/13/16 9:00 PM, David Miller wrote:
>
> Applied, but two things:
>
> Please do not put an empty line between the Fixes: and other tags.
> All tags are equal and should be placed together as an unsegmented
> unit.

ack.

> Second, please be really sure this is the final set of semantics
> you want.  If we flap again on this after 4.6-final goes out the
> door, I will be very unpleased to say the least.

(thunderbird underlined unpleased in that sentence as if you reached 
through the screen and and put a red marker on it)

With this patch we only retain user configured addresses which is the 
goal of the v1 patch posted back in January 2015. This is active in our 
code base so getting a lot of testing and exposure to other users. It is 
active on my server and VMs as well. With all of the VRF testing it is 
getting a workout. i.e, not much more I can do to ensure this is solid 
before 4.6 is final. I know this patch has been been ported and is in 
use by others; I would encourage them to share if they see problems or 
want adjustments as well.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-04-14  3:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-08 19:01 [PATCH] net: ipv6: Do not keep linklocal and loopback addresses David Ahern
2016-04-14  3:00 ` David Miller
2016-04-14  3:13   ` David Ahern

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.