Bug 172521 - [rc] service netif restart <interface> doesn't delete old IPv6 addresses
Summary: [rc] service netif restart <interface> doesn't delete old IPv6 addresses
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: conf (show other bugs)
Version: 10.0-STABLE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-rc (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-09 23:30 UTC by Enji Cooper
Modified: 2019-05-29 22:31 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Enji Cooper freebsd_committer freebsd_triage 2012-10-09 23:30:06 UTC
If I use the following procedure, it doesn't properly delete IPv6 addresses tied to an interface...

1. Configure an address in /etc/rc.conf, e.g.:

ifconfig_em1_ipv6="inet6 3ffe:501:ffff:100::2 prefixlen 64

2. Run service netif restart em1.
3. Verify address via ifconfig em1 | 3ffe:501:ffff:100::2 .
4. Comment out the ifconfig_* line above.
5. Run service netif restart em1 again.
6. Verify that the address has been deleted from the interface via ifconfig em1 | 3ffe:501:ffff:100::2 .
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2012-10-10 01:24:38 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-rc

Over to maintainer(s).
Comment 2 Chris Rees freebsd_committer freebsd_triage 2012-11-04 12:56:05 UTC
State Changed
From-To: open->closed

The correct approach is to netif stop, edit the file, then netif start, 
as with most rc.conf changes.
Comment 3 Bryan Drewery freebsd_committer freebsd_triage 2015-05-04 18:57:19 UTC
(In reply to Chris Rees from comment #2)
> State Changed
> From-To: open->closed
> 
> The correct approach is to netif stop, edit the file, then netif start, 
> as with most rc.conf changes.

This doesn't seem right. 'service netif stop' removes all IPv4 address but not IPv6 addresses. One of these is a bug.
Comment 4 Enji Cooper freebsd_committer freebsd_triage 2015-12-14 16:12:03 UTC
I think this was reported on 10.0-STABLE. I'll need to retest on 11.0-CURRENT.
Comment 5 Joe Maloney 2016-05-15 23:11:44 UTC
Just wanted to chime in, and add that service netif restart does not clear IPV6 addresses with 11-CURRENT.
Comment 6 Yann Kerherve 2019-05-29 22:31:54 UTC
I believe the fix is:


--- a/etc/network.subr	2019-05-17 09:48:19.186776000 -0700
+++ b/etc/network.subr	2019-05-17 09:49:38.591154000 -0700
@@ -743,10 +743,6 @@
 	_ifs="^"
 	_ret=1
 
-	if ! ipv6if $_if; then
-		return 0
-	fi
-
 	ipv6_accept_rtadv_down ${_if} && _ret=0
 	ipv6_prefix_hostid_addr_common ${_if} -alias && _ret=0
 	ifalias ${_if} inet6 -alias && _ret=0


ipv4_down doesn't check for ipv4 configs before tearing netif down, nor
should ipv6.