Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FS#1393 - netifd: "ubus call network reload" can't remove the deprecated ipv6 prefix delegation on lan #5814

Closed
openwrt-bot opened this issue Feb 27, 2018 · 9 comments
Labels

Comments

@openwrt-bot
Copy link

alfred.song:

Supply the following if possible:

  • Device problem occurs on
  • Software versions of OpenWrt/LEDE release, packages, etc.
    OpenWrt Chaos Calmer 15.05.1
    netifd release: 0f96606b7040b8e14190ff055d5761744bc15f6d Tue Oct 17 22:16:43 2017 +0200
  • Steps to reproduce

"ubus call network reload" can't remove the deprecated ipv6 prefix delegation on lan interface

  1. I create a wan connection of type DHCPv6 with reqiapd enabled. Call "ubus call network reload"
  2. When wan connection is up, my lan interface br-lan will get delegated ipv6 address. Here is the uci configuration file and ifconfig
    [CXNK001D8F15] /etc # cat /etc/config/network

config interface 'loopback'
option ifname 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'

config globals 'globals'
option ula_prefix 'auto'

config interface 'lan'
option ifname 'eth0'
option type 'bridge'
option proto 'static'
option ipaddr '192.168.1.1'
option netmask '255.255.255.0'
option ip6assign '64'

config interface 'wan'
option ifname 'eth1'
option proto 'dhcp'
option peerdns '1'
option defaultroute '1'
option vendorid '844Ei.ONT.dslforum.org'
option reqopts '43 120 121'

config interface 'wan6'
option ifname 'eth1'
option proto 'dhcpv6'
option peerdns '1'
option defaultroute '1'
option reqopts '17'
option reqaddress 'try'
option reqprefix 'auto'

[] /etc # ifconfig br-lan
br-lan Link encap:Ethernet HWaddr 52:54:00:12:34:56
inet addr:192.168.1.1 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: 2001:db8:ffff:f000::1/64 Scope:Global
inet6 addr: fe80::5054:ff:fe12:3456/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:38 errors:0 dropped:0 overruns:0 frame:0
TX packets:3598 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:7094 (6.9 KiB) TX bytes:1784866 (1.7 MiB)

  1. I remove the DHCPv6 wan connection and create a static IPv4 interface. Call "ubus call network reload"
  2. The delegated ipv6 address is still there after step 3. Here is the uci configuration file and ifconfig
    [CXNK001D8F15] /etc # cat /etc/config/network

config interface 'loopback'
option ifname 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'

config globals 'globals'
option ula_prefix 'auto'

config interface 'lan'
option ifname 'eth0'
option type 'bridge'
option proto 'static'
option ipaddr '192.168.1.1'
option netmask '255.255.255.0'
option ip6assign '64'

config interface 'wan'
option ifname 'eth1'
option proto 'dhcp'
option peerdns '1'
option defaultroute '1'
option vendorid '844Ei.ONT.dslforum.org'
option reqopts '43 120 121'

[] /etc # ifconfig br-lan
br-lan Link encap:Ethernet HWaddr 52:54:00:12:34:56
inet addr:192.168.1.1 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: 2001:db8:ffff:f000::1/64 Scope:Global
inet6 addr: fe80::5054:ff:fe12:3456/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:38 errors:0 dropped:0 overruns:0 frame:0
TX packets:3419 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:7094 (6.9 KiB) TX bytes:1695840 (1.6 MiB)

"ubus call network restart" can fix this, but it is not preferred, for it will restart other unchanged interfaces too.
This seems to be a bug in netifd. My netifd release is 0f96606b7040b8e14190ff055d5761744bc15f6d.

Thanks.

@openwrt-bot
Copy link
Author

alfred.song:

I found that after DHCPv6 wan connection is removed, the ipv6 prefix assignment has been removed from netifd database of lan interface. It is just the ipv6 address assignment of br-lan is still there in linux protocol stack.
See dump below

  1. Create a DHCPv4 and a DHCPv6 wan connection:
[CXNK001D8F15] /lib/netifd/proto # ifstatus lan { "up": true, "pending": false, "available": true, "autostart": true, "dynamic": false, "uptime": 1981, "l3_device": "br-lan", "proto": "static", "device": "br-lan", "updated": [ "addresses" ], "metric": 0, "dns_metric": 0, "delegation": true, "ipv4-address": [ { "address": "192.168.1.1", "mask": 24 } ], "ipv6-address": [
],
"ipv6-prefix": [
	
],
"ipv6-prefix-assignment": [
	{
		"address": "2001:db8:ffff:f000::",
		"mask": 64,
		"preferred": 230,
		"valid": 455,
		"local-address": {
			"address": "2001:db8:ffff:f000::1",
			"mask": 64
		}
	}
],
"route": [

......

}

}
[CXNK001D8F15] /lib/netifd/proto #
[CXNK001D8F15] /lib/netifd/proto # ifconfig br-lan
br-lan Link encap:Ethernet HWaddr 52:54:00:12:34:56
inet addr:192.168.1.1 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: 2001:db8:ffff:f000::1/64 Scope:Global
inet6 addr: fe80::5054:ff:fe12:3456/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1039 errors:0 dropped:0 overruns:0 frame:0
TX packets:7115 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:139429 (136.1 KiB) TX bytes:3459249 (3.2 MiB)

