platform/trivial: rename link related functions

Link related functions should have a "nm_platform_link" prefix. Rename.

Naming is a subjective matter and one might argue that omitting
the "link" part from the name is shorter and even preferred.

However, I think functions related to links should have a common
prefix as the underlyings are strongly related.
This commit is contained in:
Thomas Haller
2015-12-09 16:14:49 +01:00
parent 6a7730241b
commit eef388990f
15 changed files with 128 additions and 115 deletions

View File

@@ -455,9 +455,8 @@ create_and_realize (NMDevice *device,
NMPlatformError plerr; NMPlatformError plerr;
g_assert (iface); g_assert (iface);
g_assert (out_plink);
plerr = nm_platform_bond_add (NM_PLATFORM_GET, iface, out_plink); plerr = nm_platform_link_bond_add (NM_PLATFORM_GET, iface, out_plink);
if (plerr != NM_PLATFORM_ERROR_SUCCESS && plerr != NM_PLATFORM_ERROR_EXISTS) { if (plerr != NM_PLATFORM_ERROR_SUCCESS && plerr != NM_PLATFORM_ERROR_EXISTS) {
g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_CREATION_FAILED, g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_CREATION_FAILED,
"Failed to create bond interface '%s' for '%s': %s", "Failed to create bond interface '%s' for '%s': %s",

View File

@@ -400,11 +400,11 @@ create_and_realize (NMDevice *device,
} }
} }
plerr = nm_platform_bridge_add (NM_PLATFORM_GET, plerr = nm_platform_link_bridge_add (NM_PLATFORM_GET,
iface, iface,
hwaddr ? mac_address : NULL, hwaddr ? mac_address : NULL,
hwaddr ? ETH_ALEN : 0, hwaddr ? ETH_ALEN : 0,
out_plink); out_plink);
if (plerr != NM_PLATFORM_ERROR_SUCCESS && plerr != NM_PLATFORM_ERROR_EXISTS) { if (plerr != NM_PLATFORM_ERROR_SUCCESS && plerr != NM_PLATFORM_ERROR_EXISTS) {
g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_CREATION_FAILED, g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_CREATION_FAILED,
"Failed to create bridge interface '%s' for '%s': %s", "Failed to create bridge interface '%s' for '%s': %s",

View File

@@ -226,7 +226,7 @@ update_connection (NMDevice *device, NMConnection *connection)
ifindex = nm_device_get_ifindex (device); ifindex = nm_device_get_ifindex (device);
if (ifindex > 0) { if (ifindex > 0) {
if (!nm_platform_infiniband_get_properties (NM_PLATFORM_GET, ifindex, NULL, NULL, &transport_mode)) if (!nm_platform_link_infiniband_get_properties (NM_PLATFORM_GET, ifindex, NULL, NULL, &transport_mode))
transport_mode = "datagram"; transport_mode = "datagram";
} }
g_object_set (G_OBJECT (s_infiniband), NM_SETTING_INFINIBAND_TRANSPORT_MODE, transport_mode, NULL); g_object_set (G_OBJECT (s_infiniband), NM_SETTING_INFINIBAND_TRANSPORT_MODE, transport_mode, NULL);
@@ -268,7 +268,7 @@ create_and_realize (NMDevice *device,
return FALSE; return FALSE;
} }
plerr = nm_platform_infiniband_partition_add (NM_PLATFORM_GET, parent_ifindex, p_key, out_plink); plerr = nm_platform_link_infiniband_add (NM_PLATFORM_GET, parent_ifindex, p_key, out_plink);
if (plerr != NM_PLATFORM_ERROR_SUCCESS && plerr != NM_PLATFORM_ERROR_EXISTS) { if (plerr != NM_PLATFORM_ERROR_SUCCESS && plerr != NM_PLATFORM_ERROR_EXISTS) {
g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_CREATION_FAILED, g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_CREATION_FAILED,
"Failed to create InfiniBand P_Key interface '%s' for '%s': %s", "Failed to create InfiniBand P_Key interface '%s' for '%s': %s",

View File

@@ -68,7 +68,7 @@ reload_tun_properties (NMDeviceTun *self)
ifindex = nm_device_get_ifindex (NM_DEVICE (self)); ifindex = nm_device_get_ifindex (NM_DEVICE (self));
if (ifindex > 0) { if (ifindex > 0) {
if (!nm_platform_tun_get_properties (NM_PLATFORM_GET, ifindex, &props)) { if (!nm_platform_link_tun_get_properties (NM_PLATFORM_GET, ifindex, &props)) {
_LOGD (LOGD_DEVICE, "tun-properties: cannot loading tun properties from platform for ifindex %d", ifindex); _LOGD (LOGD_DEVICE, "tun-properties: cannot loading tun properties from platform for ifindex %d", ifindex);
ifindex = 0; ifindex = 0;
} else if (g_strcmp0 (priv->mode, props.mode) != 0) { } else if (g_strcmp0 (priv->mode, props.mode) != 0) {
@@ -162,7 +162,7 @@ update_connection (NMDevice *device, NMConnection *connection)
nm_connection_add_setting (connection, (NMSetting *) s_tun); nm_connection_add_setting (connection, (NMSetting *) s_tun);
} }
if (!nm_platform_tun_get_properties (NM_PLATFORM_GET, nm_device_get_ifindex (device), &props)) { if (!nm_platform_link_tun_get_properties (NM_PLATFORM_GET, nm_device_get_ifindex (device), &props)) {
_LOGW (LOGD_HW, "failed to get TUN interface info while updating connection."); _LOGW (LOGD_HW, "failed to get TUN interface info while updating connection.");
return; return;
} }
@@ -213,13 +213,13 @@ create_and_realize (NMDevice *device,
user = _nm_utils_ascii_str_to_int64 (nm_setting_tun_get_owner (s_tun), 10, 0, G_MAXINT32, -1); user = _nm_utils_ascii_str_to_int64 (nm_setting_tun_get_owner (s_tun), 10, 0, G_MAXINT32, -1);
group = _nm_utils_ascii_str_to_int64 (nm_setting_tun_get_group (s_tun), 10, 0, G_MAXINT32, -1); group = _nm_utils_ascii_str_to_int64 (nm_setting_tun_get_group (s_tun), 10, 0, G_MAXINT32, -1);
plerr = nm_platform_tun_add (NM_PLATFORM_GET, iface, plerr = nm_platform_link_tun_add (NM_PLATFORM_GET, iface,
nm_setting_tun_get_mode (s_tun) == NM_SETTING_TUN_MODE_TAP, nm_setting_tun_get_mode (s_tun) == NM_SETTING_TUN_MODE_TAP,
user, group, user, group,
nm_setting_tun_get_pi (s_tun), nm_setting_tun_get_pi (s_tun),
nm_setting_tun_get_vnet_hdr (s_tun), nm_setting_tun_get_vnet_hdr (s_tun),
nm_setting_tun_get_multi_queue (s_tun), nm_setting_tun_get_multi_queue (s_tun),
out_plink); out_plink);
if (plerr != NM_PLATFORM_ERROR_SUCCESS && plerr != NM_PLATFORM_ERROR_EXISTS) { if (plerr != NM_PLATFORM_ERROR_SUCCESS && plerr != NM_PLATFORM_ERROR_EXISTS) {
g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_CREATION_FAILED, g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_CREATION_FAILED,
"Failed to create TUN/TAP interface '%s' for '%s': %s", "Failed to create TUN/TAP interface '%s' for '%s': %s",

View File

@@ -81,7 +81,7 @@ get_peer (NMDeviceVeth *self)
if (priv->ever_had_peer) if (priv->ever_had_peer)
return priv->peer; return priv->peer;
if (!nm_platform_veth_get_properties (NM_PLATFORM_GET, nm_device_get_ifindex (device), &peer_ifindex)) { if (!nm_platform_link_veth_get_properties (NM_PLATFORM_GET, nm_device_get_ifindex (device), &peer_ifindex)) {
_LOGW (LOGD_HW, "could not read veth properties"); _LOGW (LOGD_HW, "could not read veth properties");
return NULL; return NULL;
} }

View File

@@ -232,12 +232,12 @@ create_and_realize (NMDevice *device,
vlan_id = nm_setting_vlan_get_id (s_vlan); vlan_id = nm_setting_vlan_get_id (s_vlan);
plerr = nm_platform_vlan_add (NM_PLATFORM_GET, plerr = nm_platform_link_vlan_add (NM_PLATFORM_GET,
iface, iface,
parent_ifindex, parent_ifindex,
vlan_id, vlan_id,
nm_setting_vlan_get_flags (s_vlan), nm_setting_vlan_get_flags (s_vlan),
out_plink); out_plink);
if (plerr != NM_PLATFORM_ERROR_SUCCESS && plerr != NM_PLATFORM_ERROR_EXISTS) { if (plerr != NM_PLATFORM_ERROR_SUCCESS && plerr != NM_PLATFORM_ERROR_EXISTS) {
g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_CREATION_FAILED, g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_CREATION_FAILED,
"Failed to create VLAN interface '%s' for '%s': %s", "Failed to create VLAN interface '%s' for '%s': %s",

View File

@@ -679,7 +679,7 @@ create_and_realize (NMDevice *device,
const char *iface = nm_device_get_iface (device); const char *iface = nm_device_get_iface (device);
NMPlatformError plerr; NMPlatformError plerr;
plerr = nm_platform_team_add (NM_PLATFORM_GET, iface, out_plink); plerr = nm_platform_link_team_add (NM_PLATFORM_GET, iface, out_plink);
if (plerr != NM_PLATFORM_ERROR_SUCCESS && plerr != NM_PLATFORM_ERROR_EXISTS) { if (plerr != NM_PLATFORM_ERROR_SUCCESS && plerr != NM_PLATFORM_ERROR_EXISTS) {
g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_CREATION_FAILED, g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_CREATION_FAILED,
"Failed to create team master interface '%s' for '%s': %s", "Failed to create team master interface '%s' for '%s': %s",

View File

@@ -618,7 +618,7 @@ _linktype_get_type (NMPlatform *platform,
NMPlatformTunProperties props; NMPlatformTunProperties props;
if ( platform if ( platform
&& nm_platform_tun_get_properties_ifname (platform, ifname, &props)) { && nm_platform_link_tun_get_properties_ifname (platform, ifname, &props)) {
if (!g_strcmp0 (props.mode, "tap")) if (!g_strcmp0 (props.mode, "tap"))
return NM_LINK_TYPE_TAP; return NM_LINK_TYPE_TAP;
if (!g_strcmp0 (props.mode, "tun")) if (!g_strcmp0 (props.mode, "tun"))

View File

@@ -642,7 +642,7 @@ nm_platform_link_add (NMPlatform *self,
} }
/** /**
* nm_platform_dummy_add: * nm_platform_link_dummy_add:
* @self: platform instance * @self: platform instance
* @name: New interface name * @name: New interface name
* @out_link: on success, the link object * @out_link: on success, the link object
@@ -650,7 +650,7 @@ nm_platform_link_add (NMPlatform *self,
* Create a software ethernet-like interface * Create a software ethernet-like interface
*/ */
NMPlatformError NMPlatformError
nm_platform_dummy_add (NMPlatform *self, const char *name, const NMPlatformLink **out_link) nm_platform_link_dummy_add (NMPlatform *self, const char *name, const NMPlatformLink **out_link)
{ {
return nm_platform_link_add (self, name, NM_LINK_TYPE_DUMMY, NULL, 0, out_link); return nm_platform_link_add (self, name, NM_LINK_TYPE_DUMMY, NULL, 0, out_link);
} }
@@ -1476,7 +1476,7 @@ nm_platform_link_get_lnk_vxlan (NMPlatform *self, int ifindex, const NMPlatformL
/*****************************************************************************/ /*****************************************************************************/
/** /**
* nm_platform_bridge_add: * nm_platform_link_bridge_add:
* @self: platform instance * @self: platform instance
* @name: New interface name * @name: New interface name
* @address: (allow-none): set the mac address of the new bridge * @address: (allow-none): set the mac address of the new bridge
@@ -1486,17 +1486,17 @@ nm_platform_link_get_lnk_vxlan (NMPlatform *self, int ifindex, const NMPlatformL
* Create a software bridge. * Create a software bridge.
*/ */
NMPlatformError NMPlatformError
nm_platform_bridge_add (NMPlatform *self, nm_platform_link_bridge_add (NMPlatform *self,
const char *name, const char *name,
const void *address, const void *address,
size_t address_len, size_t address_len,
const NMPlatformLink **out_link) const NMPlatformLink **out_link)
{ {
return nm_platform_link_add (self, name, NM_LINK_TYPE_BRIDGE, address, address_len, out_link); return nm_platform_link_add (self, name, NM_LINK_TYPE_BRIDGE, address, address_len, out_link);
} }
/** /**
* nm_platform_bond_add: * nm_platform_link_bond_add:
* @self: platform instance * @self: platform instance
* @name: New interface name * @name: New interface name
* @out_link: on success, the link object * @out_link: on success, the link object
@@ -1504,13 +1504,13 @@ nm_platform_bridge_add (NMPlatform *self,
* Create a software bonding device. * Create a software bonding device.
*/ */
NMPlatformError NMPlatformError
nm_platform_bond_add (NMPlatform *self, const char *name, const NMPlatformLink **out_link) nm_platform_link_bond_add (NMPlatform *self, const char *name, const NMPlatformLink **out_link)
{ {
return nm_platform_link_add (self, name, NM_LINK_TYPE_BOND, NULL, 0, out_link); return nm_platform_link_add (self, name, NM_LINK_TYPE_BOND, NULL, 0, out_link);
} }
/** /**
* nm_platform_team_add: * nm_platform_link_team_add:
* @self: platform instance * @self: platform instance
* @name: New interface name * @name: New interface name
* @out_link: on success, the link object * @out_link: on success, the link object
@@ -1518,13 +1518,13 @@ nm_platform_bond_add (NMPlatform *self, const char *name, const NMPlatformLink *
* Create a software teaming device. * Create a software teaming device.
*/ */
NMPlatformError NMPlatformError
nm_platform_team_add (NMPlatform *self, const char *name, const NMPlatformLink **out_link) nm_platform_link_team_add (NMPlatform *self, const char *name, const NMPlatformLink **out_link)
{ {
return nm_platform_link_add (self, name, NM_LINK_TYPE_TEAM, NULL, 0, out_link); return nm_platform_link_add (self, name, NM_LINK_TYPE_TEAM, NULL, 0, out_link);
} }
/** /**
* nm_platform_vlan_add: * nm_platform_link_vlan_add:
* @self: platform instance * @self: platform instance
* @name: New interface name * @name: New interface name
* @vlanid: VLAN identifier * @vlanid: VLAN identifier
@@ -1534,7 +1534,7 @@ nm_platform_team_add (NMPlatform *self, const char *name, const NMPlatformLink *
* Create a software VLAN device. * Create a software VLAN device.
*/ */
NMPlatformError NMPlatformError
nm_platform_vlan_add (NMPlatform *self, nm_platform_link_vlan_add (NMPlatform *self,
const char *name, const char *name,
int parent, int parent,
int vlanid, int vlanid,
@@ -1594,7 +1594,7 @@ nm_platform_link_vxlan_add (NMPlatform *self,
} }
/** /**
* nm_platform_tun_add: * nm_platform_link_tun_add:
* @self: platform instance * @self: platform instance
* @name: new interface name * @name: new interface name
* @tap: whether the interface is a TAP * @tap: whether the interface is a TAP
@@ -1608,9 +1608,15 @@ nm_platform_link_vxlan_add (NMPlatform *self,
* Create a TUN or TAP interface. * Create a TUN or TAP interface.
*/ */
NMPlatformError NMPlatformError
nm_platform_tun_add (NMPlatform *self, const char *name, gboolean tap, nm_platform_link_tun_add (NMPlatform *self,
gint64 owner, gint64 group, gboolean pi, gboolean vnet_hdr, const char *name,
gboolean multi_queue, const NMPlatformLink **out_link) gboolean tap,
gint64 owner,
gint64 group,
gboolean pi,
gboolean vnet_hdr,
gboolean multi_queue,
const NMPlatformLink **out_link)
{ {
NMPlatformError plerr; NMPlatformError plerr;
@@ -1747,7 +1753,7 @@ nm_platform_link_vlan_change (NMPlatform *self,
} }
gboolean gboolean
nm_platform_vlan_set_ingress_map (NMPlatform *self, int ifindex, int from, int to) nm_platform_link_vlan_set_ingress_map (NMPlatform *self, int ifindex, int from, int to)
{ {
NMVlanQosMapping map = { NMVlanQosMapping map = {
.from = from, .from = from,
@@ -1758,7 +1764,7 @@ nm_platform_vlan_set_ingress_map (NMPlatform *self, int ifindex, int from, int t
} }
gboolean gboolean
nm_platform_vlan_set_egress_map (NMPlatform *self, int ifindex, int from, int to) nm_platform_link_vlan_set_egress_map (NMPlatform *self, int ifindex, int from, int to)
{ {
NMVlanQosMapping map = { NMVlanQosMapping map = {
.from = from, .from = from,
@@ -1808,7 +1814,7 @@ nm_platform_link_gre_add (NMPlatform *self,
} }
NMPlatformError NMPlatformError
nm_platform_infiniband_partition_add (NMPlatform *self, int parent, int p_key, const NMPlatformLink **out_link) nm_platform_link_infiniband_add (NMPlatform *self, int parent, int p_key, const NMPlatformLink **out_link)
{ {
gs_free char *parent_name = NULL; gs_free char *parent_name = NULL;
gs_free char *name = NULL; gs_free char *name = NULL;
@@ -1838,11 +1844,11 @@ nm_platform_infiniband_partition_add (NMPlatform *self, int parent, int p_key, c
} }
gboolean gboolean
nm_platform_infiniband_get_properties (NMPlatform *self, nm_platform_link_infiniband_get_properties (NMPlatform *self,
int ifindex, int ifindex,
int *out_parent, int *out_parent,
int *out_p_key, int *out_p_key,
const char **out_mode) const char **out_mode)
{ {
const NMPlatformLnkInfiniband *plnk; const NMPlatformLnkInfiniband *plnk;
const NMPlatformLink *plink; const NMPlatformLink *plink;
@@ -2063,7 +2069,7 @@ nm_platform_link_sit_add (NMPlatform *self,
} }
gboolean gboolean
nm_platform_veth_get_properties (NMPlatform *self, int ifindex, int *out_peer_ifindex) nm_platform_link_veth_get_properties (NMPlatform *self, int ifindex, int *out_peer_ifindex)
{ {
const NMPlatformLink *plink; const NMPlatformLink *plink;
int peer_ifindex; int peer_ifindex;
@@ -2093,7 +2099,7 @@ nm_platform_veth_get_properties (NMPlatform *self, int ifindex, int *out_peer_if
} }
gboolean gboolean
nm_platform_tun_get_properties_ifname (NMPlatform *self, const char *ifname, NMPlatformTunProperties *props) nm_platform_link_tun_get_properties_ifname (NMPlatform *self, const char *ifname, NMPlatformTunProperties *props)
{ {
char *path, *val; char *path, *val;
gboolean success = TRUE; gboolean success = TRUE;
@@ -2154,14 +2160,14 @@ nm_platform_tun_get_properties_ifname (NMPlatform *self, const char *ifname, NMP
} }
gboolean gboolean
nm_platform_tun_get_properties (NMPlatform *self, int ifindex, NMPlatformTunProperties *props) nm_platform_link_tun_get_properties (NMPlatform *self, int ifindex, NMPlatformTunProperties *props)
{ {
_CHECK_SELF (self, klass, FALSE); _CHECK_SELF (self, klass, FALSE);
g_return_val_if_fail (ifindex > 0, FALSE); g_return_val_if_fail (ifindex > 0, FALSE);
g_return_val_if_fail (props != NULL, FALSE); g_return_val_if_fail (props != NULL, FALSE);
return nm_platform_tun_get_properties_ifname (self, nm_platform_link_get_name (self, ifindex), props); return nm_platform_link_tun_get_properties_ifname (self, nm_platform_link_get_name (self, ifindex), props);
} }
gboolean gboolean

View File

@@ -700,10 +700,10 @@ const NMPlatformLink *nm_platform_link_get_by_ifname (NMPlatform *self, const ch
const NMPlatformLink *nm_platform_link_get_by_address (NMPlatform *self, gconstpointer address, size_t length); const NMPlatformLink *nm_platform_link_get_by_address (NMPlatform *self, gconstpointer address, size_t length);
GArray *nm_platform_link_get_all (NMPlatform *self); GArray *nm_platform_link_get_all (NMPlatform *self);
NMPlatformError nm_platform_dummy_add (NMPlatform *self, const char *name, const NMPlatformLink **out_link); NMPlatformError nm_platform_link_dummy_add (NMPlatform *self, const char *name, const NMPlatformLink **out_link);
NMPlatformError nm_platform_bridge_add (NMPlatform *self, const char *name, const void *address, size_t address_len, const NMPlatformLink **out_link); NMPlatformError nm_platform_link_bridge_add (NMPlatform *self, const char *name, const void *address, size_t address_len, const NMPlatformLink **out_link);
NMPlatformError nm_platform_bond_add (NMPlatform *self, const char *name, const NMPlatformLink **out_link); NMPlatformError nm_platform_link_bond_add (NMPlatform *self, const char *name, const NMPlatformLink **out_link);
NMPlatformError nm_platform_team_add (NMPlatform *self, const char *name, const NMPlatformLink **out_link); NMPlatformError nm_platform_link_team_add (NMPlatform *self, const char *name, const NMPlatformLink **out_link);
gboolean nm_platform_link_delete (NMPlatform *self, int ifindex); gboolean nm_platform_link_delete (NMPlatform *self, int ifindex);
/* convienience methods to lookup the link and access fields of NMPlatformLink. */ /* convienience methods to lookup the link and access fields of NMPlatformLink. */
@@ -756,6 +756,7 @@ gboolean nm_platform_link_supports_vlans (NMPlatform *self, int ifindex);
gboolean nm_platform_link_enslave (NMPlatform *self, int master, int slave); gboolean nm_platform_link_enslave (NMPlatform *self, int master, int slave);
gboolean nm_platform_link_release (NMPlatform *self, int master, int slave); gboolean nm_platform_link_release (NMPlatform *self, int master, int slave);
gboolean nm_platform_master_set_option (NMPlatform *self, int ifindex, const char *option, const char *value); gboolean nm_platform_master_set_option (NMPlatform *self, int ifindex, const char *option, const char *value);
char *nm_platform_master_get_option (NMPlatform *self, int ifindex, const char *option); char *nm_platform_master_get_option (NMPlatform *self, int ifindex, const char *option);
gboolean nm_platform_slave_set_option (NMPlatform *self, int ifindex, const char *option, const char *value); gboolean nm_platform_slave_set_option (NMPlatform *self, int ifindex, const char *option, const char *value);
@@ -773,9 +774,9 @@ const NMPlatformLnkSit *nm_platform_link_get_lnk_sit (NMPlatform *self, int ifin
const NMPlatformLnkVlan *nm_platform_link_get_lnk_vlan (NMPlatform *self, int ifindex, const NMPlatformLink **out_link); const NMPlatformLnkVlan *nm_platform_link_get_lnk_vlan (NMPlatform *self, int ifindex, const NMPlatformLink **out_link);
const NMPlatformLnkVxlan *nm_platform_link_get_lnk_vxlan (NMPlatform *self, int ifindex, const NMPlatformLink **out_link); const NMPlatformLnkVxlan *nm_platform_link_get_lnk_vxlan (NMPlatform *self, int ifindex, const NMPlatformLink **out_link);
NMPlatformError nm_platform_vlan_add (NMPlatform *self, const char *name, int parent, int vlanid, guint32 vlanflags, const NMPlatformLink **out_link); NMPlatformError nm_platform_link_vlan_add (NMPlatform *self, const char *name, int parent, int vlanid, guint32 vlanflags, const NMPlatformLink **out_link);
gboolean nm_platform_vlan_set_ingress_map (NMPlatform *self, int ifindex, int from, int to); gboolean nm_platform_link_vlan_set_ingress_map (NMPlatform *self, int ifindex, int from, int to);
gboolean nm_platform_vlan_set_egress_map (NMPlatform *self, int ifindex, int from, int to); gboolean nm_platform_link_vlan_set_egress_map (NMPlatform *self, int ifindex, int from, int to);
gboolean nm_platform_link_vlan_change (NMPlatform *self, gboolean nm_platform_link_vlan_change (NMPlatform *self,
int ifindex, int ifindex,
NMVlanFlags flags_mask, NMVlanFlags flags_mask,
@@ -789,16 +790,23 @@ gboolean nm_platform_link_vlan_change (NMPlatform *self,
NMPlatformError nm_platform_link_vxlan_add (NMPlatform *self, const char *name, NMPlatformLnkVxlan *props, const NMPlatformLink **out_link); NMPlatformError nm_platform_link_vxlan_add (NMPlatform *self, const char *name, NMPlatformLnkVxlan *props, const NMPlatformLink **out_link);
NMPlatformError nm_platform_tun_add (NMPlatform *self, const char *name, gboolean tap, gint64 owner, gint64 group, gboolean pi, NMPlatformError nm_platform_link_tun_add (NMPlatform *self,
gboolean vnet_hdr, gboolean multi_queue, const NMPlatformLink **out_link); const char *name,
gboolean tap,
gint64 owner,
gint64 group,
gboolean pi,
gboolean vnet_hdr,
gboolean multi_queue,
const NMPlatformLink **out_link);
NMPlatformError nm_platform_infiniband_partition_add (NMPlatform *self, int parent, int p_key, const NMPlatformLink **out_link); NMPlatformError nm_platform_link_infiniband_add (NMPlatform *self, int parent, int p_key, const NMPlatformLink **out_link);
gboolean nm_platform_infiniband_get_properties (NMPlatform *self, int ifindex, int *parent, int *p_key, const char **mode); gboolean nm_platform_link_infiniband_get_properties (NMPlatform *self, int ifindex, int *parent, int *p_key, const char **mode);
gboolean nm_platform_veth_get_properties (NMPlatform *self, int ifindex, int *out_peer_ifindex); gboolean nm_platform_link_veth_get_properties (NMPlatform *self, int ifindex, int *out_peer_ifindex);
gboolean nm_platform_tun_get_properties (NMPlatform *self, int ifindex, NMPlatformTunProperties *properties); gboolean nm_platform_link_tun_get_properties (NMPlatform *self, int ifindex, NMPlatformTunProperties *properties);
gboolean nm_platform_tun_get_properties_ifname (NMPlatform *platform, const char *ifname, NMPlatformTunProperties *props); gboolean nm_platform_link_tun_get_properties_ifname (NMPlatform *platform, const char *ifname, NMPlatformTunProperties *props);
gboolean nm_platform_wifi_get_capabilities (NMPlatform *self, int ifindex, NMDeviceWifiCapabilities *caps); gboolean nm_platform_wifi_get_capabilities (NMPlatform *self, int ifindex, NMDeviceWifiCapabilities *caps);
gboolean nm_platform_wifi_get_bssid (NMPlatform *self, int ifindex, guint8 *bssid); gboolean nm_platform_wifi_get_bssid (NMPlatform *self, int ifindex, guint8 *bssid);

View File

@@ -354,7 +354,7 @@ _g_test_run (gconstpointer user_data)
nm_platform_link_delete (NM_PLATFORM_GET, nm_platform_link_get_ifindex (NM_PLATFORM_GET, DEVICE_NAME)); nm_platform_link_delete (NM_PLATFORM_GET, nm_platform_link_get_ifindex (NM_PLATFORM_GET, DEVICE_NAME));
g_assert (!nm_platform_link_get_by_ifname (NM_PLATFORM_GET, DEVICE_NAME)); g_assert (!nm_platform_link_get_by_ifname (NM_PLATFORM_GET, DEVICE_NAME));
g_assert_cmpint (nm_platform_dummy_add (NM_PLATFORM_GET, DEVICE_NAME, NULL), ==, NM_PLATFORM_ERROR_SUCCESS); g_assert_cmpint (nm_platform_link_dummy_add (NM_PLATFORM_GET, DEVICE_NAME, NULL), ==, NM_PLATFORM_ERROR_SUCCESS);
ifindex = nm_platform_link_get_ifindex (NM_PLATFORM_GET, DEVICE_NAME); ifindex = nm_platform_link_get_ifindex (NM_PLATFORM_GET, DEVICE_NAME);
g_assert_cmpint (ifindex, >, 0); g_assert_cmpint (ifindex, >, 0);

View File

@@ -35,7 +35,7 @@ test_cleanup_internal (void)
inet_pton (AF_INET6, "2001:db8:e:f:1:2:3:4", &gateway6); inet_pton (AF_INET6, "2001:db8:e:f:1:2:3:4", &gateway6);
/* Create and set up device */ /* Create and set up device */
g_assert (nm_platform_dummy_add (NM_PLATFORM_GET, DEVICE_NAME, NULL) == NM_PLATFORM_ERROR_SUCCESS); g_assert (nm_platform_link_dummy_add (NM_PLATFORM_GET, DEVICE_NAME, NULL) == NM_PLATFORM_ERROR_SUCCESS);
accept_signal (link_added); accept_signal (link_added);
free_signal (link_added); free_signal (link_added);
g_assert (nm_platform_link_set_up (NM_PLATFORM_GET, nm_platform_link_get_ifindex (NM_PLATFORM_GET, DEVICE_NAME), NULL)); g_assert (nm_platform_link_set_up (NM_PLATFORM_GET, nm_platform_link_get_ifindex (NM_PLATFORM_GET, DEVICE_NAME), NULL));

View File

@@ -61,8 +61,8 @@ test_bogus(void)
g_assert (!nm_platform_link_supports_vlans (NM_PLATFORM_GET, BOGUS_IFINDEX)); g_assert (!nm_platform_link_supports_vlans (NM_PLATFORM_GET, BOGUS_IFINDEX));
g_assert (!nm_platform_link_get_lnk_vlan (NM_PLATFORM_GET, BOGUS_IFINDEX, NULL)); g_assert (!nm_platform_link_get_lnk_vlan (NM_PLATFORM_GET, BOGUS_IFINDEX, NULL));
g_assert (!nm_platform_vlan_set_ingress_map (NM_PLATFORM_GET, BOGUS_IFINDEX, 0, 0)); g_assert (!nm_platform_link_vlan_set_ingress_map (NM_PLATFORM_GET, BOGUS_IFINDEX, 0, 0));
g_assert (!nm_platform_vlan_set_egress_map (NM_PLATFORM_GET, BOGUS_IFINDEX, 0, 0)); g_assert (!nm_platform_link_vlan_set_egress_map (NM_PLATFORM_GET, BOGUS_IFINDEX, 0, 0));
} }
static void static void
@@ -83,15 +83,15 @@ software_add (NMLinkType link_type, const char *name)
{ {
switch (link_type) { switch (link_type) {
case NM_LINK_TYPE_DUMMY: case NM_LINK_TYPE_DUMMY:
return nm_platform_dummy_add (NM_PLATFORM_GET, name, NULL) == NM_PLATFORM_ERROR_SUCCESS; return nm_platform_link_dummy_add (NM_PLATFORM_GET, name, NULL) == NM_PLATFORM_ERROR_SUCCESS;
case NM_LINK_TYPE_BRIDGE: case NM_LINK_TYPE_BRIDGE:
return nm_platform_bridge_add (NM_PLATFORM_GET, name, NULL, 0, NULL) == NM_PLATFORM_ERROR_SUCCESS; return nm_platform_link_bridge_add (NM_PLATFORM_GET, name, NULL, 0, NULL) == NM_PLATFORM_ERROR_SUCCESS;
case NM_LINK_TYPE_BOND: case NM_LINK_TYPE_BOND:
{ {
gboolean bond0_exists = !!nm_platform_link_get_by_ifname (NM_PLATFORM_GET, "bond0"); gboolean bond0_exists = !!nm_platform_link_get_by_ifname (NM_PLATFORM_GET, "bond0");
NMPlatformError plerr; NMPlatformError plerr;
plerr = nm_platform_bond_add (NM_PLATFORM_GET, name, NULL); plerr = nm_platform_link_bond_add (NM_PLATFORM_GET, name, NULL);
/* Check that bond0 is *not* automatically created. */ /* Check that bond0 is *not* automatically created. */
if (!bond0_exists) if (!bond0_exists)
@@ -99,14 +99,14 @@ software_add (NMLinkType link_type, const char *name)
return plerr == NM_PLATFORM_ERROR_SUCCESS; return plerr == NM_PLATFORM_ERROR_SUCCESS;
} }
case NM_LINK_TYPE_TEAM: case NM_LINK_TYPE_TEAM:
return nm_platform_team_add (NM_PLATFORM_GET, name, NULL) == NM_PLATFORM_ERROR_SUCCESS; return nm_platform_link_team_add (NM_PLATFORM_GET, name, NULL) == NM_PLATFORM_ERROR_SUCCESS;
case NM_LINK_TYPE_VLAN: { case NM_LINK_TYPE_VLAN: {
SignalData *parent_added; SignalData *parent_added;
SignalData *parent_changed; SignalData *parent_changed;
/* Don't call link_callback for the bridge interface */ /* Don't call link_callback for the bridge interface */
parent_added = add_signal_ifname (NM_PLATFORM_SIGNAL_LINK_CHANGED, NM_PLATFORM_SIGNAL_ADDED, link_callback, PARENT_NAME); parent_added = add_signal_ifname (NM_PLATFORM_SIGNAL_LINK_CHANGED, NM_PLATFORM_SIGNAL_ADDED, link_callback, PARENT_NAME);
if (nm_platform_bridge_add (NM_PLATFORM_GET, PARENT_NAME, NULL, 0, NULL) == NM_PLATFORM_ERROR_SUCCESS) if (nm_platform_link_bridge_add (NM_PLATFORM_GET, PARENT_NAME, NULL, 0, NULL) == NM_PLATFORM_ERROR_SUCCESS)
accept_signal (parent_added); accept_signal (parent_added);
free_signal (parent_added); free_signal (parent_added);
@@ -123,7 +123,7 @@ software_add (NMLinkType link_type, const char *name)
accept_signal (parent_changed); accept_signal (parent_changed);
free_signal (parent_changed); free_signal (parent_changed);
return nm_platform_vlan_add (NM_PLATFORM_GET, name, parent_ifindex, VLAN_ID, 0, NULL) == NM_PLATFORM_ERROR_SUCCESS; return nm_platform_link_vlan_add (NM_PLATFORM_GET, name, parent_ifindex, VLAN_ID, 0, NULL) == NM_PLATFORM_ERROR_SUCCESS;
} }
} }
default: default:
@@ -466,7 +466,7 @@ test_bridge_addr (void)
nm_utils_hwaddr_aton ("de:ad:be:ef:00:11", addr, sizeof (addr)); nm_utils_hwaddr_aton ("de:ad:be:ef:00:11", addr, sizeof (addr));
g_assert_cmpint (nm_platform_bridge_add (NM_PLATFORM_GET, DEVICE_NAME, addr, sizeof (addr), &plink), ==, NM_PLATFORM_ERROR_SUCCESS); g_assert_cmpint (nm_platform_link_bridge_add (NM_PLATFORM_GET, DEVICE_NAME, addr, sizeof (addr), &plink), ==, NM_PLATFORM_ERROR_SUCCESS);
g_assert (plink); g_assert (plink);
link = *plink; link = *plink;
g_assert_cmpstr (link.name, ==, DEVICE_NAME); g_assert_cmpstr (link.name, ==, DEVICE_NAME);
@@ -518,11 +518,11 @@ test_internal (void)
g_assert (!nm_platform_link_get_ifindex (NM_PLATFORM_GET, DEVICE_NAME)); g_assert (!nm_platform_link_get_ifindex (NM_PLATFORM_GET, DEVICE_NAME));
/* Add device */ /* Add device */
g_assert (nm_platform_dummy_add (NM_PLATFORM_GET, DEVICE_NAME, NULL) == NM_PLATFORM_ERROR_SUCCESS); g_assert (nm_platform_link_dummy_add (NM_PLATFORM_GET, DEVICE_NAME, NULL) == NM_PLATFORM_ERROR_SUCCESS);
accept_signal (link_added); accept_signal (link_added);
/* Try to add again */ /* Try to add again */
g_assert (nm_platform_dummy_add (NM_PLATFORM_GET, DEVICE_NAME, NULL) == NM_PLATFORM_ERROR_EXISTS); g_assert (nm_platform_link_dummy_add (NM_PLATFORM_GET, DEVICE_NAME, NULL) == NM_PLATFORM_ERROR_EXISTS);
/* Check device index, name and type */ /* Check device index, name and type */
ifindex = nm_platform_link_get_ifindex (NM_PLATFORM_GET, DEVICE_NAME); ifindex = nm_platform_link_get_ifindex (NM_PLATFORM_GET, DEVICE_NAME);
@@ -1092,58 +1092,58 @@ test_vlan_set_xgress (void)
/* ingress-qos-map */ /* ingress-qos-map */
g_assert (nm_platform_vlan_set_ingress_map (NM_PLATFORM_GET, ifindex, 4, 5)); g_assert (nm_platform_link_vlan_set_ingress_map (NM_PLATFORM_GET, ifindex, 4, 5));
_assert_ingress_qos_mappings (ifindex, 1, _assert_ingress_qos_mappings (ifindex, 1,
4, 5); 4, 5);
g_assert (nm_platform_vlan_set_ingress_map (NM_PLATFORM_GET, ifindex, 3, 7)); g_assert (nm_platform_link_vlan_set_ingress_map (NM_PLATFORM_GET, ifindex, 3, 7));
_assert_ingress_qos_mappings (ifindex, 2, _assert_ingress_qos_mappings (ifindex, 2,
3, 7, 3, 7,
4, 5); 4, 5);
g_assert (nm_platform_vlan_set_ingress_map (NM_PLATFORM_GET, ifindex, 3, 8)); g_assert (nm_platform_link_vlan_set_ingress_map (NM_PLATFORM_GET, ifindex, 3, 8));
_assert_ingress_qos_mappings (ifindex, 2, _assert_ingress_qos_mappings (ifindex, 2,
3, 8, 3, 8,
4, 5); 4, 5);
g_assert (nm_platform_vlan_set_ingress_map (NM_PLATFORM_GET, ifindex, 0, 4)); g_assert (nm_platform_link_vlan_set_ingress_map (NM_PLATFORM_GET, ifindex, 0, 4));
_assert_ingress_qos_mappings (ifindex, 3, _assert_ingress_qos_mappings (ifindex, 3,
0, 4, 0, 4,
3, 8, 3, 8,
4, 5); 4, 5);
g_assert (nm_platform_vlan_set_ingress_map (NM_PLATFORM_GET, ifindex, 0, G_MAXUINT32)); g_assert (nm_platform_link_vlan_set_ingress_map (NM_PLATFORM_GET, ifindex, 0, G_MAXUINT32));
_assert_ingress_qos_mappings (ifindex, 3, _assert_ingress_qos_mappings (ifindex, 3,
0, G_MAXUINT32, 0, G_MAXUINT32,
3, 8, 3, 8,
4, 5); 4, 5);
g_assert (nm_platform_vlan_set_ingress_map (NM_PLATFORM_GET, ifindex, 0, G_MAXUINT32 - 1)); g_assert (nm_platform_link_vlan_set_ingress_map (NM_PLATFORM_GET, ifindex, 0, G_MAXUINT32 - 1));
_assert_ingress_qos_mappings (ifindex, 3, _assert_ingress_qos_mappings (ifindex, 3,
0, G_MAXUINT32 - 1, 0, G_MAXUINT32 - 1,
3, 8, 3, 8,
4, 5); 4, 5);
g_assert (nm_platform_vlan_set_ingress_map (NM_PLATFORM_GET, ifindex, 0, 5)); g_assert (nm_platform_link_vlan_set_ingress_map (NM_PLATFORM_GET, ifindex, 0, 5));
_assert_ingress_qos_mappings (ifindex, 3, _assert_ingress_qos_mappings (ifindex, 3,
0, 5, 0, 5,
3, 8, 3, 8,
4, 5); 4, 5);
g_assert (nm_platform_vlan_set_ingress_map (NM_PLATFORM_GET, ifindex, 0, 5)); g_assert (nm_platform_link_vlan_set_ingress_map (NM_PLATFORM_GET, ifindex, 0, 5));
_assert_ingress_qos_mappings (ifindex, 3, _assert_ingress_qos_mappings (ifindex, 3,
0, 5, 0, 5,
3, 8, 3, 8,
4, 5); 4, 5);
/* Set invalid values: */ /* Set invalid values: */
g_assert (nm_platform_vlan_set_ingress_map (NM_PLATFORM_GET, ifindex, 8, 3)); g_assert (nm_platform_link_vlan_set_ingress_map (NM_PLATFORM_GET, ifindex, 8, 3));
_assert_ingress_qos_mappings (ifindex, 3, _assert_ingress_qos_mappings (ifindex, 3,
0, 5, 0, 5,
3, 8, 3, 8,
4, 5); 4, 5);
g_assert (nm_platform_vlan_set_ingress_map (NM_PLATFORM_GET, ifindex, 9, 4)); g_assert (nm_platform_link_vlan_set_ingress_map (NM_PLATFORM_GET, ifindex, 9, 4));
_assert_ingress_qos_mappings (ifindex, 3, _assert_ingress_qos_mappings (ifindex, 3,
0, 5, 0, 5,
3, 8, 3, 8,
@@ -1151,36 +1151,36 @@ test_vlan_set_xgress (void)
/* egress-qos-map */ /* egress-qos-map */
g_assert (nm_platform_vlan_set_egress_map (NM_PLATFORM_GET, ifindex, 7, 3)); g_assert (nm_platform_link_vlan_set_egress_map (NM_PLATFORM_GET, ifindex, 7, 3));
_assert_egress_qos_mappings (ifindex, 1, _assert_egress_qos_mappings (ifindex, 1,
7, 3); 7, 3);
g_assert (nm_platform_vlan_set_egress_map (NM_PLATFORM_GET, ifindex, 8, 4)); g_assert (nm_platform_link_vlan_set_egress_map (NM_PLATFORM_GET, ifindex, 8, 4));
_assert_egress_qos_mappings (ifindex, 2, _assert_egress_qos_mappings (ifindex, 2,
7, 3, 7, 3,
8, 4); 8, 4);
g_assert (nm_platform_vlan_set_egress_map (NM_PLATFORM_GET, ifindex, 0, 4)); g_assert (nm_platform_link_vlan_set_egress_map (NM_PLATFORM_GET, ifindex, 0, 4));
_assert_egress_qos_mappings (ifindex, 3, _assert_egress_qos_mappings (ifindex, 3,
0, 4, 0, 4,
7, 3, 7, 3,
8, 4); 8, 4);
g_assert (nm_platform_vlan_set_egress_map (NM_PLATFORM_GET, ifindex, 1, 4)); g_assert (nm_platform_link_vlan_set_egress_map (NM_PLATFORM_GET, ifindex, 1, 4));
_assert_egress_qos_mappings (ifindex, 4, _assert_egress_qos_mappings (ifindex, 4,
0, 4, 0, 4,
1, 4, 1, 4,
7, 3, 7, 3,
8, 4); 8, 4);
g_assert (nm_platform_vlan_set_egress_map (NM_PLATFORM_GET, ifindex, 1, 5)); g_assert (nm_platform_link_vlan_set_egress_map (NM_PLATFORM_GET, ifindex, 1, 5));
_assert_egress_qos_mappings (ifindex, 4, _assert_egress_qos_mappings (ifindex, 4,
0, 4, 0, 4,
1, 5, 1, 5,
7, 3, 7, 3,
8, 4); 8, 4);
g_assert (nm_platform_vlan_set_egress_map (NM_PLATFORM_GET, ifindex, 9, 5)); g_assert (nm_platform_link_vlan_set_egress_map (NM_PLATFORM_GET, ifindex, 9, 5));
_assert_egress_qos_mappings (ifindex, 5, _assert_egress_qos_mappings (ifindex, 5,
0, 4, 0, 4,
1, 5, 1, 5,
@@ -1188,7 +1188,7 @@ test_vlan_set_xgress (void)
8, 4, 8, 4,
9, 5); 9, 5);
g_assert (nm_platform_vlan_set_egress_map (NM_PLATFORM_GET, ifindex, 8, 5)); g_assert (nm_platform_link_vlan_set_egress_map (NM_PLATFORM_GET, ifindex, 8, 5));
_assert_egress_qos_mappings (ifindex, 5, _assert_egress_qos_mappings (ifindex, 5,
0, 4, 0, 4,
1, 5, 1, 5,
@@ -1196,27 +1196,27 @@ test_vlan_set_xgress (void)
8, 5, 8, 5,
9, 5); 9, 5);
g_assert (nm_platform_vlan_set_egress_map (NM_PLATFORM_GET, ifindex, 8, 0)); g_assert (nm_platform_link_vlan_set_egress_map (NM_PLATFORM_GET, ifindex, 8, 0));
_assert_egress_qos_mappings (ifindex, 4, _assert_egress_qos_mappings (ifindex, 4,
0, 4, 0, 4,
1, 5, 1, 5,
7, 3, 7, 3,
9, 5); 9, 5);
g_assert (nm_platform_vlan_set_egress_map (NM_PLATFORM_GET, ifindex, 0, 0)); g_assert (nm_platform_link_vlan_set_egress_map (NM_PLATFORM_GET, ifindex, 0, 0));
_assert_egress_qos_mappings (ifindex, 3, _assert_egress_qos_mappings (ifindex, 3,
1, 5, 1, 5,
7, 3, 7, 3,
9, 5); 9, 5);
g_assert (nm_platform_vlan_set_egress_map (NM_PLATFORM_GET, ifindex, 100, 4)); g_assert (nm_platform_link_vlan_set_egress_map (NM_PLATFORM_GET, ifindex, 100, 4));
_assert_egress_qos_mappings (ifindex, 4, _assert_egress_qos_mappings (ifindex, 4,
1, 5, 1, 5,
7, 3, 7, 3,
9, 5, 9, 5,
100, 4); 100, 4);
g_assert (nm_platform_vlan_set_egress_map (NM_PLATFORM_GET, ifindex, G_MAXUINT32, 4)); g_assert (nm_platform_link_vlan_set_egress_map (NM_PLATFORM_GET, ifindex, G_MAXUINT32, 4));
_assert_egress_qos_mappings (ifindex, 5, _assert_egress_qos_mappings (ifindex, 5,
1, 5, 1, 5,
7, 3, 7, 3,
@@ -1224,7 +1224,7 @@ test_vlan_set_xgress (void)
100, 4, 100, 4,
G_MAXUINT32, 4); G_MAXUINT32, 4);
g_assert (nm_platform_vlan_set_egress_map (NM_PLATFORM_GET, ifindex, G_MAXUINT32, 8)); g_assert (nm_platform_link_vlan_set_egress_map (NM_PLATFORM_GET, ifindex, G_MAXUINT32, 8));
_assert_egress_qos_mappings (ifindex, 5, _assert_egress_qos_mappings (ifindex, 5,
1, 5, 1, 5,
7, 3, 7, 3,
@@ -1232,20 +1232,20 @@ test_vlan_set_xgress (void)
100, 4, 100, 4,
G_MAXUINT32, 4); G_MAXUINT32, 4);
g_assert (nm_platform_vlan_set_egress_map (NM_PLATFORM_GET, ifindex, G_MAXUINT32, 0)); g_assert (nm_platform_link_vlan_set_egress_map (NM_PLATFORM_GET, ifindex, G_MAXUINT32, 0));
_assert_egress_qos_mappings (ifindex, 4, _assert_egress_qos_mappings (ifindex, 4,
1, 5, 1, 5,
7, 3, 7, 3,
9, 5, 9, 5,
100, 4); 100, 4);
g_assert (nm_platform_vlan_set_egress_map (NM_PLATFORM_GET, ifindex, 100, 0)); g_assert (nm_platform_link_vlan_set_egress_map (NM_PLATFORM_GET, ifindex, 100, 0));
_assert_egress_qos_mappings (ifindex, 3, _assert_egress_qos_mappings (ifindex, 3,
1, 5, 1, 5,
7, 3, 7, 3,
9, 5); 9, 5);
g_assert (nm_platform_vlan_set_egress_map (NM_PLATFORM_GET, ifindex, 1, 0)); g_assert (nm_platform_link_vlan_set_egress_map (NM_PLATFORM_GET, ifindex, 1, 0));
_assert_egress_qos_mappings (ifindex, 2, _assert_egress_qos_mappings (ifindex, 2,
7, 3, 7, 3,
9, 5); 9, 5);
@@ -1559,11 +1559,11 @@ test_nl_bugs_veth (void)
ifindex_veth0 = nmtstp_assert_wait_for_link (IFACE_VETH0, NM_LINK_TYPE_VETH, 100)->ifindex; ifindex_veth0 = nmtstp_assert_wait_for_link (IFACE_VETH0, NM_LINK_TYPE_VETH, 100)->ifindex;
ifindex_veth1 = nmtstp_assert_wait_for_link (IFACE_VETH1, NM_LINK_TYPE_VETH, 100)->ifindex; ifindex_veth1 = nmtstp_assert_wait_for_link (IFACE_VETH1, NM_LINK_TYPE_VETH, 100)->ifindex;
/* assert that nm_platform_veth_get_properties() returns the expected peer ifindexes. */ /* assert that nm_platform_link_veth_get_properties() returns the expected peer ifindexes. */
g_assert (nm_platform_veth_get_properties (NM_PLATFORM_GET, ifindex_veth0, &i)); g_assert (nm_platform_link_veth_get_properties (NM_PLATFORM_GET, ifindex_veth0, &i));
g_assert_cmpint (i, ==, ifindex_veth1); g_assert_cmpint (i, ==, ifindex_veth1);
g_assert (nm_platform_veth_get_properties (NM_PLATFORM_GET, ifindex_veth1, &i)); g_assert (nm_platform_link_veth_get_properties (NM_PLATFORM_GET, ifindex_veth1, &i));
g_assert_cmpint (i, ==, ifindex_veth0); g_assert_cmpint (i, ==, ifindex_veth0);
/* assert that NMPlatformLink.parent is the peer-ifindex. */ /* assert that NMPlatformLink.parent is the peer-ifindex. */

View File

@@ -295,7 +295,7 @@ setup_tests (void)
nm_platform_link_delete (NM_PLATFORM_GET, nm_platform_link_get_ifindex (NM_PLATFORM_GET, DEVICE_NAME)); nm_platform_link_delete (NM_PLATFORM_GET, nm_platform_link_get_ifindex (NM_PLATFORM_GET, DEVICE_NAME));
g_assert (!nm_platform_link_get_by_ifname (NM_PLATFORM_GET, DEVICE_NAME)); g_assert (!nm_platform_link_get_by_ifname (NM_PLATFORM_GET, DEVICE_NAME));
g_assert (nm_platform_dummy_add (NM_PLATFORM_GET, DEVICE_NAME, NULL) == NM_PLATFORM_ERROR_SUCCESS); g_assert (nm_platform_link_dummy_add (NM_PLATFORM_GET, DEVICE_NAME, NULL) == NM_PLATFORM_ERROR_SUCCESS);
accept_signal (link_added); accept_signal (link_added);
free_signal (link_added); free_signal (link_added);

View File

@@ -876,7 +876,7 @@ fixture_setup (test_fixture *fixture, gconstpointer user_data)
"nm-test-device0"); "nm-test-device0");
nm_platform_link_delete (NM_PLATFORM_GET, nm_platform_link_get_ifindex (NM_PLATFORM_GET, "nm-test-device0")); nm_platform_link_delete (NM_PLATFORM_GET, nm_platform_link_get_ifindex (NM_PLATFORM_GET, "nm-test-device0"));
g_assert (!nm_platform_link_get_by_ifname (NM_PLATFORM_GET, "nm-test-device0")); g_assert (!nm_platform_link_get_by_ifname (NM_PLATFORM_GET, "nm-test-device0"));
g_assert (nm_platform_dummy_add (NM_PLATFORM_GET, "nm-test-device0", NULL) == NM_PLATFORM_ERROR_SUCCESS); g_assert (nm_platform_link_dummy_add (NM_PLATFORM_GET, "nm-test-device0", NULL) == NM_PLATFORM_ERROR_SUCCESS);
accept_signal (link_added); accept_signal (link_added);
free_signal (link_added); free_signal (link_added);
fixture->ifindex0 = nm_platform_link_get_ifindex (NM_PLATFORM_GET, "nm-test-device0"); fixture->ifindex0 = nm_platform_link_get_ifindex (NM_PLATFORM_GET, "nm-test-device0");
@@ -888,7 +888,7 @@ fixture_setup (test_fixture *fixture, gconstpointer user_data)
"nm-test-device1"); "nm-test-device1");
nm_platform_link_delete (NM_PLATFORM_GET, nm_platform_link_get_ifindex (NM_PLATFORM_GET, "nm-test-device1")); nm_platform_link_delete (NM_PLATFORM_GET, nm_platform_link_get_ifindex (NM_PLATFORM_GET, "nm-test-device1"));
g_assert (!nm_platform_link_get_by_ifname (NM_PLATFORM_GET, "nm-test-device1")); g_assert (!nm_platform_link_get_by_ifname (NM_PLATFORM_GET, "nm-test-device1"));
g_assert (nm_platform_dummy_add (NM_PLATFORM_GET, "nm-test-device1", NULL) == NM_PLATFORM_ERROR_SUCCESS); g_assert (nm_platform_link_dummy_add (NM_PLATFORM_GET, "nm-test-device1", NULL) == NM_PLATFORM_ERROR_SUCCESS);
accept_signal (link_added); accept_signal (link_added);
free_signal (link_added); free_signal (link_added);
fixture->ifindex1 = nm_platform_link_get_ifindex (NM_PLATFORM_GET, "nm-test-device1"); fixture->ifindex1 = nm_platform_link_get_ifindex (NM_PLATFORM_GET, "nm-test-device1");