Skip to content

Commit

Permalink
net: ipv6: Do not keep IPv6 addresses when IPv6 is disabled
Browse files Browse the repository at this point in the history
[ Upstream commit bc56163 ]

If IPv6 is disabled when the option is set to keep IPv6
addresses on link down, userspace is unaware of this as
there is no such indication via netlink. The solution is to
remove the IPv6 addresses in this case, which results in
netlink messages indicating removal of addresses in the
usual manner. This fix also makes the behavior consistent
with the case of having IPv6 disabled first, which stops
IPv6 addresses from being added.

Fixes: f1705ec ("net: ipv6: Make address flushing on ifdown optional")
Signed-off-by: Mike Manning <mmanning@brocade.com>
Acked-by: David Ahern <dsa@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Mike Manning authored and gregkh committed Sep 24, 2016
1 parent b200d3a commit 33251f9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/ipv6/addrconf.c
Original file line number Diff line number Diff line change
Expand Up @@ -3469,7 +3469,7 @@ static int addrconf_ifdown(struct net_device *dev, int how)
/* combine the user config with event to determine if permanent
* addresses are to be removed from address hash table
*/
keep_addr = !(how || _keep_addr <= 0);
keep_addr = !(how || _keep_addr <= 0 || idev->cnf.disable_ipv6);

/* Step 2: clear hash table */
for (i = 0; i < IN6_ADDR_HSIZE; i++) {
Expand Down Expand Up @@ -3525,7 +3525,7 @@ static int addrconf_ifdown(struct net_device *dev, int how)
/* re-combine the user config with event to determine if permanent
* addresses are to be removed from the interface list
*/
keep_addr = (!how && _keep_addr > 0);
keep_addr = (!how && _keep_addr > 0 && !idev->cnf.disable_ipv6);

INIT_LIST_HEAD(&del_list);
list_for_each_entry_safe(ifa, tmp, &idev->addr_list, if_list) {
Expand Down

0 comments on commit 33251f9

Please sign in to comment.