core: fix route metric set to -1 on DHCP renewal

System Internals / NetworkManager - Frederic Danis [sigfox.com] - 21 September 2018 06:34 EDT

The first DHCP renew after setting back Ethernet metric to default (-1) applies a metric of 4294967295 (uint16 -1) instead of the default metric.

The route becomes: Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 0.0.0.0 0.0.0.0 U 700 0 0 ppp0 0.0.0.0 192.168.19.193 0.0.0.0 UG -1 0 0 eth0 10.64.64.64 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0 10.64.64.64 0.0.0.0 255.255.255.255 UH 700 0 0 ppp0 10.250.0.0 0.0.0.0 255.255.0.0 U 50 0 0 tun0 192.168.19.0 0.0.0.0 255.255.255.0 U 100 0 0 eth0 192.168.19.193 0.0.0.0 255.255.255.255 UH 100 0 0 eth0 217.114.201.194 192.168.19.193 255.255.255.255 UGH 100 0 0 eth0

Route update traces: Sep 20 09:53:11.869027 tap-0FB1 NetworkManager[762]: libsystemd: DHCP CLIENT (0xfd5eaeb9): REQUEST (renewing) Sep 20 09:53:11.873766 tap-0FB1 NetworkManager[762]: libsystemd: DHCP CLIENT (0xfd5eaeb9): ACK Sep 20 09:53:11.873792 tap-0FB1 NetworkManager[762]: libsystemd: DHCP CLIENT (0xfd5eaeb9): lease expires in 1min 58s Sep 20 09:53:11.873800 tap-0FB1 NetworkManager[762]: libsystemd: DHCP CLIENT (0xfd5eaeb9): T2 expires in 1min 35s Sep 20 09:53:11.873808 tap-0FB1 NetworkManager[762]: libsystemd: DHCP CLIENT (0xfd5eaeb9): T1 expires in 50s Sep 20 09:53:11.873845 tap-0FB1 NetworkManager[762]: dhcp4 (eth0): client event 4 Sep 20 09:53:11.873853 tap-0FB1 NetworkManager[762]: dhcp4 (eth0): lease available Sep 20 09:53:11.873881 tap-0FB1 NetworkManager[762]: dhcp4 (eth0): address 192.168.19.100 Sep 20 09:53:11.873890 tap-0FB1 NetworkManager[762]: dhcp4 (eth0): plen 24 Sep 20 09:53:11.873899 tap-0FB1 NetworkManager[762]: dhcp4 (eth0): expires in 120 seconds Sep 20 09:53:11.873916 tap-0FB1 NetworkManager[762]: dhcp4 (eth0): nameserver '192.168.19.193' Sep 20 09:53:11.873925 tap-0FB1 NetworkManager[762]: dhcp4 (eth0): hostname 'TAPOFB1' Sep 20 09:53:11.873932 tap-0FB1 NetworkManager[762]: dhcp4 (eth0): gateway 192.168.19.193 Sep 20 09:53:11.874064 tap-0FB1 NetworkManager[762]: dhcp4 (eth0): state changed bound -> bound Sep 20 09:53:11.874082 tap-0FB1 NetworkManager[762]: device[0x558dc60b3140] (eth0): new DHCPv4 client state 1 Sep 20 09:53:11.874535 tap-0FB1 NetworkManager[762]: device[0x558dc60b3140] (eth0): ip4-config: update (commit=1, new-config=0x558dc6110be0) Sep 20 09:53:11.874569 tap-0FB1 NetworkManager[762]: platform: address: adding or updating IPv4 address: 192.168.19.100/24 lft 120sec pref 120sec lifetime 237-0[120,120] dev 2 flags noprefixroute src unkn Sep 20 09:53:11.874626 tap-0FB1 NetworkManager[762]: platform-linux: event-notification: RTM_NEWADDR, flags 0, seq 141: 192.168.19.100/24 lft 120sec pref 120sec lifetime 237-237[120,120] dev 2 flags noprl Sep 20 09:53:11.874653 tap-0FB1 NetworkManager[762]: platform: signal: address 4 changed: 192.168.19.100/24 lft 120sec pref 120sec lifetime 237-237[120,120] dev 2 flags noprefixroute src kernel Sep 20 09:53:11.874671 tap-0FB1 NetworkManager[762]: device[0x558dc60b3140] (eth0): queued IP4 config change Sep 20 09:53:11.874699 tap-0FB1 NetworkManager[762]: platform-linux: do-add-ip4-address[2: 192.168.19.100/24]: success Sep 20 09:53:11.874723 tap-0FB1 NetworkManager[762]: platform: route: append IPv4 route: 0.0.0.0/0 via 192.168.19.193 dev 2 metric 4294967295 mss 0 rt-src dhcp Sep 20 09:53:11.874778 tap-0FB1 NetworkManager[762]: platform-linux: event-notification: RTM_NEWROUTE, flags excl,create, seq 142: 0.0.0.0/0 via 192.168.19.193 dev 2 metric 4294967295 mss 0 rt-src rt-dhcl Sep 20 09:53:11.874809 tap-0FB1 NetworkManager[762]: platform: signal: route 4 added: 0.0.0.0/0 via 192.168.19.193 dev 2 metric 4294967295 mss 0 rt-src rt-dhcp scope global Sep 20 09:53:11.874846 tap-0FB1 NetworkManager[762]: platform-linux: do-add-ip4-route[0.0.0.0/0 via 192.168.19.193 dev 2 metric 4294967295 mss 0 rt-src rt-dhcp scope global]: success Sep 20 09:53:11.874867 tap-0FB1 NetworkManager[762]: platform: ip4-route: delete 0.0.0.0/0 via 192.168.19.193 dev 2 metric 100 mss 0 rt-src rt-dhcp scope global Sep 20 09:53:11.874904 tap-0FB1 NetworkManager[762]: platform-linux: event-notification: RTM_DELROUTE, flags 0, seq 143: 0.0.0.0/0 via 192.168.19.193 dev 2 metric 100 mss 0 rt-src rt-dhcp scope global Sep 20 09:53:11.874930 tap-0FB1 NetworkManager[762]: platform: signal: route 4 removed: 0.0.0.0/0 via 192.168.19.193 dev 2 metric 100 mss 0 rt-src rt-dhcp scope global Sep 20 09:53:11.874961 tap-0FB1 NetworkManager[762]: platform-linux: do-delete-ip4-route[0.0.0.0/0 via 192.168.19.193 dev 2 metric 100 mss 0 rt-src rt-dhcp scope global]: success Sep 20 09:53:11.874983 tap-0FB1 NetworkManager[762]: platform: ip4-dev-route: register 192.168.19.0/24 via 0.0.0.0 dev 2 metric 0 mss 0 rt-src rt-kernel scope link pref-src 192.168.19.100 (update)

https://mail.gnome.org/archives/networkmanager-list/2018-September/msg00020.html

Fixes: b9e6433a024c13631c984797c964f1863de83113

7d155757b core: fix route metric set to -1 on DHCP renewal
src/devices/nm-device.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)

Upstream: cgit.freedesktop.org


  • Share