diff options
author | Dan Williams <dcbw@redhat.com> | 2014-08-19 14:23:47 -0500 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2014-08-29 18:46:11 -0500 |
commit | a175ff090cac3172f9e194335fac38056e046504 (patch) | |
tree | 17709fc622b965f462b9f23156b0eb8fb8109aa7 | |
parent | af13376e2bb22bc13921a2f2c39c66a476ac674d (diff) |
core: allow connection assumption on pre-configured software devices
In the specific case that triggered this bug, both eth0 and eth0.123
existed and were configured before NM started, and a valid saved connection
existed for eth0.123. eth0 was ordered before eth0.123 in the Platform's
link list. When the end of add_devices() was reached for eth0 and
system_create_virtual_devices() was called, NM created an NMDevice for
the pre-existing eth0.123 link due to the saved connection, and
ignored the existing configuration because system_create_virtual_device()
re-calls add_device() with generate_con = FALSE.
Instead, we should allow system_create_virtual_device() to call add_device()
with generate_con = TRUE if the interface existed before NM created it. We
only want to skip connection assumption if the device was actually just
created by NM, in which case it cannot have any configuration to assume.
-rw-r--r-- | src/nm-manager.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/nm-manager.c b/src/nm-manager.c index 842fba998c..6b8ed909ac 100644 --- a/src/nm-manager.c +++ b/src/nm-manager.c @@ -1078,6 +1078,7 @@ system_create_virtual_device (NMManager *self, NMConnection *connection) GSList *iter; char *iface = NULL; NMDevice *device = NULL, *parent = NULL; + gboolean nm_owned = FALSE; iface = get_virtual_iface_name (self, connection, &parent); if (!iface) { @@ -1101,6 +1102,8 @@ system_create_virtual_device (NMManager *self, NMConnection *connection) */ priv->ignore_link_added_cb++; + nm_owned = !nm_platform_link_exists (iface); + if (nm_connection_is_type (connection, NM_SETTING_BOND_SETTING_NAME)) { device = nm_device_bond_new_for_connection (connection); } else if (nm_connection_is_type (connection, NM_SETTING_BRIDGE_SETTING_NAME)) { @@ -1127,8 +1130,14 @@ system_create_virtual_device (NMManager *self, NMConnection *connection) } if (device) { - nm_device_set_nm_owned (device); - add_device (self, device, FALSE); + if (nm_owned) + nm_device_set_nm_owned (device); + + /* If it was created by NM there's no connection to assume, but if it + * previously existed there might be one. + */ + add_device (self, device, !nm_owned); + g_object_unref (device); } |