2 Remove the DHCPv6 wan connection. As you can see in the dump below, the "ipv6-prefix-assignment" has been removed from netifd database, but ipv6 address assignment is still there.

[CXNK001D8F15] /lib/netifd/proto # ifstatus lan
{
"up": true,
"pending": false,
"available": true,
"autostart": true,
"dynamic": false,
"uptime": 2100,
"l3_device": "br-lan",
"proto": "static",
"device": "br-lan",
"updated": [
"addresses"
],
"metric": 0,
"dns_metric": 0,
"delegation": true,
"ipv4-address": [
{
"address": "192.168.1.1",
"mask": 24
}
],
"ipv6-address": [

],
"ipv6-prefix": [
	
],
"ipv6-prefix-assignment": [
	
],
"route": [
	
],
"dns-server": [
	
],
"dns-search": [
	
],
"inactive": {
	"ipv4-address": [
		
	],
	"ipv6-address": [
		
	],
	"route": [
		
	],
	"dns-server": [
		
	],
	"dns-search": [
		
	]
},
"data": {
	
}

}
[CXNK001D8F15] /lib/netifd/proto # ifconfig br-lan
br-lan Link encap:Ethernet HWaddr 52:54:00:12:34:56
inet addr:192.168.1.1 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: 2001:db8:ffff:f000::1/64 Scope:Global
inet6 addr: fe80::5054:ff:fe12:3456/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1049 errors:0 dropped:0 overruns:0 frame:0
TX packets:7483 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:141206 (137.8 KiB) TX bytes:3638760 (3.4 MiB)

@openwrt-bot
Copy link
Author

alfred.song:

It looks like something are missing in netifd to clear the deprecated ipv6 address of linux protocol stack.

@openwrt-bot
Copy link
Author

alfred.song:

netifd maintains a state machine for each interface.
From what I've found, "ubus call network reload" will not tear down all interfaces first, no change was applied to lan section in my test. Thus lan interface's state will still be UP after reload, it will not trigger the process in func interface_set_up() to remove/add the ip address of linux interface.

@openwrt-bot
Copy link
Author

dedeckeh:

The delegated IPv6 address is invalidated by netifd by setting the preferred and valid lifetime to 0 which can be checked by inspecting the output of ip -6 addr show.
The fact it's not removed is not really optimal but in any case the IPv6 address cannot be used anymore for IPv6 connectivity purposes

@openwrt-bot
Copy link
Author

alfred.song:

Hi Hans,

I re-checked the lifetime, routing, and odhcpd behavior following your comments.
when DHCPv6 wan connection is removed.

  • The preferred lifetime is set to 0, and this delegated address changed to "deprecated" state
ip -6 addr show ...... 10: br-lan: mtu 1500 inet6 2001:db8:3200::1/64 scope global noprefixroute valid_lft forever preferred_lft forever inet6 2001:db8:ffff:f000::1/64 scope global deprecated noprefixroute dynamic valid_lft 42sec preferred_lft 0sec inet6 fe80::5054:ff:fe12:3456/64 scope link valid_lft forever preferred_lft forever ......
  • The routing of this pd was removed

  • odhcpd continue to advertise the old prefix, until its valid lifetime expired. But the advertised preferred_lft and valid_lft are 0

I believe this is acceptable.

Thanks for the reply.

@openwrt-bot
Copy link
Author

dedeckeh:

Not removing the IPv6 address allows odhcpd to announce the IPv6 prefix as deprecated; this allows downstream devices to detect the IPv6 prefix as deprecated in a fast way and possible fast switch over to a valid IPv6 prefix

@openwrt-bot
Copy link
Author

alfred.song:

Yes, indeed.
On my lan device (a linux pc), I could see that when dhcpv6 wan connection is removed:

  • A RA is sent out to lan dev immediately, in which plt and vlt are 0
  • On lan dev, the related ipv6 address changed to deprecated. And its routing is removed.

Thanks for the clarification.

@openwrt-bot
Copy link
Author

alfred.song:

Hans,

Can you please give me a hint on where the preferred lifetime and valid lifetime are set to 0 in the code?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant