From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Ahern Subject: Re: [PATCH] net: ipv6: Make address flushing on ifdown optional Date: Wed, 17 Feb 2016 11:09:29 -0700 Message-ID: <56C4B759.70504@cumulusnetworks.com> References: <1455402207-9217-1-git-send-email-dsa@cumulusnetworks.com> <20160217.130504.1799252766739262191.davem@davemloft.net> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org, hannes@stressinduktion.org To: David Miller Return-path: Received: from mail-ob0-f182.google.com ([209.85.214.182]:36080 "EHLO mail-ob0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752605AbcBQSJc (ORCPT ); Wed, 17 Feb 2016 13:09:32 -0500 Received: by mail-ob0-f182.google.com with SMTP id gc3so26194111obb.3 for ; Wed, 17 Feb 2016 10:09:31 -0800 (PST) In-Reply-To: <20160217.130504.1799252766739262191.davem@davemloft.net> Sender: netdev-owner@vger.kernel.org List-ID: On 2/17/16 11:05 AM, David Miller wrote: > From: David Ahern > Date: Sat, 13 Feb 2016 14:23:27 -0800 > >> @@ -3427,31 +3493,52 @@ static int addrconf_ifdown(struct net_device *dev, int how) >> write_lock_bh(&idev->lock); >> } >> >> - while (!list_empty(&idev->addr_list)) { >> - ifa = list_first_entry(&idev->addr_list, >> - struct inet6_ifaddr, if_list); >> - addrconf_del_dad_work(ifa); >> + INIT_LIST_HEAD(&del_list); >> + list_for_each_entry_safe(ifa, tmp, &idev->addr_list, if_list) { >> + bool keep_ifa = false; >> >> - list_del(&ifa->if_list); >> + if (!how && keep_addr && ifa->user_managed) >> + keep_ifa = true; > > I think it would make sense to evaluate "!how && keep_addr" outside the > loop. The only thing that changes is ifa->user_managed on each iteration. > > But I also want some more documentation in what you are doing here. > > I understand the address flushing on ifdown avoidance, but all of this > user_managed logic is not mentioned at all. Why do you need it? What > role does it play in achieving your goal? > Per prior comment user_managed will go away in favor of checking IFA_F_PERMANENT. We are only keeping permanent addresses which in past versions of the patch were marked with user_managed flag but it is redundant.