After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 741742 - [PATCH] core: fix re-activation of connections on EXTERNAL_DOWN interfaces
[PATCH] core: fix re-activation of connections on EXTERNAL_DOWN interfaces
Status: RESOLVED FIXED
Product: NetworkManager
Classification: Platform
Component: IP and DNS config
unspecified
Other Linux
: Normal normal
: ---
Assigned To: NetworkManager maintainer(s)
NetworkManager maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2014-12-19 06:00 UTC by Dan Williams
Modified: 2014-12-19 17:05 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
0001-core-fix-re-activation-of-connections-on-EXTERNAL_DO.patch (6.34 KB, patch)
2014-12-19 06:00 UTC, Dan Williams
none Details | Review
0001-core-fix-re-activation-of-connections-on-EXTERNAL_DO.patch (6.35 KB, patch)
2014-12-19 06:03 UTC, Dan Williams
none Details | Review

Description Dan Williams 2014-12-19 06:00:37 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
Comment 1 Dan Williams 2014-12-19 06:02:57 UTC
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]
Comment 2 Dan Williams 2014-12-19 06:03:37 UTC
Created attachment 293023 [details] [review]
0001-core-fix-re-activation-of-connections-on-EXTERNAL_DO.patch
Comment 3 Dan Winship 2014-12-19 13:58:00 UTC
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...
Comment 4 Thomas Haller 2014-12-19 14:57:12 UTC
LGTM too
Comment 5 Dan Williams 2014-12-19 17:05:43 UTC
711a05965b4f196a930bddc095ca9448e3ded854 (master)
4ed8f9ecb63247822b54c4fe3b4ec4509995877a (nm-1-0)