GNOME Bugzilla – Bug 741742
[PATCH] core: fix re-activation of connections on EXTERNAL_DOWN interfaces
Last modified: 2014-12-19 17:05:43 UTC
Created attachment 293021 [details] [review] 0001-core-fix-re-activation-of-connections-on-EXTERNAL_DO.patch When userspace IPv6LL capability is compiled into NetworkManager, during deactivation NM will toggle userspace IPv6LL in some cases. This causes link change events in the platform, which show up in nm-device.c::device_link_changed(). When an EXTERNAL_DOWN interface was activated, the EXTERNAL_DOWN flag was never cleared even if the device was set IFF_UP or if a connection was activated via D-Bus (which explicitly sets the device up). Second, the device_link_changed() code changed device state whether or not IFF_UP had actually changed, it simply looked at the current value. Together, this caused the first activation of an EXTERNAL_DOWN device to succeed, but the EXTERNAL_DOWN flag was never cleared even though the activation set the device IFF_UP. When a second activation request came in, the device was moved to DISCONNECTED state and IPv6LL genmode was reset, causing device_link_changed() to run. Since the device had EXTERNAL_DOWN and IFF_UP were still set, nm_device_set_unmanaged_flag() code was triggered to clear EXTERNAL_DOWN, which resulted in a state transition to UNAVAILABLE with a reason of CONNECTION_ASSUMED. This caused the second activation request to fail because UNAVAILABLE devices cannot activate connections by definition. The fix has three parts: 1) Only change EXTERNAL_DOWN if IFF_UP actually changes, to prevent spurious changes when something other than IFF_UP changes 2) Only clear EXTERNAL_DOWN when IFF_UP changes while the device is UNMANAGED, since any state higher than UNMANAGED implies that either an activation request was received (and thus the device should be managed) or IFF_UP was set 3) Clear EXTERNAL_DOWN (without triggering state changes) when any state higher than UNAVAILABLE is entered, since this implies that a connection is activating or the device is no longer IFF_UP fixes:NetworkManager_Test108_testcase_303655
NetworkManager[822]: <info> (eth1): device state change: deactivating -> disconnected (reason 'none') [110 30 0] NetworkManager[822]: <debug> [1418942222.321620] [devices/nm-device.c:4326] set_nm_ipv6ll(): [0x7f8055f5ecc0] (eth1): will enable userland IPv6LL NetworkManager[822]: <debug> [1418942222.321637] [platform/nm-linux-platform.c:2504] link_set_user_ipv6ll_enabled(): link: change 7: set IPv6 address generation mode to none NetworkManager[822]: <debug> [1418942222.321716] [platform/nm-linux-platform.c:426] get_kernel_object(): get_kernel_object for link: eth1 (7, family 0) NetworkManager[822]: <debug> [1418942222.326215] [platform/nm-platform.c:2712] log_link(): signal: link changed: 7: eth1 <UP,LOWER_UP> mtu 1500 veth driver 'veth' udi '/sys/devices/virtual/net/eth1' NetworkManager[822]: <debug> [1418942222.326247] [devices/nm-device.c:6699] nm_device_set_unmanaged(): [0x7f8055f5ecc0] (eth1): now managed NetworkManager[822]: (devices/nm-device.c:7431):_set_state_full: runtime check failed: (priv->in_state_changed == FALSE) NetworkManager[822]: <info> (eth1): device state change: disconnected -> unavailable (reason 'connection-assumed') [30 20 41]
Created attachment 293023 [details] [review] 0001-core-fix-re-activation-of-connections-on-EXTERNAL_DO.patch
Comment on attachment 293023 [details] [review] 0001-core-fix-re-activation-of-connections-on-EXTERNAL_DO.patch it looks right, I think, but then, I thought it looked right before too...
LGTM too
711a05965b4f196a930bddc095ca9448e3ded854 (master) 4ed8f9ecb63247822b54c4fe3b4ec4509995877a (nm-1-0)