mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-29 21:05:13 +00:00
IPv6: keep permanent addresses on admin down
Permanent IPV6 addresses should not be removed when the link is set to admin down, only when device is removed. When link is lost permanent addresses should be marked as tentative so that when link comes back they are subject to duplicate address detection (if DAD was enabled for that address). Other routing systems keep manually configured IPv6 addresses when link is set down. Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
c0ad98453f
commit
dc2b99f71e
@ -2646,7 +2646,8 @@ static int addrconf_ifdown(struct net_device *dev, int how)
|
|||||||
|
|
||||||
write_lock_bh(&addrconf_hash_lock);
|
write_lock_bh(&addrconf_hash_lock);
|
||||||
while ((ifa = *bifa) != NULL) {
|
while ((ifa = *bifa) != NULL) {
|
||||||
if (ifa->idev == idev) {
|
if (ifa->idev == idev &&
|
||||||
|
(how || !(ifa->flags&IFA_F_PERMANENT))) {
|
||||||
*bifa = ifa->lst_next;
|
*bifa = ifa->lst_next;
|
||||||
ifa->lst_next = NULL;
|
ifa->lst_next = NULL;
|
||||||
addrconf_del_timer(ifa);
|
addrconf_del_timer(ifa);
|
||||||
@ -2686,18 +2687,30 @@ static int addrconf_ifdown(struct net_device *dev, int how)
|
|||||||
write_lock_bh(&idev->lock);
|
write_lock_bh(&idev->lock);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
while ((ifa = idev->addr_list) != NULL) {
|
bifa = &idev->addr_list;
|
||||||
idev->addr_list = ifa->if_next;
|
while ((ifa = *bifa) != NULL) {
|
||||||
ifa->if_next = NULL;
|
if (how == 0 && (ifa->flags&IFA_F_PERMANENT)) {
|
||||||
ifa->dead = 1;
|
/* Retain permanent address on admin down */
|
||||||
addrconf_del_timer(ifa);
|
bifa = &ifa->if_next;
|
||||||
write_unlock_bh(&idev->lock);
|
|
||||||
|
|
||||||
__ipv6_ifa_notify(RTM_DELADDR, ifa);
|
/* Restart DAD if needed when link comes back up */
|
||||||
atomic_notifier_call_chain(&inet6addr_chain, NETDEV_DOWN, ifa);
|
if ( !((dev->flags&(IFF_NOARP|IFF_LOOPBACK)) ||
|
||||||
in6_ifa_put(ifa);
|
idev->cnf.accept_dad <= 0 ||
|
||||||
|
(ifa->flags & IFA_F_NODAD)))
|
||||||
|
ifa->flags |= IFA_F_TENTATIVE;
|
||||||
|
} else {
|
||||||
|
*bifa = ifa->if_next;
|
||||||
|
ifa->if_next = NULL;
|
||||||
|
|
||||||
write_lock_bh(&idev->lock);
|
ifa->dead = 1;
|
||||||
|
write_unlock_bh(&idev->lock);
|
||||||
|
|
||||||
|
__ipv6_ifa_notify(RTM_DELADDR, ifa);
|
||||||
|
atomic_notifier_call_chain(&inet6addr_chain, NETDEV_DOWN, ifa);
|
||||||
|
in6_ifa_put(ifa);
|
||||||
|
|
||||||
|
write_lock_bh(&idev->lock);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
write_unlock_bh(&idev->lock);
|
write_unlock_bh(&idev->lock);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user