device: remove interface name checks from all classes

Generic check_connection_compatible() already does the check.
This commit is contained in:
Lubomir Rintel 2016-02-16 16:50:00 +01:00 committed by Thomas Haller
parent f9ec713641
commit 8b016cd9a7
6 changed files with 3 additions and 44 deletions

View 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;

View 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;

View 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;
}

View 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;
}

View 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

View 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;