On 2/17/16 11:05 AM, David Miller wrote:
From: David Ahern <d...@cumulusnetworks.com>
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.