summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Winship <danw@gnome.org>2014-08-07 10:47:56 -0400
committerDan Winship <danw@gnome.org>2014-09-03 11:09:55 -0400
commit95bad65aaaf0ea390b761cb929624488ebcde65a (patch)
treeb7d02010c1c5cf25f5eb752dece04d845d7efbfd
parentf712709f536b1b56efb24a4faaa010577fd97964 (diff)
downloadNetworkManager-95bad65aaaf0ea390b761cb929624488ebcde65a.tar.gz
libnm-core: drop nm_{setting,connection}_get_virtual_iface_name()
Since we enforce the fact that bond, bridge, team, and vlan interface-name properties match NMSettingConnection:interface-name, nm_connection_get_virtual_iface_name() can be replaced with nm_connection_get_interface_name() basically everywhere. The one place this doesn't work is with InfiniBand partitions (where get_virtual_iface_name() was actually computing the name), but for the most part we only need to care about the interface names of InfiniBand partitions in places where we also already need to do some other InfiniBand-specific handling as well, so we can use an InfiniBand-specific method (nm_setting_infiniband_get_virtual_interface_name()) to get it. (Also, while updating nm_device_get_virtual_device_description(), fix it to handle InfiniBand partitions too.)
-rw-r--r--clients/cli/connections.c6
-rw-r--r--clients/tui/nmt-slave-list.c2
-rw-r--r--libnm-core/nm-connection.c68
-rw-r--r--libnm-core/nm-connection.h2
-rw-r--r--libnm-core/nm-setting-bond.c9
-rw-r--r--libnm-core/nm-setting-bridge.c9
-rw-r--r--libnm-core/nm-setting-infiniband.c17
-rw-r--r--libnm-core/nm-setting-infiniband.h2
-rw-r--r--libnm-core/nm-setting-team.c9
-rw-r--r--libnm-core/nm-setting-vlan.c7
-rw-r--r--libnm-core/nm-setting.c21
-rw-r--r--libnm-core/nm-setting.h4
-rw-r--r--libnm/libnm.ver3
-rw-r--r--src/devices/nm-device-bond.c4
-rw-r--r--src/devices/nm-device-bridge.c4
-rw-r--r--src/devices/nm-device-infiniband.c5
-rw-r--r--src/devices/nm-device-vlan.c4
-rw-r--r--src/devices/team/nm-device-team.c4
-rw-r--r--src/nm-manager.c26
19 files changed, 49 insertions, 157 deletions
diff --git a/clients/cli/connections.c b/clients/cli/connections.c
index 59d851a162..21befc31bf 100644
--- a/clients/cli/connections.c
+++ b/clients/cli/connections.c
@@ -2726,7 +2726,7 @@ _strip_master_prefix (const char *master, const char *(**func)(NMConnection *))
if (g_str_has_prefix (master, "ifname/")) {
master = master + strlen ("ifname/");
if (func)
- *func = nm_connection_get_virtual_iface_name;
+ *func = nm_connection_get_interface_name;
} else if (g_str_has_prefix (master, "uuid/")) {
master = master + strlen ("uuid/");
if (func)
@@ -2788,7 +2788,7 @@ verify_master_for_slave (GSList *connections,
} else {
id = nm_connection_get_id (connection);
uuid = nm_connection_get_uuid (connection);
- ifname = nm_connection_get_virtual_iface_name (connection);
+ ifname = nm_connection_get_interface_name (connection);
if ( g_strcmp0 (master, uuid) == 0
|| g_strcmp0 (master, ifname) == 0) {
out_master = master;
@@ -5094,7 +5094,7 @@ gen_func_master_ifnames (const char *text, int state)
con_type = nm_setting_connection_get_connection_type (s_con);
if (g_strcmp0 (con_type, nmc_tab_completion.con_type) != 0)
continue;
- ifname = nm_connection_get_virtual_iface_name (con);
+ ifname = nm_connection_get_interface_name (con);
g_ptr_array_add (ifnames, (gpointer) ifname);
}
g_ptr_array_add (ifnames, (gpointer) NULL);
diff --git a/clients/tui/nmt-slave-list.c b/clients/tui/nmt-slave-list.c
index 459b944b9b..9c8596f77c 100644
--- a/clients/tui/nmt-slave-list.c
+++ b/clients/tui/nmt-slave-list.c
@@ -122,7 +122,7 @@ nmt_slave_list_connection_filter (NmtEditConnectionList *list,
if (!master)
return FALSE;
- master_ifname = nm_connection_get_virtual_iface_name (priv->master);
+ master_ifname = nm_connection_get_interface_name (priv->master);
if (g_strcmp0 (master, master_ifname) != 0 && g_strcmp0 (master, priv->master_uuid) != 0)
return FALSE;
diff --git a/libnm-core/nm-connection.c b/libnm-core/nm-connection.c
index db9c699dc7..a71aaee488 100644
--- a/libnm-core/nm-connection.c
+++ b/libnm-core/nm-connection.c
@@ -242,28 +242,6 @@ nm_connection_get_setting_by_name (NMConnection *connection, const char *name)
return type ? nm_connection_get_setting (connection, type) : NULL;
}
-/* not exposed until we actually need it */
-static NMSetting *
-_get_type_setting (NMConnection *connection)
-{
- NMSettingConnection *s_con;
- const char *type;
- NMSetting *base;
-
- g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL);
-
- s_con = nm_connection_get_setting_connection (connection);
- g_assert (s_con);
-
- type = nm_setting_connection_get_connection_type (s_con);
- g_assert (type);
-
- base = nm_connection_get_setting_by_name (connection, type);
- g_assert (base);
-
- return base;
-}
-
static gboolean
validate_permissions_type (GHashTable *hash, GError **error)
{
@@ -1433,30 +1411,6 @@ nm_connection_get_interface_name (NMConnection *connection)
}
/**
- * nm_connection_get_virtual_iface_name:
- * @connection: The #NMConnection
- *
- * Returns the name of the virtual kernel interface which the connection
- * needs to use if specified in the settings. This function abstracts all
- * connection types which require this functionality. For all other
- * connection types, this function will return %NULL.
- *
- * Returns: Name of the kernel interface or %NULL
- */
-const char *
-nm_connection_get_virtual_iface_name (NMConnection *connection)
-{
- NMSetting *base;
-
- g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL);
-
- base = _get_type_setting (connection);
- g_assert (base);
-
- return nm_setting_get_virtual_iface_name (base);
-}
-
-/**
* nm_connection_get_uuid:
* @connection: the #NMConnection
*
@@ -1533,16 +1487,13 @@ nm_connection_get_connection_type (NMConnection *connection)
char *
nm_connection_get_virtual_device_description (NMConnection *connection)
{
- const char *iface, *type, *display_type;
- NMSettingConnection *s_con;
+ const char *type;
+ const char *iface = NULL, *display_type = NULL;
- iface = nm_connection_get_virtual_iface_name (connection);
- if (!iface)
- return NULL;
+ iface = nm_connection_get_interface_name (connection);
- s_con = nm_connection_get_setting_connection (connection);
- g_return_val_if_fail (s_con != NULL, NULL);
- type = nm_setting_connection_get_connection_type (s_con);
+ type = nm_connection_get_connection_type (connection);
+ g_return_val_if_fail (type != NULL, FALSE);
if (!strcmp (type, NM_SETTING_BOND_SETTING_NAME))
display_type = _("Bond");
@@ -1552,11 +1503,14 @@ nm_connection_get_virtual_device_description (NMConnection *connection)
display_type = _("Bridge");
else if (!strcmp (type, NM_SETTING_VLAN_SETTING_NAME))
display_type = _("VLAN");
- else {
- g_warning ("Unrecognized virtual device type '%s'", type);
- display_type = type;
+ else if (!strcmp (type, NM_SETTING_INFINIBAND_SETTING_NAME)) {
+ display_type = _("InfiniBand");
+ iface = nm_setting_infiniband_get_virtual_interface_name (nm_connection_get_setting_infiniband (connection));
}
+ if (!iface || !display_type)
+ return NULL;
+
return g_strdup_printf ("%s (%s)", display_type, iface);
}
diff --git a/libnm-core/nm-connection.h b/libnm-core/nm-connection.h
index c9d88334ae..5e5ddd1b42 100644
--- a/libnm-core/nm-connection.h
+++ b/libnm-core/nm-connection.h
@@ -202,8 +202,6 @@ void nm_connection_set_path (NMConnection *connection,
const char * nm_connection_get_path (NMConnection *connection);
-const char * nm_connection_get_virtual_iface_name (NMConnection *connection);
-
const char * nm_connection_get_interface_name (NMConnection *connection);
gboolean nm_connection_is_type (NMConnection *connection, const char *type);
diff --git a/libnm-core/nm-setting-bond.c b/libnm-core/nm-setting-bond.c
index 38e1c46847..9886d021c3 100644
--- a/libnm-core/nm-setting-bond.c
+++ b/libnm-core/nm-setting-bond.c
@@ -674,14 +674,6 @@ verify (NMSetting *setting, GSList *all_settings, GError **error)
all_settings, error);
}
-static const char *
-get_virtual_iface_name (NMSetting *setting)
-{
- NMSettingBond *self = NM_SETTING_BOND (setting);
-
- return nm_setting_bond_get_interface_name (self);
-}
-
static void
nm_setting_bond_init (NMSettingBond *setting)
{
@@ -768,7 +760,6 @@ nm_setting_bond_class_init (NMSettingBondClass *setting_class)
object_class->get_property = get_property;
object_class->finalize = finalize;
parent_class->verify = verify;
- parent_class->get_virtual_iface_name = get_virtual_iface_name;
/* Properties */
/**
diff --git a/libnm-core/nm-setting-bridge.c b/libnm-core/nm-setting-bridge.c
index 430c1d8c76..9c89fbbeff 100644
--- a/libnm-core/nm-setting-bridge.c
+++ b/libnm-core/nm-setting-bridge.c
@@ -300,14 +300,6 @@ verify (NMSetting *setting, GSList *all_settings, GError **error)
all_settings, error);
}
-static const char *
-get_virtual_iface_name (NMSetting *setting)
-{
- NMSettingBridge *self = NM_SETTING_BRIDGE (setting);
-
- return nm_setting_bridge_get_interface_name (self);
-}
-
static void
nm_setting_bridge_init (NMSettingBridge *setting)
{
@@ -417,7 +409,6 @@ nm_setting_bridge_class_init (NMSettingBridgeClass *setting_class)
object_class->get_property = get_property;
object_class->finalize = finalize;
parent_class->verify = verify;
- parent_class->get_virtual_iface_name = get_virtual_iface_name;
/* Properties */
/**
diff --git a/libnm-core/nm-setting-infiniband.c b/libnm-core/nm-setting-infiniband.c
index d60164ad85..86b1e6efa3 100644
--- a/libnm-core/nm-setting-infiniband.c
+++ b/libnm-core/nm-setting-infiniband.c
@@ -175,8 +175,18 @@ nm_setting_infiniband_get_parent (NMSettingInfiniband *setting)
return NM_SETTING_INFINIBAND_GET_PRIVATE (setting)->parent;
}
-static const char *
-get_virtual_iface_name (NMSetting *setting)
+/**
+ * nm_setting_infiniband_get_virtual_interface_name:
+ * @setting: the #NMSettingInfiniband
+ *
+ * Returns the interface name created by combining #NMSettingInfiniband:parent
+ * and #NMSettingInfiniband:p-key. (If either property is unset, this will
+ * return %NULL.)
+ *
+ * Returns: the interface name, or %NULL
+ **/
+const char *
+nm_setting_infiniband_get_virtual_interface_name (NMSettingInfiniband *setting)
{
NMSettingInfinibandPrivate *priv = NM_SETTING_INFINIBAND_GET_PRIVATE (setting);
@@ -397,8 +407,7 @@ nm_setting_infiniband_class_init (NMSettingInfinibandClass *setting_class)
object_class->get_property = get_property;
object_class->finalize = finalize;
- parent_class->verify = verify;
- parent_class->get_virtual_iface_name = get_virtual_iface_name;
+ parent_class->verify = verify;
/* Properties */
/**
diff --git a/libnm-core/nm-setting-infiniband.h b/libnm-core/nm-setting-infiniband.h
index dcc8fa8306..10899de257 100644
--- a/libnm-core/nm-setting-infiniband.h
+++ b/libnm-core/nm-setting-infiniband.h
@@ -81,6 +81,8 @@ const char * nm_setting_infiniband_get_transport_mode (NMSettingInfiniband
int nm_setting_infiniband_get_p_key (NMSettingInfiniband *setting);
const char * nm_setting_infiniband_get_parent (NMSettingInfiniband *setting);
+const char * nm_setting_infiniband_get_virtual_interface_name (NMSettingInfiniband *setting);
+
G_END_DECLS
#endif /* __NM_SETTING_INFINIBAND_H__ */
diff --git a/libnm-core/nm-setting-team.c b/libnm-core/nm-setting-team.c
index 75305b1671..54592b822e 100644
--- a/libnm-core/nm-setting-team.c
+++ b/libnm-core/nm-setting-team.c
@@ -132,14 +132,6 @@ verify (NMSetting *setting, GSList *all_settings, GError **error)
all_settings, error);
}
-static const char *
-get_virtual_iface_name (NMSetting *setting)
-{
- NMSettingTeam *self = NM_SETTING_TEAM (setting);
-
- return nm_setting_team_get_interface_name (self);
-}
-
static void
nm_setting_team_init (NMSettingTeam *setting)
{
@@ -209,7 +201,6 @@ nm_setting_team_class_init (NMSettingTeamClass *setting_class)
object_class->get_property = get_property;
object_class->finalize = finalize;
parent_class->verify = verify;
- parent_class->get_virtual_iface_name = get_virtual_iface_name;
/* Properties */
/**
diff --git a/libnm-core/nm-setting-vlan.c b/libnm-core/nm-setting-vlan.c
index 22fb2d7403..d977f6b2dd 100644
--- a/libnm-core/nm-setting-vlan.c
+++ b/libnm-core/nm-setting-vlan.c
@@ -602,12 +602,6 @@ verify (NMSetting *setting, GSList *all_settings, GError **error)
all_settings, error);
}
-static const char *
-get_virtual_iface_name (NMSetting *setting)
-{
- return nm_setting_vlan_get_interface_name (NM_SETTING_VLAN (setting));
-}
-
static GSList *
priority_stringlist_to_maplist (NMVlanPriorityMap map, GSList *strlist)
{
@@ -733,7 +727,6 @@ nm_setting_vlan_class_init (NMSettingVlanClass *setting_class)
object_class->get_property = get_property;
object_class->finalize = finalize;
parent_class->verify = verify;
- parent_class->get_virtual_iface_name = get_virtual_iface_name;
/* Properties */
diff --git a/libnm-core/nm-setting.c b/libnm-core/nm-setting.c
index 30dab04f51..4a24256760 100644
--- a/libnm-core/nm-setting.c
+++ b/libnm-core/nm-setting.c
@@ -1534,27 +1534,6 @@ nm_setting_to_string (NMSetting *setting)
return g_string_free (string, FALSE);
}
-/**
- * nm_setting_get_virtual_iface_name:
- * @setting: the #NMSetting
- *
- * Returns the name of the virtual kernel interface which the connection
- * needs to use if specified in the settings.
- *
- * Returns: Name of the virtual interface or %NULL if the setting does not
- * support this feature
- **/
-const char *
-nm_setting_get_virtual_iface_name (NMSetting *setting)
-{
- g_return_val_if_fail (NM_IS_SETTING (setting), NULL);
-
- if (NM_SETTING_GET_CLASS (setting)->get_virtual_iface_name)
- return NM_SETTING_GET_CLASS (setting)->get_virtual_iface_name (setting);
-
- return NULL;
-}
-
NMSetting *
_nm_setting_find_in_list_required (GSList *all_settings,
const char *setting_name,
diff --git a/libnm-core/nm-setting.h b/libnm-core/nm-setting.h
index deb894e892..c2fef09f1b 100644
--- a/libnm-core/nm-setting.h
+++ b/libnm-core/nm-setting.h
@@ -205,8 +205,6 @@ typedef struct {
const GParamSpec *prop_spec,
NMSettingCompareFlags flags);
- const char *(*get_virtual_iface_name) (NMSetting *setting);
-
/*< private >*/
gpointer padding[8];
} NMSettingClass;
@@ -289,8 +287,6 @@ gboolean nm_setting_set_secret_flags (NMSetting *setting,
NMSettingSecretFlags flags,
GError **error);
-const char *nm_setting_get_virtual_iface_name (NMSetting *setting);
-
G_END_DECLS
#endif /* __NM_SETTING_H__ */
diff --git a/libnm/libnm.ver b/libnm/libnm.ver
index 7ad57bcc3f..53fb404a26 100644
--- a/libnm/libnm.ver
+++ b/libnm/libnm.ver
@@ -117,7 +117,6 @@ global:
nm_connection_get_type;
nm_connection_get_uuid;
nm_connection_get_virtual_device_description;
- nm_connection_get_virtual_iface_name;
nm_connection_is_type;
nm_connection_need_secrets;
nm_connection_normalize;
@@ -579,7 +578,6 @@ global:
nm_setting_get_name;
nm_setting_get_secret_flags;
nm_setting_get_type;
- nm_setting_get_virtual_iface_name;
nm_setting_gsm_error_get_type;
nm_setting_gsm_error_quark;
nm_setting_gsm_get_apn;
@@ -601,6 +599,7 @@ global:
nm_setting_infiniband_get_parent;
nm_setting_infiniband_get_transport_mode;
nm_setting_infiniband_get_type;
+ nm_setting_infiniband_get_virtual_interface_name;
nm_setting_infiniband_new;
nm_setting_ip4_config_add_address;
nm_setting_ip4_config_add_dns;
diff --git a/src/devices/nm-device-bond.c b/src/devices/nm-device-bond.c
index 4f6fbfadf9..029deb80d9 100644
--- a/src/devices/nm-device-bond.c
+++ b/src/devices/nm-device-bond.c
@@ -111,7 +111,7 @@ check_connection_compatible (NMDevice *device, NMConnection *connection)
return FALSE;
/* Bond connections must specify the virtual interface name */
- iface = nm_connection_get_virtual_iface_name (connection);
+ iface = nm_connection_get_interface_name (connection);
if (!iface || strcmp (nm_device_get_iface (device), iface))
return FALSE;
@@ -508,7 +508,7 @@ nm_device_bond_new_for_connection (NMConnection *connection)
g_return_val_if_fail (connection != NULL, NULL);
- iface = nm_connection_get_virtual_iface_name (connection);
+ iface = nm_connection_get_interface_name (connection);
g_return_val_if_fail (iface != NULL, NULL);
if ( !nm_platform_bond_add (iface)
diff --git a/src/devices/nm-device-bridge.c b/src/devices/nm-device-bridge.c
index 0197a95354..68cb500631 100644
--- a/src/devices/nm-device-bridge.c
+++ b/src/devices/nm-device-bridge.c
@@ -111,7 +111,7 @@ check_connection_compatible (NMDevice *device, NMConnection *connection)
return FALSE;
/* Bridge connections must specify the virtual interface name */
- iface = nm_connection_get_virtual_iface_name (connection);
+ iface = nm_connection_get_interface_name (connection);
if (!iface || strcmp (nm_device_get_iface (device), iface))
return FALSE;
@@ -461,7 +461,7 @@ nm_device_bridge_new_for_connection (NMConnection *connection)
g_return_val_if_fail (connection != NULL, NULL);
- iface = nm_connection_get_virtual_iface_name (connection);
+ iface = nm_connection_get_interface_name (connection);
g_return_val_if_fail (iface != NULL, NULL);
s_bridge = nm_connection_get_setting_bridge (connection);
diff --git a/src/devices/nm-device-infiniband.c b/src/devices/nm-device-infiniband.c
index d35c4f21b8..11335f4ed9 100644
--- a/src/devices/nm-device-infiniband.c
+++ b/src/devices/nm-device-infiniband.c
@@ -92,11 +92,12 @@ nm_device_infiniband_new_partition (NMConnection *connection,
g_return_val_if_fail (connection != NULL, NULL);
g_return_val_if_fail (NM_IS_DEVICE_INFINIBAND (parent), NULL);
- iface = nm_connection_get_virtual_iface_name (connection);
+ s_infiniband = nm_connection_get_setting_infiniband (connection);
+
+ iface = nm_setting_infiniband_get_virtual_interface_name (s_infiniband);
g_return_val_if_fail (iface != NULL, NULL);
parent_ifindex = nm_device_get_ifindex (parent);
- s_infiniband = nm_connection_get_setting_infiniband (connection);
p_key = nm_setting_infiniband_get_p_key (s_infiniband);
if ( !nm_platform_infiniband_partition_add (parent_ifindex, p_key)
diff --git a/src/devices/nm-device-vlan.c b/src/devices/nm-device-vlan.c
index d2d2e9ad69..b1fe7bc844 100644
--- a/src/devices/nm-device-vlan.c
+++ b/src/devices/nm-device-vlan.c
@@ -205,7 +205,7 @@ check_connection_compatible (NMDevice *device, NMConnection *connection)
* since both the parent interface and the VLAN ID matched by the time we
* get here.
*/
- iface = nm_connection_get_virtual_iface_name (connection);
+ iface = nm_connection_get_interface_name (connection);
if (iface) {
if (g_strcmp0 (nm_device_get_ip_iface (device), iface) != 0)
return FALSE;
@@ -470,7 +470,7 @@ nm_device_vlan_new_for_connection (NMConnection *connection, NMDevice *parent)
s_vlan = nm_connection_get_setting_vlan (connection);
g_return_val_if_fail (s_vlan != NULL, NULL);
- iface = g_strdup (nm_connection_get_virtual_iface_name (connection));
+ iface = g_strdup (nm_connection_get_interface_name (connection));
if (!iface) {
iface = nm_utils_new_vlan_name (nm_device_get_ip_iface (parent),
nm_setting_vlan_get_id (s_vlan));
diff --git a/src/devices/team/nm-device-team.c b/src/devices/team/nm-device-team.c
index d454c70871..0cdc44bbec 100644
--- a/src/devices/team/nm-device-team.c
+++ b/src/devices/team/nm-device-team.c
@@ -122,7 +122,7 @@ check_connection_compatible (NMDevice *device, NMConnection *connection)
return FALSE;
/* Team connections must specify the virtual interface name */
- iface = nm_connection_get_virtual_iface_name (connection);
+ iface = nm_connection_get_interface_name (connection);
if (!iface || strcmp (nm_device_get_iface (device), iface))
return FALSE;
@@ -716,7 +716,7 @@ nm_device_team_new_for_connection (NMConnection *connection, GError **error)
g_return_val_if_fail (connection != NULL, NULL);
- iface = nm_connection_get_virtual_iface_name (connection);
+ iface = nm_connection_get_interface_name (connection);
g_return_val_if_fail (iface != NULL, NULL);
if ( !nm_platform_team_add (iface)
diff --git a/src/nm-manager.c b/src/nm-manager.c
index 6b8ed909ac..e7ecc16954 100644
--- a/src/nm-manager.c
+++ b/src/nm-manager.c
@@ -966,13 +966,13 @@ get_virtual_iface_name (NMManager *self,
*out_parent = NULL;
if (nm_connection_is_type (connection, NM_SETTING_BOND_SETTING_NAME))
- return g_strdup (nm_connection_get_virtual_iface_name (connection));
+ return g_strdup (nm_connection_get_interface_name (connection));
if (nm_connection_is_type (connection, NM_SETTING_TEAM_SETTING_NAME))
- return g_strdup (nm_connection_get_virtual_iface_name (connection));
+ return g_strdup (nm_connection_get_interface_name (connection));
if (nm_connection_is_type (connection, NM_SETTING_BRIDGE_SETTING_NAME))
- return g_strdup (nm_connection_get_virtual_iface_name (connection));
+ return g_strdup (nm_connection_get_interface_name (connection));
if (nm_connection_is_type (connection, NM_SETTING_VLAN_SETTING_NAME)) {
NMSettingVlan *s_vlan;
@@ -984,7 +984,7 @@ get_virtual_iface_name (NMManager *self,
parent = find_vlan_parent (self, connection);
if (parent) {
- ifname = nm_connection_get_virtual_iface_name (connection);
+ ifname = nm_connection_get_interface_name (connection);
if (!nm_device_supports_vlans (parent)) {
nm_log_warn (LOGD_DEVICE, "(%s): No support for VLANs on interface %s of type %s",
@@ -1011,26 +1011,14 @@ get_virtual_iface_name (NMManager *self,
}
if (nm_connection_is_type (connection, NM_SETTING_INFINIBAND_SETTING_NAME)) {
- const char *ifname;
- char *name;
-
parent = find_infiniband_parent (self, connection);
if (parent) {
- ifname = nm_connection_get_virtual_iface_name (connection);
- if (ifname)
- name = g_strdup (ifname);
- else {
- NMSettingInfiniband *s_infiniband;
- int p_key;
+ NMSettingInfiniband *s_infiniband;
- ifname = nm_device_get_iface (parent);
- s_infiniband = nm_connection_get_setting_infiniband (connection);
- p_key = nm_setting_infiniband_get_p_key (s_infiniband);
- name = g_strdup_printf ("%s.%04x", ifname, p_key);
- }
+ s_infiniband = nm_connection_get_setting_infiniband (connection);
if (out_parent)
*out_parent = parent;
- return name;
+ return g_strdup (nm_setting_infiniband_get_virtual_interface_name (s_infiniband));
}
}