diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2019-02-26 10:07:36 +0100 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2019-02-26 11:10:31 +0100 |
commit | 726aa7e103a4ed55cb7bfd78e56821d0ba87917f (patch) | |
tree | 956e2727c3ceb8f0bb95e6c217b9c95dc34ee254 | |
parent | 8f6a8d051731333d94da6f2c43c72a1fd9aed9ff (diff) | |
download | NetworkManager-bg/rh1676551.tar.gz |
wipbg/rh1676551
-rw-r--r-- | src/devices/nm-device.c | 6 | ||||
-rw-r--r-- | src/nm-manager.c | 7 | ||||
-rw-r--r-- | src/platform/nm-platform.c | 26 | ||||
-rw-r--r-- | src/platform/nm-platform.h | 1 |
4 files changed, 36 insertions, 4 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 68bc805529..b62da80f16 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -3615,9 +3615,9 @@ device_recheck_slave_status (NMDevice *self, const NMPlatformLink *plink) plink_master_keep_alive = nmp_object_ref (NMP_OBJECT_UP_CAST (plink_master)); if ( master == NULL - && plink_master - && g_strcmp0 (plink_master->name, "ovs-system") == 0 - && plink_master->type == NM_LINK_TYPE_OPENVSWITCH) { + && nm_platform_link_is_ovs_system (nm_device_get_platform (self), + -1, + plink_master)) { _LOGD (LOGD_DEVICE, "the device claimed by openvswitch"); return; } diff --git a/src/nm-manager.c b/src/nm-manager.c index ce0d7c482f..45755280b6 100644 --- a/src/nm-manager.c +++ b/src/nm-manager.c @@ -2487,7 +2487,12 @@ get_existing_connection (NMManager *self, if (ifindex) { int master_ifindex = nm_platform_link_get_master (priv->platform, ifindex); - if (master_ifindex) { + /* Check that the master is activating before assuming a + * slave connection. However, ignore ovs-system master as + * we never manage it. + */ + if ( master_ifindex + && !nm_platform_link_is_ovs_system (priv->platform, master_ifindex, NULL)) { master = nm_manager_get_device_by_ifindex (self, master_ifindex); if (!master) { _LOG2D (LOGD_DEVICE, device, "assume: don't assume because " diff --git a/src/platform/nm-platform.c b/src/platform/nm-platform.c index 10bf417968..74132ed2a8 100644 --- a/src/platform/nm-platform.c +++ b/src/platform/nm-platform.c @@ -1641,6 +1641,32 @@ nm_platform_link_get_mtu (NMPlatform *self, int ifindex) } /** + * nm_platform_link_is_ovs_system: + * @self: platform instance + * @ifindex: Interface index + * @pllink: platform link + * + * Checks whether the given interface is the ovs-master one. + * The check is performed on @ifindex if it is set (> 0), + * otherwise on @pllink. + * + * Returns: %TRUE if the interface is the ovs-master, %FALSE otherwise. + */ +gboolean +nm_platform_link_is_ovs_system (NMPlatform *self, int ifindex, const NMPlatformLink *pllink) +{ + _CHECK_SELF (self, klass, FALSE); + g_return_val_if_fail ((ifindex > 0) ^ (!!pllink), FALSE); + + if (ifindex > 0) + pllink = nm_platform_link_get (self, ifindex); + + return pllink + && pllink->type == NM_LINK_TYPE_OPENVSWITCH + && nm_streq0 (pllink->name, "ovs-system"); +} + +/** * nm_platform_link_set_name: * @self: platform instance * @ifindex: Interface index diff --git a/src/platform/nm-platform.h b/src/platform/nm-platform.h index 37aa58fdc5..72b2ba32bf 100644 --- a/src/platform/nm-platform.h +++ b/src/platform/nm-platform.h @@ -1213,6 +1213,7 @@ gboolean nm_platform_link_is_connected (NMPlatform *self, int ifindex); gboolean nm_platform_link_uses_arp (NMPlatform *self, int ifindex); guint32 nm_platform_link_get_mtu (NMPlatform *self, int ifindex); gboolean nm_platform_link_get_user_ipv6ll_enabled (NMPlatform *self, int ifindex); +gboolean nm_platform_link_is_ovs_system (NMPlatform *self, int ifindex, const NMPlatformLink *plink); gconstpointer nm_platform_link_get_address (NMPlatform *self, int ifindex, size_t *length); |