diff -Nru network-manager-1.0.4/debian/changelog network-manager-1.0.4/debian/changelog --- network-manager-1.0.4/debian/changelog 2015-10-14 16:34:06.000000000 +0000 +++ network-manager-1.0.4/debian/changelog 2015-11-03 20:42:25.000000000 +0000 @@ -1,3 +1,10 @@ +network-manager (1.0.4-0ubuntu5.1) wily; urgency=medium + + * debian/patches/git_fix_race_external_down_e29ab543.patch: fix race in + wrongly managing devices due to receiving udev signals late. (LP: #1512749) + + -- Mathieu Trudel-Lapierre Tue, 03 Nov 2015 14:42:19 -0600 + network-manager (1.0.4-0ubuntu5) wily; urgency=medium * debian/patches/git_set_vpn_mtu_9736327b.patch: set the MTU for the VPN diff -Nru network-manager-1.0.4/debian/patches/git_fix_race_external_down_e29ab543.patch network-manager-1.0.4/debian/patches/git_fix_race_external_down_e29ab543.patch --- network-manager-1.0.4/debian/patches/git_fix_race_external_down_e29ab543.patch 1970-01-01 00:00:00.000000000 +0000 +++ network-manager-1.0.4/debian/patches/git_fix_race_external_down_e29ab543.patch 2015-11-03 20:42:25.000000000 +0000 @@ -0,0 +1,111 @@ +From e29ab54335c6a5ef1ce6bac525f1f18a8e81b96e Mon Sep 17 00:00:00 2001 +From: Thomas Haller +Date: Thu, 8 Oct 2015 11:11:42 +0200 +Subject: device: fix race wrongly managing external-down device due to late + udev signal + +Executing: + + # brctl addbr lbr0 + # ip addr add 10.1.1.1/24 dev lbr0 + # ip link set lbr0 up + +can result in a race so that NetworkManager would manage the device +(and clear the IP addresses). + +It happens, when NetworkManager first receives platform signals that +the device is already up: + + signal: link changed: 11: lbr0 mtu 1500 arp 1 bridge* not-init addrgenmode eui64 addr D2:A1:B4:17:18:F2 driver bridge + +Note that the device is still unknown via udev (not-init). The +unmanaged-state NM_UNMANAGED_EXTERNAL_DOWN gets cleared, but the +device still stays unmanaged. + +Only afterwards the device is known in udev: + + signal: link changed: 11: lbr0 mtu 1500 arp 1 bridge* init addrgenmode eui64 addr D2:A1:B4:17:18:F2 driver bridge + +At this point, we also clear NM_UNMANAGED_PLATFORM_INIT, making +the device managed with reason NM_DEVICE_STATE_REASON_NOW_MANAGED. +That results in managing the external device. + +Fix that by only clearing NM_UNMANAGED_EXTERNAL_DOWN after the device +is no longer NM_UNMANAGED_PLATFORM_INIT. + +https://bugzilla.redhat.com/show_bug.cgi?id=1269199 + +--- + src/devices/nm-device.c | 45 +++++++++++++++++++++++++++------------------ + 1 file changed, 27 insertions(+), 18 deletions(-) + +Index: b/src/devices/nm-device.c +=================================================================== +--- a/src/devices/nm-device.c ++++ b/src/devices/nm-device.c +@@ -1346,6 +1346,8 @@ device_link_changed (NMDevice *self) + NMPlatformLink info; + const NMPlatformLink *pllink; + int ifindex; ++ gboolean emit_link_initialized = FALSE; ++ gboolean was_up; + + priv->device_link_changed_id = 0; + +@@ -1421,8 +1423,31 @@ device_link_changed (NMDevice *self) + if (ip_ifname_changed) + update_dynamic_ip_setup (self); + +- if (priv->up != NM_FLAGS_HAS (info.flags, IFF_UP)) { +- priv->up = NM_FLAGS_HAS (info.flags, IFF_UP); ++ if (priv->ifindex > 0 && !priv->platform_link_initialized && info.initialized) { ++ gboolean platform_unmanaged = FALSE; ++ ++ priv->platform_link_initialized = TRUE; ++ ++ if (nm_platform_link_get_unmanaged (NM_PLATFORM_GET, priv->ifindex, &platform_unmanaged)) { ++ nm_device_set_unmanaged (self, ++ NM_UNMANAGED_DEFAULT, ++ platform_unmanaged, ++ NM_DEVICE_STATE_REASON_USER_REQUESTED); ++ } ++ ++ nm_device_set_unmanaged (self, ++ NM_UNMANAGED_PLATFORM_INIT, ++ FALSE, ++ NM_DEVICE_STATE_REASON_NOW_MANAGED); ++ ++ emit_link_initialized = TRUE; ++ } ++ ++ was_up = priv->up; ++ priv->up = NM_FLAGS_HAS (info.flags, IFF_UP); ++ ++ if ( priv->platform_link_initialized ++ && (emit_link_initialized || priv->up != was_up)) { + + /* Manage externally-created software interfaces only when they are IFF_UP */ + g_assert (priv->ifindex > 0); +@@ -1464,22 +1489,6 @@ device_link_changed (NMDevice *self) + } + } + +- if (priv->ifindex > 0 && !priv->platform_link_initialized && info.initialized) { +- priv->platform_link_initialized = TRUE; +- +- if (nm_platform_link_get_unmanaged (NM_PLATFORM_GET, priv->ifindex, &platform_unmanaged)) { +- nm_device_set_unmanaged (self, +- NM_UNMANAGED_DEFAULT, +- platform_unmanaged, +- NM_DEVICE_STATE_REASON_USER_REQUESTED); +- } +- +- nm_device_set_unmanaged (self, +- NM_UNMANAGED_PLATFORM_INIT, +- FALSE, +- NM_DEVICE_STATE_REASON_NOW_MANAGED); +- } +- + return G_SOURCE_REMOVE; + } + diff -Nru network-manager-1.0.4/debian/patches/series network-manager-1.0.4/debian/patches/series --- network-manager-1.0.4/debian/patches/series 2015-10-14 16:34:06.000000000 +0000 +++ network-manager-1.0.4/debian/patches/series 2015-11-03 20:42:25.000000000 +0000 @@ -3,6 +3,7 @@ git_fix_duplicate_unittest_names_7b70a840.patch git_set_vpn_mtu_9736327b.patch lp1446689_git_use_kernel_pppoe_6fdfb031.patch +git_fix_race_external_down_e29ab543.patch #breaks on Ubuntu! LP#1431774 #0001-Debian-specific-tweaks-for-NetworkManager-systemd-se.patch