device: remove interface name checks from all classes
authorLubomir Rintel <lkundrak@v3.sk>
Tue, 16 Feb 2016 15:50:00 +0000 (16:50 +0100)
committerThomas Haller <thaller@redhat.com>
Wed, 17 Feb 2016 17:43:44 +0000 (18:43 +0100)
Generic check_connection_compatible() already does the check.

src/devices/nm-device-bond.c
src/devices/nm-device-bridge.c
src/devices/nm-device-macvlan.c
src/devices/nm-device-vlan.c
src/devices/nm-device-vxlan.c
src/devices/team/nm-device-team.c

index fda1085..cef3f9b 100644 (file)
@@ -75,7 +75,6 @@ check_connection_available (NMDevice *device,
 static gboolean
 check_connection_compatible (NMDevice *device, NMConnection *connection)
 {
-       const char *iface;
        NMSettingBond *s_bond;
 
        if (!NM_DEVICE_CLASS (nm_device_bond_parent_class)->check_connection_compatible (device, connection))
@@ -85,11 +84,6 @@ check_connection_compatible (NMDevice *device, NMConnection *connection)
        if (!s_bond || !nm_connection_is_type (connection, NM_SETTING_BOND_SETTING_NAME))
                return FALSE;
 
-       /* Bond connections must specify the virtual interface name */
-       iface = nm_connection_get_interface_name (connection);
-       if (!iface || strcmp (nm_device_get_iface (device), iface))
-               return FALSE;
-
        /* FIXME: match bond properties like mode, etc? */
 
        return TRUE;
index 4e23de2..e008213 100644 (file)
@@ -73,7 +73,6 @@ check_connection_available (NMDevice *device,
 static gboolean
 check_connection_compatible (NMDevice *device, NMConnection *connection)
 {
-       const char *iface;
        NMSettingBridge *s_bridge;
        const char *mac_address;
 
@@ -84,11 +83,6 @@ check_connection_compatible (NMDevice *device, NMConnection *connection)
        if (!s_bridge || !nm_connection_is_type (connection, NM_SETTING_BRIDGE_SETTING_NAME))
                return FALSE;
 
-       /* Bridge connections must specify the virtual interface name */
-       iface = nm_connection_get_interface_name (connection);
-       if (!iface || strcmp (nm_device_get_iface (device), iface))
-               return FALSE;
-
        mac_address = nm_setting_bridge_get_mac_address (s_bridge);
        if (mac_address && nm_device_is_real (device)) {
                const char *hw_addr;
index 17ee6e8..4560dd9 100644 (file)
@@ -376,7 +376,7 @@ check_connection_compatible (NMDevice *device, NMConnection *connection)
 {
        NMDeviceMacvlanPrivate *priv = NM_DEVICE_MACVLAN_GET_PRIVATE (device);
        NMSettingMacvlan *s_macvlan;
-       const char *parent, *iface = NULL;
+       const char *parent = NULL;
 
        if (!NM_DEVICE_CLASS (nm_device_macvlan_parent_class)->check_connection_compatible (device, connection))
                return FALSE;
@@ -409,13 +409,6 @@ check_connection_compatible (NMDevice *device, NMConnection *connection)
                }
        }
 
-       /* Ensure the interface name matches */
-       iface = nm_connection_get_interface_name (connection);
-       if (iface) {
-               if (g_strcmp0 (nm_device_get_ip_iface (device), iface) != 0)
-                       return FALSE;
-       }
-
        return TRUE;
 }
 
index a9b3c8b..fab48d7 100644 (file)
@@ -390,7 +390,7 @@ check_connection_compatible (NMDevice *device, NMConnection *connection)
 {
        NMDeviceVlanPrivate *priv = NM_DEVICE_VLAN_GET_PRIVATE (device);
        NMSettingVlan *s_vlan;
-       const char *parent, *iface = NULL;
+       const char *parent = NULL;
 
        if (!NM_DEVICE_CLASS (nm_device_vlan_parent_class)->check_connection_compatible (device, connection))
                return FALSE;
@@ -416,16 +416,6 @@ check_connection_compatible (NMDevice *device, NMConnection *connection)
                }
        }
 
-       /* Ensure the interface name matches.  If not specified we assume a match
-        * since both the parent interface and the VLAN ID matched by the time we
-        * get here.
-        */
-       iface = nm_connection_get_interface_name (connection);
-       if (iface) {
-               if (g_strcmp0 (nm_device_get_ip_iface (device), iface) != 0)
-                       return FALSE;
-       }
-
        return TRUE;
 }
 
index d7ded88..9317ef5 100644 (file)
@@ -296,7 +296,7 @@ check_connection_compatible (NMDevice *device, NMConnection *connection)
 {
        NMDeviceVxlanPrivate *priv = NM_DEVICE_VXLAN_GET_PRIVATE (device);
        NMSettingVxlan *s_vxlan;
-       const char *iface, *parent;
+       const char *parent;
 
        if (!NM_DEVICE_CLASS (nm_device_vxlan_parent_class)->check_connection_compatible (device, connection))
                return FALSE;
@@ -305,12 +305,6 @@ check_connection_compatible (NMDevice *device, NMConnection *connection)
        if (!s_vxlan)
                return FALSE;
 
-       iface = nm_connection_get_interface_name (connection);
-       if (iface) {
-               if (g_strcmp0 (nm_device_get_ip_iface (device), iface) != 0)
-                       return FALSE;
-       }
-
        if (nm_device_is_real (device)) {
                parent = nm_setting_vxlan_get_parent (s_vxlan);
                if (   parent
index 0fc3164..2258d99 100644 (file)
@@ -85,7 +85,6 @@ check_connection_available (NMDevice *device,
 static gboolean
 check_connection_compatible (NMDevice *device, NMConnection *connection)
 {
-       const char *iface;
        NMSettingTeam *s_team;
 
        if (!NM_DEVICE_CLASS (nm_device_team_parent_class)->check_connection_compatible (device, connection))
@@ -95,11 +94,6 @@ check_connection_compatible (NMDevice *device, NMConnection *connection)
        if (!s_team || !nm_connection_is_type (connection, NM_SETTING_TEAM_SETTING_NAME))
                return FALSE;
 
-       /* Team connections must specify the virtual interface name */
-       iface = nm_connection_get_interface_name (connection);
-       if (!iface || strcmp (nm_device_get_iface (device), iface))
-               return FALSE;
-
        /* FIXME: match team properties like mode, etc? */
 
        return TRUE;