device: don't use platform singleton getter in device subclasses

Reduce the use of NM_PLATFORM_GET / nm_platform_get() to get
the platform singleton instance.

For one, this is a step towards supporting namespaces, where we need
to use different NMNetns/NMPlatform instances depending on in which
namespace the device lives.

Also, we should reduce our use of singletons. They are difficult to
coordinate on shutdown. Instead there should be a clear order of
dependencies, expressed by owning a reference to those singelton
instances. We already own a reference to the platform singelton,
so use it and avoid NM_PLATFORM_GET.

(cherry picked from commit 94d9ee129d)
This commit is contained in:
Thomas Haller
2017-04-18 12:09:02 +02:00
parent 8a6eef6aa7
commit 7b91e8b6db
20 changed files with 131 additions and 127 deletions

View File

@@ -129,7 +129,7 @@ complete_connection (NMDevice *device,
if (s_adsl && !nm_setting_verify (NM_SETTING (s_adsl), NULL, error))
return FALSE;
nm_utils_complete_generic (NM_PLATFORM_GET,
nm_utils_complete_generic (nm_device_get_platform (device),
connection,
NM_SETTING_ADSL_SETTING_NAME,
existing_connections,
@@ -273,14 +273,14 @@ pppoe_vcc_config (NMDeviceAdsl *self)
return FALSE;
/* Watch for the 'nas' interface going away */
g_signal_connect (NM_PLATFORM_GET, NM_PLATFORM_SIGNAL_LINK_CHANGED,
g_signal_connect (nm_device_get_platform (device), NM_PLATFORM_SIGNAL_LINK_CHANGED,
G_CALLBACK (link_changed_cb),
self);
_LOGD (LOGD_ADSL, "ATM setup successful");
/* otherwise we're good for stage3 */
nm_platform_link_set_up (NM_PLATFORM_GET, priv->nas_ifindex, NULL);
nm_platform_link_set_up (nm_device_get_platform (device), priv->nas_ifindex, NULL);
return TRUE;
}
@@ -306,7 +306,7 @@ nas_update_cb (gpointer user_data)
}
g_warn_if_fail (priv->nas_ifindex < 0);
priv->nas_ifindex = nm_platform_link_get_ifindex (NM_PLATFORM_GET, priv->nas_ifname);
priv->nas_ifindex = nm_platform_link_get_ifindex (nm_device_get_platform (device), priv->nas_ifname);
if (priv->nas_ifindex < 0) {
/* Keep waiting for it to appear */
return G_SOURCE_CONTINUE;
@@ -508,7 +508,7 @@ adsl_cleanup (NMDeviceAdsl *self)
g_clear_object (&priv->ppp_manager);
}
g_signal_handlers_disconnect_by_func (NM_PLATFORM_GET, G_CALLBACK (link_changed_cb), self);
g_signal_handlers_disconnect_by_func (nm_device_get_platform (NM_DEVICE (self)), G_CALLBACK (link_changed_cb), self);
if (priv->brfd >= 0) {
close (priv->brfd);
@@ -542,7 +542,7 @@ carrier_update_cb (gpointer user_data)
path = g_strdup_printf ("/sys/class/atm/%s/carrier",
NM_ASSERT_VALID_PATH_COMPONENT (nm_device_get_iface (NM_DEVICE (self))));
carrier = (int) nm_platform_sysctl_get_int_checked (NM_PLATFORM_GET, NMP_SYSCTL_PATHID_ABSOLUTE (path), 10, 0, 1, -1);
carrier = (int) nm_platform_sysctl_get_int_checked (nm_device_get_platform (NM_DEVICE (self)), NMP_SYSCTL_PATHID_ABSOLUTE (path), 10, 0, 1, -1);
g_free (path);
if (carrier != -1)

View File

@@ -328,7 +328,7 @@ complete_connection (NMDevice *device,
return FALSE;
}
nm_utils_complete_generic (NM_PLATFORM_GET,
nm_utils_complete_generic (nm_device_get_platform (device),
connection,
NM_SETTING_BLUETOOTH_SETTING_NAME,
existing_connections,

View File

@@ -101,7 +101,7 @@ complete_connection (NMDevice *device,
{
NMSettingBond *s_bond;
nm_utils_complete_generic (NM_PLATFORM_GET,
nm_utils_complete_generic (nm_device_get_platform (device),
connection,
NM_SETTING_BOND_SETTING_NAME,
existing_connections,
@@ -131,7 +131,7 @@ set_bond_attr (NMDevice *device, NMBondMode mode, const char *attr, const char *
if (!_nm_setting_bond_option_supported (attr, mode))
return FALSE;
ret = nm_platform_sysctl_master_set_option (NM_PLATFORM_GET, ifindex, attr, value);
ret = nm_platform_sysctl_master_set_option (nm_device_get_platform (device), ifindex, attr, value);
if (!ret)
_LOGW (LOGD_PLATFORM, "failed to set bonding attribute '%s' to '%s'", attr, value);
return ret;
@@ -165,7 +165,7 @@ update_connection (NMDevice *device, NMConnection *connection)
/* Read bond options from sysfs and update the Bond setting to match */
options = nm_setting_bond_get_valid_options (s_bond);
while (options && *options) {
gs_free char *value = nm_platform_sysctl_master_get_option (NM_PLATFORM_GET, ifindex, *options);
gs_free char *value = nm_platform_sysctl_master_get_option (nm_device_get_platform (device), ifindex, *options);
const char *defvalue = nm_setting_bond_get_option_default (s_bond, *options);
char *p;
@@ -328,7 +328,7 @@ apply_bonding_config (NMDevice *device)
set_bond_attr (device, mode, NM_SETTING_BOND_OPTION_PRIMARY, value ? value : "");
/* ARP targets: clear and initialize the list */
contents = nm_platform_sysctl_master_get_option (NM_PLATFORM_GET, ifindex,
contents = nm_platform_sysctl_master_get_option (nm_device_get_platform (device), ifindex,
NM_SETTING_BOND_OPTION_ARP_IP_TARGET);
set_arp_targets (device, mode, contents, " \n", "-");
value = nm_setting_bond_get_option_by_name (s_bond, NM_SETTING_BOND_OPTION_ARP_IP_TARGET);
@@ -397,7 +397,7 @@ enslave_slave (NMDevice *device,
if (configure) {
nm_device_take_down (slave, TRUE);
success = nm_platform_link_enslave (NM_PLATFORM_GET,
success = nm_platform_link_enslave (nm_device_get_platform (device),
nm_device_get_ip_ifindex (device),
nm_device_get_ip_ifindex (slave));
nm_device_bring_up (slave, TRUE, &no_firmware);
@@ -416,7 +416,7 @@ enslave_slave (NMDevice *device,
if (s_bond) {
active = nm_setting_bond_get_option_by_name (s_bond, "active_slave");
if (active && nm_streq0 (active, nm_device_get_iface (slave))) {
nm_platform_sysctl_master_set_option (NM_PLATFORM_GET,
nm_platform_sysctl_master_set_option (nm_device_get_platform (device),
nm_device_get_ifindex (device),
"active_slave",
active);
@@ -446,7 +446,7 @@ release_slave (NMDevice *device,
*/
address = g_strdup (nm_device_get_hw_address (device));
success = nm_platform_link_release (NM_PLATFORM_GET,
success = nm_platform_link_release (nm_device_get_platform (device),
nm_device_get_ip_ifindex (device),
nm_device_get_ip_ifindex (slave));
@@ -458,7 +458,7 @@ release_slave (NMDevice *device,
nm_device_get_ip_iface (slave));
}
nm_platform_process_events (NM_PLATFORM_GET);
nm_platform_process_events (nm_device_get_platform (device));
if (nm_device_update_hw_address (device))
nm_device_hw_addr_set (device, address, "restore", FALSE);
@@ -486,7 +486,7 @@ create_and_realize (NMDevice *device,
g_assert (iface);
plerr = nm_platform_link_bond_add (NM_PLATFORM_GET, iface, out_plink);
plerr = nm_platform_link_bond_add (nm_device_get_platform (device), iface, out_plink);
if (plerr != NM_PLATFORM_ERROR_SUCCESS) {
g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_CREATION_FAILED,
"Failed to create bond interface '%s' for '%s': %s",

View File

@@ -107,7 +107,7 @@ complete_connection (NMDevice *device,
{
NMSettingBridge *s_bridge;
nm_utils_complete_generic (NM_PLATFORM_GET,
nm_utils_complete_generic (nm_device_get_platform (device),
connection,
NM_SETTING_BRIDGE_SETTING_NAME,
existing_connections,
@@ -197,9 +197,9 @@ commit_option (NMDevice *device, NMSetting *setting, const Option *option, gbool
value = g_strdup_printf ("%u", uval);
if (slave)
nm_platform_sysctl_slave_set_option (NM_PLATFORM_GET, ifindex, option->sysname, value);
nm_platform_sysctl_slave_set_option (nm_device_get_platform (device), ifindex, option->sysname, value);
else
nm_platform_sysctl_master_set_option (NM_PLATFORM_GET, ifindex, option->sysname, value);
nm_platform_sysctl_master_set_option (nm_device_get_platform (device), ifindex, option->sysname, value);
}
static void
@@ -243,7 +243,7 @@ update_connection (NMDevice *device, NMConnection *connection)
}
for (option = master_options; option->name; option++) {
gs_free char *str = nm_platform_sysctl_master_get_option (NM_PLATFORM_GET, ifindex, option->sysname);
gs_free char *str = nm_platform_sysctl_master_get_option (nm_device_get_platform (device), ifindex, option->sysname);
int value;
if (str) {
@@ -282,7 +282,7 @@ master_update_slave_connection (NMDevice *device,
}
for (option = slave_options; option->name; option++) {
gs_free char *str = nm_platform_sysctl_slave_get_option (NM_PLATFORM_GET, ifindex_slave, option->sysname);
gs_free char *str = nm_platform_sysctl_slave_get_option (nm_device_get_platform (device), ifindex_slave, option->sysname);
int value;
if (str) {
@@ -333,7 +333,7 @@ enslave_slave (NMDevice *device,
NMDeviceBridge *self = NM_DEVICE_BRIDGE (device);
if (configure) {
if (!nm_platform_link_enslave (NM_PLATFORM_GET, nm_device_get_ip_ifindex (device), nm_device_get_ip_ifindex (slave)))
if (!nm_platform_link_enslave (nm_device_get_platform (device), nm_device_get_ip_ifindex (device), nm_device_get_ip_ifindex (slave)))
return FALSE;
commit_slave_options (slave, nm_connection_get_setting_bridge_port (connection));
@@ -357,7 +357,7 @@ release_slave (NMDevice *device,
gboolean success;
if (configure) {
success = nm_platform_link_release (NM_PLATFORM_GET,
success = nm_platform_link_release (nm_device_get_platform (device),
nm_device_get_ip_ifindex (device),
nm_device_get_ip_ifindex (slave));
@@ -401,7 +401,7 @@ create_and_realize (NMDevice *device,
}
}
plerr = nm_platform_link_bridge_add (NM_PLATFORM_GET,
plerr = nm_platform_link_bridge_add (nm_device_get_platform (device),
iface,
hwaddr ? mac_address : NULL,
hwaddr ? ETH_ALEN : 0,

View File

@@ -62,7 +62,7 @@ complete_connection (NMDevice *device,
{
NMSettingDummy *s_dummy;
nm_utils_complete_generic (NM_PLATFORM_GET,
nm_utils_complete_generic (nm_device_get_platform (device),
connection,
NM_SETTING_DUMMY_SETTING_NAME,
existing_connections,
@@ -106,7 +106,7 @@ create_and_realize (NMDevice *device,
s_dummy = nm_connection_get_setting_dummy (connection);
g_assert (s_dummy);
plerr = nm_platform_link_dummy_add (NM_PLATFORM_GET, iface, out_plink);
plerr = nm_platform_link_dummy_add (nm_device_get_platform (device), iface, out_plink);
if (plerr != NM_PLATFORM_ERROR_SUCCESS) {
g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_CREATION_FAILED,
"Failed to create dummy interface '%s' for '%s': %s",

View File

@@ -172,7 +172,7 @@ _update_s390_subchannels (NMDeviceEthernet *self)
}
ifindex = nm_device_get_ifindex ((NMDevice *) self);
dev = nm_platform_link_get_udev_device (NM_PLATFORM_GET, ifindex);
dev = nm_platform_link_get_udev_device (nm_device_get_platform (NM_DEVICE (self)), ifindex);
if (!dev)
return;
@@ -209,7 +209,7 @@ _update_s390_subchannels (NMDeviceEthernet *self)
gs_free char *path = NULL, *value = NULL;
path = g_strdup_printf ("%s/%s", parent_path, item);
value = nm_platform_sysctl_get (NM_PLATFORM_GET, NMP_SYSCTL_PATHID_ABSOLUTE (path));
value = nm_platform_sysctl_get (nm_device_get_platform (NM_DEVICE (self)), NMP_SYSCTL_PATHID_ABSOLUTE (path));
if ( !strcmp (item, "portname")
&& !g_strcmp0 (value, "no portname required")) {
@@ -304,7 +304,7 @@ get_generic_capabilities (NMDevice *device)
int ifindex = nm_device_get_ifindex (device);
if (ifindex > 0) {
if (nm_platform_link_supports_carrier_detect (NM_PLATFORM_GET, ifindex))
if (nm_platform_link_supports_carrier_detect (nm_device_get_platform (device), ifindex))
return NM_DEVICE_CAP_CARRIER_DETECT;
else {
_LOGI (LOGD_PLATFORM, "driver '%s' does not support carrier detection.",
@@ -569,7 +569,7 @@ build_supplicant_config (NMDeviceEthernet *self,
connection = nm_device_get_applied_connection (NM_DEVICE (self));
g_assert (connection);
con_uuid = nm_connection_get_uuid (connection);
mtu = nm_platform_link_get_mtu (NM_PLATFORM_GET,
mtu = nm_platform_link_get_mtu (nm_device_get_platform (NM_DEVICE (self)),
nm_device_get_ifindex (NM_DEVICE (self)));
config = nm_supplicant_config_new ();
@@ -828,7 +828,7 @@ link_negotiation_set (NMDevice *device)
}
}
if (!nm_platform_ethtool_get_link_settings (NM_PLATFORM_GET, nm_device_get_ifindex (device),
if (!nm_platform_ethtool_get_link_settings (nm_device_get_platform (device), nm_device_get_ifindex (device),
&link_autoneg, &link_speed, &link_duplex)) {
_LOGW (LOGD_DEVICE, "set-link: unable to retrieve link negotiation");
return;
@@ -852,7 +852,7 @@ link_negotiation_set (NMDevice *device)
duplex ? "" : "*");
}
if (!nm_platform_ethtool_set_link_settings (NM_PLATFORM_GET,
if (!nm_platform_ethtool_set_link_settings (nm_device_get_platform (device),
nm_device_get_ifindex (device),
autoneg,
speed,
@@ -1124,7 +1124,7 @@ dcb_state (NMDevice *device, gboolean timeout)
g_return_if_fail (nm_device_get_state (device) == NM_DEVICE_STATE_CONFIG);
carrier = nm_platform_link_is_connected (NM_PLATFORM_GET, nm_device_get_ifindex (device));
carrier = nm_platform_link_is_connected (nm_device_get_platform (device), nm_device_get_ifindex (device));
_LOGD (LOGD_DCB, "dcb_state() wait %d carrier %d timeout %d", priv->dcb_wait, carrier, timeout);
switch (priv->dcb_wait) {
@@ -1242,7 +1242,7 @@ wake_on_lan_enable (NMDevice *device)
}
wol = NM_SETTING_WIRED_WAKE_ON_LAN_IGNORE;
found:
return nm_platform_ethtool_set_wake_on_lan (NM_PLATFORM_GET, nm_device_get_ifindex (device), wol, password);
return nm_platform_ethtool_set_wake_on_lan (nm_device_get_platform (device), nm_device_get_ifindex (device), wol, password);
}
/*****************************************************************************/
@@ -1285,7 +1285,7 @@ act_stage2_config (NMDevice *device, NMDeviceStateReason *out_failure_reason)
s_dcb = (NMSettingDcb *) nm_device_get_applied_setting (device, NM_TYPE_SETTING_DCB);
if (s_dcb) {
/* lldpad really really wants the carrier to be up */
if (nm_platform_link_is_connected (NM_PLATFORM_GET, nm_device_get_ifindex (device))) {
if (nm_platform_link_is_connected (nm_device_get_platform (device), nm_device_get_ifindex (device))) {
if (!dcb_enable (device)) {
NM_SET_OUT (out_failure_reason, NM_DEVICE_STATE_REASON_DCB_FCOE_FAILED);
return NM_ACT_STAGE_RETURN_FAILURE;
@@ -1321,7 +1321,7 @@ act_stage2_config (NMDevice *device, NMDeviceStateReason *out_failure_reason)
if (mxu) {
_LOGD (LOGD_PPP, "set MTU to %u (PPP interface MRU %u, MTU %u)",
mxu + PPPOE_ENCAP_OVERHEAD, mru, mtu);
nm_platform_link_set_mtu (NM_PLATFORM_GET,
nm_platform_link_set_mtu (nm_device_get_platform (device),
nm_device_get_ifindex (device),
mxu + PPPOE_ENCAP_OVERHEAD);
}
@@ -1427,7 +1427,7 @@ complete_connection (NMDevice *device,
/* Default to an ethernet-only connection, but if a PPPoE setting was given
* then PPPoE should be our connection type.
*/
nm_utils_complete_generic (NM_PLATFORM_GET,
nm_utils_complete_generic (nm_device_get_platform (device),
connection,
s_pppoe ? NM_SETTING_PPPOE_SETTING_NAME : NM_SETTING_WIRED_SETTING_NAME,
existing_connections,
@@ -1585,7 +1585,7 @@ get_link_speed (NMDevice *device)
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self);
guint32 speed;
if (!nm_platform_ethtool_get_link_settings (NM_PLATFORM_GET, nm_device_get_ifindex (device), NULL, &speed, NULL))
if (!nm_platform_ethtool_get_link_settings (nm_device_get_platform (device), nm_device_get_ifindex (device), NULL, &speed, NULL))
return;
if (priv->speed == speed)
return;

View File

@@ -54,11 +54,11 @@ G_DEFINE_TYPE (NMDeviceGeneric, nm_device_generic, NM_TYPE_DEVICE)
/*****************************************************************************/
static NMDeviceCapabilities
get_generic_capabilities (NMDevice *dev)
get_generic_capabilities (NMDevice *device)
{
int ifindex = nm_device_get_ifindex (dev);
int ifindex = nm_device_get_ifindex (device);
if (ifindex > 0 && nm_platform_link_supports_carrier_detect (NM_PLATFORM_GET, ifindex))
if (ifindex > 0 && nm_platform_link_supports_carrier_detect (nm_device_get_platform (device), ifindex))
return NM_DEVICE_CAP_CARRIER_DETECT;
else
return NM_DEVICE_CAP_NONE;
@@ -84,7 +84,7 @@ realize_start_notify (NMDevice *device, const NMPlatformLink *plink)
g_clear_pointer (&priv->type_description, g_free);
ifindex = nm_device_get_ip_ifindex (NM_DEVICE (self));
if (ifindex > 0)
priv->type_description = g_strdup (nm_platform_link_get_type_name (NM_PLATFORM_GET, ifindex));
priv->type_description = g_strdup (nm_platform_link_get_type_name (nm_device_get_platform (device), ifindex));
}
static gboolean

View File

@@ -75,7 +75,7 @@ get_generic_capabilities (NMDevice *device)
}
static NMActStageReturn
act_stage1_prepare (NMDevice *dev, NMDeviceStateReason *out_failure_reason)
act_stage1_prepare (NMDevice *device, NMDeviceStateReason *out_failure_reason)
{
nm_auto_close int dirfd = -1;
NMActStageReturn ret;
@@ -84,16 +84,16 @@ act_stage1_prepare (NMDevice *dev, NMDeviceStateReason *out_failure_reason)
const char *transport_mode;
gboolean ok, no_firmware = FALSE;
ret = NM_DEVICE_CLASS (nm_device_infiniband_parent_class)->act_stage1_prepare (dev, out_failure_reason);
ret = NM_DEVICE_CLASS (nm_device_infiniband_parent_class)->act_stage1_prepare (device, out_failure_reason);
if (ret != NM_ACT_STAGE_RETURN_SUCCESS)
return ret;
s_infiniband = (NMSettingInfiniband *) nm_device_get_applied_setting (dev, NM_TYPE_SETTING_INFINIBAND);
s_infiniband = (NMSettingInfiniband *) nm_device_get_applied_setting (device, NM_TYPE_SETTING_INFINIBAND);
g_return_val_if_fail (s_infiniband, NM_ACT_STAGE_RETURN_FAILURE);
transport_mode = nm_setting_infiniband_get_transport_mode (s_infiniband);
dirfd = nm_platform_sysctl_open_netdir (NM_PLATFORM_GET, nm_device_get_ifindex (dev), ifname_verified);
dirfd = nm_platform_sysctl_open_netdir (nm_device_get_platform (device), nm_device_get_ifindex (device), ifname_verified);
if (dirfd < 0) {
if (!strcmp (transport_mode, "datagram"))
return NM_ACT_STAGE_RETURN_SUCCESS;
@@ -104,9 +104,9 @@ act_stage1_prepare (NMDevice *dev, NMDeviceStateReason *out_failure_reason)
}
/* With some drivers the interface must be down to set transport mode */
nm_device_take_down (dev, TRUE);
ok = nm_platform_sysctl_set (NM_PLATFORM_GET, NMP_SYSCTL_PATHID_NETDIR (dirfd, ifname_verified, "mode"), transport_mode);
nm_device_bring_up (dev, TRUE, &no_firmware);
nm_device_take_down (device, TRUE);
ok = nm_platform_sysctl_set (nm_device_get_platform (device), NMP_SYSCTL_PATHID_NETDIR (dirfd, ifname_verified, "mode"), transport_mode);
nm_device_bring_up (device, TRUE, &no_firmware);
if (!ok) {
NM_SET_OUT (out_failure_reason, NM_DEVICE_STATE_REASON_CONFIG_FAILED);
@@ -184,7 +184,7 @@ complete_connection (NMDevice *device,
const char *setting_mac;
const char *hw_address;
nm_utils_complete_generic (NM_PLATFORM_GET,
nm_utils_complete_generic (nm_device_get_platform (device),
connection,
NM_SETTING_INFINIBAND_SETTING_NAME,
existing_connections,
@@ -240,7 +240,7 @@ update_connection (NMDevice *device, NMConnection *connection)
ifindex = nm_device_get_ifindex (device);
if (ifindex > 0) {
if (!nm_platform_link_infiniband_get_properties (NM_PLATFORM_GET, ifindex, NULL, NULL, &transport_mode))
if (!nm_platform_link_infiniband_get_properties (nm_device_get_platform (device), ifindex, NULL, NULL, &transport_mode))
transport_mode = "datagram";
}
g_object_set (G_OBJECT (s_infiniband), NM_SETTING_INFINIBAND_TRANSPORT_MODE, transport_mode, NULL);
@@ -289,7 +289,7 @@ create_and_realize (NMDevice *device,
return FALSE;
}
plerr = nm_platform_link_infiniband_add (NM_PLATFORM_GET, priv->parent_ifindex, priv->p_key, out_plink);
plerr = nm_platform_link_infiniband_add (nm_device_get_platform (device), priv->parent_ifindex, priv->p_key, out_plink);
if (plerr != NM_PLATFORM_ERROR_SUCCESS) {
g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_CREATION_FAILED,
"Failed to create InfiniBand P_Key interface '%s' for '%s': %s",
@@ -319,7 +319,7 @@ unrealize (NMDevice *device, GError **error)
return FALSE;
}
plerr = nm_platform_link_infiniband_delete (NM_PLATFORM_GET, priv->parent_ifindex, priv->p_key);
plerr = nm_platform_link_infiniband_delete (nm_device_get_platform (device), priv->parent_ifindex, priv->p_key);
if (plerr != NM_PLATFORM_ERROR_SUCCESS) {
g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_CREATION_FAILED,
"Failed to remove InfiniBand P_Key interface '%s': %s",

View File

@@ -157,7 +157,7 @@ clear:
if (priv->mode == NM_IP_TUNNEL_MODE_GRE) {
const NMPlatformLnkGre *lnk;
lnk = nm_platform_link_get_lnk_gre (NM_PLATFORM_GET, ifindex, NULL);
lnk = nm_platform_link_get_lnk_gre (nm_device_get_platform (device), ifindex, NULL);
if (!lnk) {
_LOGW (LOGD_PLATFORM, "could not read %s properties", "gre");
goto clear;
@@ -202,7 +202,7 @@ clear:
} else if (priv->mode == NM_IP_TUNNEL_MODE_SIT) {
const NMPlatformLnkSit *lnk;
lnk = nm_platform_link_get_lnk_sit (NM_PLATFORM_GET, ifindex, NULL);
lnk = nm_platform_link_get_lnk_sit (nm_device_get_platform (device), ifindex, NULL);
if (!lnk) {
_LOGW (LOGD_PLATFORM, "could not read %s properties", "sit");
goto clear;
@@ -217,7 +217,7 @@ clear:
} else if (priv->mode == NM_IP_TUNNEL_MODE_IPIP) {
const NMPlatformLnkIpIp *lnk;
lnk = nm_platform_link_get_lnk_ipip (NM_PLATFORM_GET, ifindex, NULL);
lnk = nm_platform_link_get_lnk_ipip (nm_device_get_platform (device), ifindex, NULL);
if (!lnk) {
_LOGW (LOGD_PLATFORM, "could not read %s properties", "ipip");
goto clear;
@@ -233,7 +233,7 @@ clear:
|| priv->mode == NM_IP_TUNNEL_MODE_IP6IP6) {
const NMPlatformLnkIp6Tnl *lnk;
lnk = nm_platform_link_get_lnk_ip6tnl (NM_PLATFORM_GET, ifindex, NULL);
lnk = nm_platform_link_get_lnk_ip6tnl (nm_device_get_platform (device), ifindex, NULL);
if (!lnk) {
_LOGW (LOGD_PLATFORM, "could not read %s properties", "ip6tnl");
goto clear;
@@ -332,7 +332,7 @@ complete_connection (NMDevice *device,
{
NMSettingIPTunnel *s_ip_tunnel;
nm_utils_complete_generic (NM_PLATFORM_GET,
nm_utils_complete_generic (nm_device_get_platform (device),
connection,
NM_SETTING_IP_TUNNEL_SETTING_NAME,
existing_connections,
@@ -641,7 +641,7 @@ create_and_realize (NMDevice *device,
lnk_gre.output_flags = NM_GRE_KEY;
}
plerr = nm_platform_link_gre_add (NM_PLATFORM_GET, iface, &lnk_gre, out_plink);
plerr = nm_platform_link_gre_add (nm_device_get_platform (device), iface, &lnk_gre, out_plink);
if (plerr != NM_PLATFORM_ERROR_SUCCESS) {
g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_CREATION_FAILED,
"Failed to create GRE interface '%s' for '%s': %s",
@@ -667,7 +667,7 @@ create_and_realize (NMDevice *device,
lnk_sit.tos = nm_setting_ip_tunnel_get_tos (s_ip_tunnel);
lnk_sit.path_mtu_discovery = nm_setting_ip_tunnel_get_path_mtu_discovery (s_ip_tunnel);
plerr = nm_platform_link_sit_add (NM_PLATFORM_GET, iface, &lnk_sit, out_plink);
plerr = nm_platform_link_sit_add (nm_device_get_platform (device), iface, &lnk_sit, out_plink);
if (plerr != NM_PLATFORM_ERROR_SUCCESS) {
g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_CREATION_FAILED,
"Failed to create SIT interface '%s' for '%s': %s",
@@ -693,7 +693,7 @@ create_and_realize (NMDevice *device,
lnk_ipip.tos = nm_setting_ip_tunnel_get_tos (s_ip_tunnel);
lnk_ipip.path_mtu_discovery = nm_setting_ip_tunnel_get_path_mtu_discovery (s_ip_tunnel);
plerr = nm_platform_link_ipip_add (NM_PLATFORM_GET, iface, &lnk_ipip, out_plink);
plerr = nm_platform_link_ipip_add (nm_device_get_platform (device), iface, &lnk_ipip, out_plink);
if (plerr != NM_PLATFORM_ERROR_SUCCESS) {
g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_CREATION_FAILED,
"Failed to create IPIP interface '%s' for '%s': %s",
@@ -722,7 +722,7 @@ create_and_realize (NMDevice *device,
lnk_ip6tnl.flow_label = nm_setting_ip_tunnel_get_flow_label (s_ip_tunnel);
lnk_ip6tnl.proto = nm_setting_ip_tunnel_get_mode (s_ip_tunnel) == NM_IP_TUNNEL_MODE_IPIP6 ? IPPROTO_IPIP : IPPROTO_IPV6;
plerr = nm_platform_link_ip6tnl_add (NM_PLATFORM_GET, iface, &lnk_ip6tnl, out_plink);
plerr = nm_platform_link_ip6tnl_add (nm_device_get_platform (device), iface, &lnk_ip6tnl, out_plink);
if (plerr != NM_PLATFORM_ERROR_SUCCESS) {
g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_CREATION_FAILED,
"Failed to create IPIP interface '%s' for '%s': %s",

View File

@@ -173,7 +173,7 @@ update_properties (NMDevice *device)
ifindex = nm_device_get_ifindex (device);
g_return_if_fail (ifindex > 0);
props = nm_platform_link_get_lnk_macsec (NM_PLATFORM_GET, ifindex, &plink);
props = nm_platform_link_get_lnk_macsec (nm_device_get_platform (device), ifindex, &plink);
if (!props) {
_LOGW (LOGD_PLATFORM, "could not get macsec properties");
@@ -219,7 +219,7 @@ build_supplicant_config (NMDeviceMacsec *self, GError **error)
connection = nm_device_get_applied_connection (NM_DEVICE (self));
g_assert (connection);
con_uuid = nm_connection_get_uuid (connection);
mtu = nm_platform_link_get_mtu (NM_PLATFORM_GET,
mtu = nm_platform_link_get_mtu (nm_device_get_platform (NM_DEVICE (self)),
nm_device_get_ifindex (NM_DEVICE (self)));
config = nm_supplicant_config_new ();
@@ -714,7 +714,7 @@ create_and_realize (NMDevice *device,
parent_ifindex = nm_device_get_ifindex (parent);
g_warn_if_fail (parent_ifindex > 0);
plerr = nm_platform_link_macsec_add (NM_PLATFORM_GET, iface, parent_ifindex, &lnk, out_plink);
plerr = nm_platform_link_macsec_add (nm_device_get_platform (device), iface, parent_ifindex, &lnk, out_plink);
if (plerr != NM_PLATFORM_ERROR_SUCCESS) {
g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_CREATION_FAILED,
"Failed to create macsec interface '%s' for '%s': %s",

View File

@@ -185,9 +185,9 @@ update_properties (NMDevice *device)
const NMPlatformLink *plink;
if (priv->props.tap)
props = nm_platform_link_get_lnk_macvtap (NM_PLATFORM_GET, nm_device_get_ifindex (device), &plink);
props = nm_platform_link_get_lnk_macvtap (nm_device_get_platform (device), nm_device_get_ifindex (device), &plink);
else
props = nm_platform_link_get_lnk_macvlan (NM_PLATFORM_GET, nm_device_get_ifindex (device), &plink);
props = nm_platform_link_get_lnk_macvlan (nm_device_get_platform (device), nm_device_get_ifindex (device), &plink);
if (!props) {
_LOGW (LOGD_PLATFORM, "could not get %s properties", priv->props.tap ? "macvtap" : "macvlan");
@@ -251,7 +251,7 @@ create_and_realize (NMDevice *device,
lnk.no_promisc = !nm_setting_macvlan_get_promiscuous (s_macvlan);
lnk.tap = nm_setting_macvlan_get_tap (s_macvlan);
plerr = nm_platform_link_macvlan_add (NM_PLATFORM_GET, iface, parent_ifindex, &lnk, out_plink);
plerr = nm_platform_link_macvlan_add (nm_device_get_platform (device), iface, parent_ifindex, &lnk, out_plink);
if (plerr != NM_PLATFORM_ERROR_SUCCESS) {
g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_CREATION_FAILED,
"Failed to create %s interface '%s' for '%s': %s",
@@ -399,7 +399,7 @@ complete_connection (NMDevice *device,
{
NMSettingMacvlan *s_macvlan;
nm_utils_complete_generic (NM_PLATFORM_GET,
nm_utils_complete_generic (nm_device_get_platform (device),
connection,
NM_SETTING_MACVLAN_SETTING_NAME,
existing_connections,

View File

@@ -80,7 +80,7 @@ update_properties (NMDeviceTun *self)
ifindex = nm_device_get_ifindex (NM_DEVICE (self));
if (ifindex > 0) {
if (!nm_platform_link_tun_get_properties (NM_PLATFORM_GET, ifindex, &props)) {
if (!nm_platform_link_tun_get_properties (nm_device_get_platform (NM_DEVICE (self)), ifindex, &props)) {
_LOGD (LOGD_DEVICE, "tun-properties: cannot loading tun properties from platform for ifindex %d", ifindex);
ifindex = 0;
} else if (g_strcmp0 (priv->mode, props.mode) != 0) {
@@ -138,7 +138,7 @@ complete_connection (NMDevice *device,
{
NMSettingTun *s_tun;
nm_utils_complete_generic (NM_PLATFORM_GET,
nm_utils_complete_generic (nm_device_get_platform (device),
connection,
NM_SETTING_TUN_SETTING_NAME,
existing_connections,
@@ -181,7 +181,7 @@ update_connection (NMDevice *device, NMConnection *connection)
nm_connection_add_setting (connection, (NMSetting *) s_tun);
}
if (!nm_platform_link_tun_get_properties (NM_PLATFORM_GET, nm_device_get_ifindex (device), &props)) {
if (!nm_platform_link_tun_get_properties (nm_device_get_platform (device), nm_device_get_ifindex (device), &props)) {
_LOGW (LOGD_PLATFORM, "failed to get TUN interface info while updating connection.");
return;
}
@@ -232,7 +232,7 @@ create_and_realize (NMDevice *device,
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);
plerr = nm_platform_link_tun_add (NM_PLATFORM_GET, iface,
plerr = nm_platform_link_tun_add (nm_device_get_platform (device), iface,
nm_setting_tun_get_mode (s_tun) == NM_SETTING_TUN_MODE_TAP,
user, group,
nm_setting_tun_get_pi (s_tun),

View File

@@ -69,7 +69,7 @@ update_properties (NMDevice *device)
ifindex = nm_device_get_ifindex (device);
if (!nm_platform_link_veth_get_properties (NM_PLATFORM_GET, ifindex, &peer_ifindex))
if (!nm_platform_link_veth_get_properties (nm_device_get_platform (device), ifindex, &peer_ifindex))
peer_ifindex = 0;
nm_device_parent_set_ifindex (device, peer_ifindex);

View File

@@ -186,7 +186,7 @@ update_properties (NMDevice *device)
ifindex = nm_device_get_ifindex (device);
if (ifindex > 0)
plnk = nm_platform_link_get_lnk_vlan (NM_PLATFORM_GET, ifindex, &plink);
plnk = nm_platform_link_get_lnk_vlan (nm_device_get_platform (device), ifindex, &plink);
if ( plnk
&& plink->parent > 0)
@@ -249,7 +249,7 @@ create_and_realize (NMDevice *device,
vlan_id = nm_setting_vlan_get_id (s_vlan);
plerr = nm_platform_link_vlan_add (NM_PLATFORM_GET,
plerr = nm_platform_link_vlan_add (nm_device_get_platform (device),
iface,
parent_ifindex,
vlan_id,
@@ -425,7 +425,7 @@ complete_connection (NMDevice *device,
{
NMSettingVlan *s_vlan;
nm_utils_complete_generic (NM_PLATFORM_GET,
nm_utils_complete_generic (nm_device_get_platform (device),
connection,
NM_SETTING_VLAN_SETTING_NAME,
existing_connections,
@@ -472,7 +472,7 @@ update_connection (NMDevice *device, NMConnection *connection)
nm_connection_add_setting (connection, (NMSetting *) s_vlan);
}
polnk = nm_platform_link_get_lnk (NM_PLATFORM_GET, ifindex, NM_LINK_TYPE_VLAN, &plink);
polnk = nm_platform_link_get_lnk (nm_device_get_platform (device), ifindex, NM_LINK_TYPE_VLAN, &plink);
if (polnk)
vlan_id = polnk->lnk_vlan.id;
@@ -556,7 +556,7 @@ act_stage1_prepare (NMDevice *device, NMDeviceStateReason *out_failure_reason)
&egress_map,
&n_egress_map);
nm_platform_link_vlan_change (NM_PLATFORM_GET,
nm_platform_link_vlan_change (nm_device_get_platform (device),
nm_device_get_ifindex (device),
NM_VLAN_FLAGS_ALL,
nm_setting_vlan_get_flags (s_vlan),
@@ -584,7 +584,7 @@ get_configured_mtu (NMDevice *self, gboolean *out_is_user_config)
/* Inherit the MTU from parent device, if any */
ifindex = nm_device_parent_get_ifindex (self);
if (ifindex > 0)
mtu = nm_platform_link_get_mtu (NM_PLATFORM_GET, ifindex);
mtu = nm_platform_link_get_mtu (nm_device_get_platform (NM_DEVICE (self)), ifindex);
return mtu ?: NM_DEVICE_DEFAULT_MTU_WIRED;
}

View File

@@ -87,7 +87,7 @@ update_properties (NMDevice *device)
GObject *object = G_OBJECT (device);
const NMPlatformLnkVxlan *props;
props = nm_platform_link_get_lnk_vxlan (NM_PLATFORM_GET, nm_device_get_ifindex (device), NULL);
props = nm_platform_link_get_lnk_vxlan (nm_device_get_platform (device), nm_device_get_ifindex (device), NULL);
if (!props) {
_LOGW (LOGD_PLATFORM, "could not get vxlan properties");
return;
@@ -217,7 +217,7 @@ create_and_realize (NMDevice *device,
props.l2miss = nm_setting_vxlan_get_l2_miss (s_vxlan);
props.l3miss = nm_setting_vxlan_get_l3_miss (s_vxlan);
plerr = nm_platform_link_vxlan_add (NM_PLATFORM_GET, iface, &props, out_plink);
plerr = nm_platform_link_vxlan_add (nm_device_get_platform (device), iface, &props, out_plink);
if (plerr != NM_PLATFORM_ERROR_SUCCESS) {
g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_CREATION_FAILED,
"Failed to create VXLAN interface '%s' for '%s': %s",
@@ -361,7 +361,7 @@ complete_connection (NMDevice *device,
{
NMSettingVxlan *s_vxlan;
nm_utils_complete_generic (NM_PLATFORM_GET,
nm_utils_complete_generic (nm_device_get_platform (device),
connection,
NM_SETTING_VXLAN_SETTING_NAME,
existing_connections,

View File

@@ -127,7 +127,7 @@ complete_connection (NMDevice *device,
{
NMSettingTeam *s_team;
nm_utils_complete_generic (NM_PLATFORM_GET,
nm_utils_complete_generic (nm_device_get_platform (device),
connection,
NM_SETTING_TEAM_SETTING_NAME,
existing_connections,
@@ -721,7 +721,7 @@ enslave_slave (NMDevice *device,
}
}
}
success = nm_platform_link_enslave (NM_PLATFORM_GET,
success = nm_platform_link_enslave (nm_device_get_platform (device),
nm_device_get_ip_ifindex (device),
nm_device_get_ip_ifindex (slave));
nm_device_bring_up (slave, TRUE, &no_firmware);
@@ -751,7 +751,7 @@ release_slave (NMDevice *device,
gboolean success, no_firmware = FALSE;
if (configure) {
success = nm_platform_link_release (NM_PLATFORM_GET,
success = nm_platform_link_release (nm_device_get_platform (device),
nm_device_get_ip_ifindex (device),
nm_device_get_ip_ifindex (slave));
@@ -786,7 +786,7 @@ create_and_realize (NMDevice *device,
const char *iface = nm_device_get_iface (device);
NMPlatformError plerr;
plerr = nm_platform_link_team_add (NM_PLATFORM_GET, iface, out_plink);
plerr = nm_platform_link_team_add (nm_device_get_platform (device), iface, out_plink);
if (plerr != NM_PLATFORM_ERROR_SUCCESS) {
g_set_error (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_CREATION_FAILED,
"Failed to create team master interface '%s' for '%s': %s",

View File

@@ -148,7 +148,7 @@ complete_connection (NMDevice *device,
}
nm_utils_complete_generic (NM_PLATFORM_GET,
nm_utils_complete_generic (nm_device_get_platform (device),
connection,
NM_SETTING_OLPC_MESH_SETTING_NAME,
existing_connections,
@@ -200,10 +200,12 @@ act_stage1_prepare (NMDevice *device, NMDeviceStateReason *out_failure_reason)
static void
_mesh_set_channel (NMDeviceOlpcMesh *self, guint32 channel)
{
NMPlatform *platform;
int ifindex = nm_device_get_ifindex (NM_DEVICE (self));
if (nm_platform_mesh_get_channel (NM_PLATFORM_GET, ifindex) != channel) {
if (nm_platform_mesh_set_channel (NM_PLATFORM_GET, ifindex, channel))
platform = nm_device_get_platform (NM_DEVICE (self));
if (nm_platform_mesh_get_channel (platform, ifindex) != channel) {
if (nm_platform_mesh_set_channel (platform, ifindex, channel))
_notify (self, PROP_ACTIVE_CHANNEL);
}
}
@@ -229,7 +231,7 @@ act_stage2_config (NMDevice *device, NMDeviceStateReason *out_failure_reason)
_mesh_set_channel (self, channel);
ssid = nm_setting_olpc_mesh_get_ssid (s_mesh);
nm_platform_mesh_set_ssid (NM_PLATFORM_GET,
nm_platform_mesh_set_ssid (nm_device_get_platform (device),
nm_device_get_ifindex (device),
g_bytes_get_data (ssid, NULL),
g_bytes_get_size (ssid));
@@ -429,15 +431,16 @@ static void
get_property (GObject *object, guint prop_id,
GValue *value, GParamSpec *pspec)
{
NMDeviceOlpcMesh *device = NM_DEVICE_OLPC_MESH (object);
NMDeviceOlpcMeshPrivate *priv = NM_DEVICE_OLPC_MESH_GET_PRIVATE (device);
NMDeviceOlpcMesh *self = NM_DEVICE_OLPC_MESH (object);
NMDevice *device = NM_DEVICE (self);
NMDeviceOlpcMeshPrivate *priv = NM_DEVICE_OLPC_MESH_GET_PRIVATE (self);
switch (prop_id) {
case PROP_COMPANION:
nm_utils_g_value_set_object_path (value, priv->companion);
break;
case PROP_ACTIVE_CHANNEL:
g_value_set_uint (value, nm_platform_mesh_get_channel (NM_PLATFORM_GET, nm_device_get_ifindex (NM_DEVICE (device))));
g_value_set_uint (value, nm_platform_mesh_get_channel (nm_device_get_platform (device), nm_device_get_ifindex (device)));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);

View File

@@ -444,7 +444,7 @@ periodic_update (NMDeviceWifi *self)
if (priv->current_ap) {
/* Smooth out the strength to work around crappy drivers */
percent = nm_platform_wifi_get_quality (NM_PLATFORM_GET, ifindex);
percent = nm_platform_wifi_get_quality (nm_device_get_platform (NM_DEVICE (self)), ifindex);
if (percent >= 0 || ++priv->invalid_strength_counter > 3) {
if (nm_wifi_ap_set_strength (priv->current_ap, (gint8) percent)) {
#ifdef NM_MORE_LOGGING
@@ -455,7 +455,7 @@ periodic_update (NMDeviceWifi *self)
}
}
new_rate = nm_platform_wifi_get_rate (NM_PLATFORM_GET, ifindex);
new_rate = nm_platform_wifi_get_rate (nm_device_get_platform (NM_DEVICE (self)), ifindex);
if (new_rate != priv->rate) {
priv->rate = new_rate;
_notify (self, PROP_BITRATE);
@@ -541,14 +541,14 @@ deactivate (NMDevice *device)
set_current_ap (self, NULL, TRUE);
/* Clear any critical protocol notification in the Wi-Fi stack */
nm_platform_wifi_indicate_addressing_running (NM_PLATFORM_GET, ifindex, FALSE);
nm_platform_wifi_indicate_addressing_running (nm_device_get_platform (device), ifindex, FALSE);
/* Ensure we're in infrastructure mode after deactivation; some devices
* (usually older ones) don't scan well in adhoc mode.
*/
if (nm_platform_wifi_get_mode (NM_PLATFORM_GET, ifindex) != NM_802_11_MODE_INFRA) {
if (nm_platform_wifi_get_mode (nm_device_get_platform (device), ifindex) != NM_802_11_MODE_INFRA) {
nm_device_take_down (NM_DEVICE (self), TRUE);
nm_platform_wifi_set_mode (NM_PLATFORM_GET, ifindex, NM_802_11_MODE_INFRA);
nm_platform_wifi_set_mode (nm_device_get_platform (device), ifindex, NM_802_11_MODE_INFRA);
nm_device_bring_up (NM_DEVICE (self), TRUE, NULL);
}
@@ -901,7 +901,7 @@ complete_connection (NMDevice *device,
str_ssid = nm_utils_ssid_to_utf8 (ssid->data, ssid->len);
nm_utils_complete_generic (NM_PLATFORM_GET,
nm_utils_complete_generic (nm_device_get_platform (device),
connection,
NM_SETTING_WIRELESS_SETTING_NAME,
existing_connections,
@@ -2374,7 +2374,7 @@ build_supplicant_config (NMDeviceWifi *self,
if (s_wireless_sec) {
NMSetting8021x *s_8021x;
const char *con_uuid = nm_connection_get_uuid (connection);
guint32 mtu = nm_platform_link_get_mtu (NM_PLATFORM_GET,
guint32 mtu = nm_platform_link_get_mtu (nm_device_get_platform (NM_DEVICE (self)),
nm_device_get_ifindex (NM_DEVICE (self)));
g_assert (con_uuid);
@@ -2506,6 +2506,7 @@ ensure_hotspot_frequency (NMDeviceWifi *self,
NMSettingWireless *s_wifi,
NMWifiAP *ap)
{
NMDevice *device = NM_DEVICE (self);
const char *band = nm_setting_wireless_get_band (s_wifi);
const guint32 a_freqs[] = { 5180, 5200, 5220, 5745, 5765, 5785, 5805, 0 };
const guint32 bg_freqs[] = { 2412, 2437, 2462, 2472, 0 };
@@ -2517,9 +2518,9 @@ ensure_hotspot_frequency (NMDeviceWifi *self,
return;
if (g_strcmp0 (band, "a") == 0)
freq = nm_platform_wifi_find_frequency (NM_PLATFORM_GET, nm_device_get_ifindex (NM_DEVICE (self)), a_freqs);
freq = nm_platform_wifi_find_frequency (nm_device_get_platform (device), nm_device_get_ifindex (device), a_freqs);
else
freq = nm_platform_wifi_find_frequency (NM_PLATFORM_GET, nm_device_get_ifindex (NM_DEVICE (self)), bg_freqs);
freq = nm_platform_wifi_find_frequency (nm_device_get_platform (device), nm_device_get_ifindex (device), bg_freqs);
if (!freq)
freq = (g_strcmp0 (band, "a") == 0) ? 5180 : 2462;
@@ -2555,7 +2556,7 @@ set_powersave (NMDevice *device)
if (powersave == NM_SETTING_WIRELESS_POWERSAVE_IGNORE)
return;
nm_platform_wifi_set_powersave (NM_PLATFORM_GET,
nm_platform_wifi_set_powersave (nm_device_get_platform (device),
nm_device_get_ifindex (device),
powersave == NM_SETTING_WIRELESS_POWERSAVE_ENABLE);
}
@@ -2689,7 +2690,7 @@ act_stage3_ip4_config_start (NMDevice *device,
/* Indicate that a critical protocol is about to start */
if (strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0)
nm_platform_wifi_indicate_addressing_running (NM_PLATFORM_GET, nm_device_get_ifindex (device), TRUE);
nm_platform_wifi_indicate_addressing_running (nm_device_get_platform (device), nm_device_get_ifindex (device), TRUE);
return NM_DEVICE_CLASS (nm_device_wifi_parent_class)->act_stage3_ip4_config_start (device, out_config, out_failure_reason);
}
@@ -2713,7 +2714,7 @@ act_stage3_ip6_config_start (NMDevice *device,
/* Indicate that a critical protocol is about to start */
if (strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_AUTO) == 0 ||
strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_DHCP) == 0)
nm_platform_wifi_indicate_addressing_running (NM_PLATFORM_GET, nm_device_get_ifindex (device), TRUE);
nm_platform_wifi_indicate_addressing_running (nm_device_get_platform (device), nm_device_get_ifindex (device), TRUE);
return NM_DEVICE_CLASS (nm_device_wifi_parent_class)->act_stage3_ip6_config_start (device, out_config, out_failure_reason);
}
@@ -2870,7 +2871,7 @@ activation_success_handler (NMDevice *device)
applied_connection = nm_act_request_get_applied_connection (req);
/* Clear any critical protocol notification in the wifi stack */
nm_platform_wifi_indicate_addressing_running (NM_PLATFORM_GET, ifindex, FALSE);
nm_platform_wifi_indicate_addressing_running (nm_device_get_platform (device), ifindex, FALSE);
/* Clear wireless secrets tries on success */
g_object_set_qdata (G_OBJECT (applied_connection), wireless_secrets_tries_quark (), NULL);
@@ -2893,16 +2894,16 @@ activation_success_handler (NMDevice *device)
guint8 bssid[ETH_ALEN] = { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 };
gs_free char *bssid_str = NULL;
if ( nm_platform_wifi_get_bssid (NM_PLATFORM_GET, ifindex, bssid)
if ( nm_platform_wifi_get_bssid (nm_device_get_platform (device), ifindex, bssid)
&& nm_ethernet_address_is_valid (bssid, ETH_ALEN)) {
bssid_str = nm_utils_hwaddr_ntoa (bssid, ETH_ALEN);
ap_changed |= nm_wifi_ap_set_address (priv->current_ap, bssid_str);
}
}
if (!nm_wifi_ap_get_freq (priv->current_ap))
ap_changed |= nm_wifi_ap_set_freq (priv->current_ap, nm_platform_wifi_get_frequency (NM_PLATFORM_GET, ifindex));
ap_changed |= nm_wifi_ap_set_freq (priv->current_ap, nm_platform_wifi_get_frequency (nm_device_get_platform (device), ifindex));
if (!nm_wifi_ap_get_max_bitrate (priv->current_ap))
ap_changed |= nm_wifi_ap_set_max_bitrate (priv->current_ap, nm_platform_wifi_get_rate (NM_PLATFORM_GET, ifindex));
ap_changed |= nm_wifi_ap_set_max_bitrate (priv->current_ap, nm_platform_wifi_get_rate (nm_device_get_platform (device), ifindex));
if (ap_changed)
_ap_dump (self, LOGL_DEBUG, priv->current_ap, "updated", 0);
@@ -2932,7 +2933,7 @@ activation_failure_handler (NMDevice *device)
g_object_set_qdata (G_OBJECT (applied_connection), wireless_secrets_tries_quark (), NULL);
/* Clear any critical protocol notification in the wifi stack */
nm_platform_wifi_indicate_addressing_running (NM_PLATFORM_GET, nm_device_get_ifindex (device), FALSE);
nm_platform_wifi_indicate_addressing_running (nm_device_get_platform (device), nm_device_get_ifindex (device), FALSE);
}
static void
@@ -2983,7 +2984,7 @@ device_state_changed (NMDevice *device,
break;
case NM_DEVICE_STATE_IP_CHECK:
/* Clear any critical protocol notification in the wifi stack */
nm_platform_wifi_indicate_addressing_running (NM_PLATFORM_GET, nm_device_get_ifindex (device), FALSE);
nm_platform_wifi_indicate_addressing_running (nm_device_get_platform (device), nm_device_get_ifindex (device), FALSE);
break;
case NM_DEVICE_STATE_ACTIVATED:
activation_success_handler (device);

View File

@@ -686,7 +686,7 @@ nm_modem_ip4_pre_commit (NMModem *modem,
g_assert (address);
if (address->plen == 32)
nm_platform_link_set_noarp (NM_PLATFORM_GET, nm_device_get_ip_ifindex (device));
nm_platform_link_set_noarp (nm_device_get_platform (device), nm_device_get_ip_ifindex (device));
}
}
@@ -1071,8 +1071,8 @@ deactivate_cleanup (NMModem *self, NMDevice *device)
if (ifindex > 0) {
nm_route_manager_route_flush (nm_netns_get_route_manager (nm_device_get_netns (device)),
ifindex);
nm_platform_address_flush (NM_PLATFORM_GET, ifindex);
nm_platform_link_set_down (NM_PLATFORM_GET, ifindex);
nm_platform_address_flush (nm_device_get_platform (device), ifindex);
nm_platform_link_set_down (nm_device_get_platform (device), ifindex);
}
}
}

View File

@@ -393,9 +393,9 @@ vpn_cleanup (NMVpnConnection *self, NMDevice *parent_dev)
NMVpnConnectionPrivate *priv = NM_VPN_CONNECTION_GET_PRIVATE (self);
if (priv->ip_ifindex) {
nm_platform_link_set_down (NM_PLATFORM_GET, priv->ip_ifindex);
nm_platform_link_set_down (nm_netns_get_platform (priv->netns), priv->ip_ifindex);
nm_route_manager_route_flush (nm_netns_get_route_manager (priv->netns), priv->ip_ifindex);
nm_platform_address_flush (NM_PLATFORM_GET, priv->ip_ifindex);
nm_platform_address_flush (nm_netns_get_platform (priv->netns), priv->ip_ifindex);
}
remove_parent_device_config (self, parent_dev);
@@ -1091,11 +1091,11 @@ nm_vpn_connection_apply_config (NMVpnConnection *self)
NMVpnConnectionPrivate *priv = NM_VPN_CONNECTION_GET_PRIVATE (self);
if (priv->ip_ifindex > 0) {
nm_platform_link_set_up (NM_PLATFORM_GET, priv->ip_ifindex, NULL);
nm_platform_link_set_up (nm_netns_get_platform (priv->netns), priv->ip_ifindex, NULL);
if (priv->ip4_config) {
if (!nm_ip4_config_commit (priv->ip4_config,
NM_PLATFORM_GET,
nm_netns_get_platform (priv->netns),
nm_netns_get_route_manager (priv->netns),
priv->ip_ifindex,
TRUE,
@@ -1105,15 +1105,15 @@ nm_vpn_connection_apply_config (NMVpnConnection *self)
if (priv->ip6_config) {
if (!nm_ip6_config_commit (priv->ip6_config,
NM_PLATFORM_GET,
nm_netns_get_platform (priv->netns),
nm_netns_get_route_manager (priv->netns),
priv->ip_ifindex,
TRUE))
return FALSE;
}
if (priv->mtu && priv->mtu != nm_platform_link_get_mtu (NM_PLATFORM_GET, priv->ip_ifindex))
nm_platform_link_set_mtu (NM_PLATFORM_GET, priv->ip_ifindex, priv->mtu);
if (priv->mtu && priv->mtu != nm_platform_link_get_mtu (nm_netns_get_platform (priv->netns), priv->ip_ifindex))
nm_platform_link_set_mtu (nm_netns_get_platform (priv->netns), priv->ip_ifindex, priv->mtu);
}
apply_parent_device_config (self);
@@ -1272,10 +1272,10 @@ process_generic_config (NMVpnConnection *self, GVariant *dict)
if (priv->ip_iface) {
/* Grab the interface index for address/routing operations */
priv->ip_ifindex = nm_platform_link_get_ifindex (NM_PLATFORM_GET, priv->ip_iface);
priv->ip_ifindex = nm_platform_link_get_ifindex (nm_netns_get_platform (priv->netns), priv->ip_iface);
if (priv->ip_ifindex <= 0) {
nm_platform_process_events (NM_PLATFORM_GET);
priv->ip_ifindex = nm_platform_link_get_ifindex (NM_PLATFORM_GET, priv->ip_iface);
nm_platform_process_events (nm_netns_get_platform (priv->netns));
priv->ip_ifindex = nm_platform_link_get_ifindex (nm_netns_get_platform (priv->netns), priv->ip_iface);
}
if (priv->ip_ifindex <= 0) {
_LOGE ("failed to look up VPN interface index for \"%s\"", priv->ip_iface);
@@ -2650,8 +2650,6 @@ dispose (GObject *object)
fw_call_cleanup (self);
G_OBJECT_CLASS (nm_vpn_connection_parent_class)->dispose (object);
g_clear_object (&priv->netns);
}
static void
@@ -2666,6 +2664,8 @@ finalize (GObject *object)
g_free (priv->ip6_external_gw);
G_OBJECT_CLASS (nm_vpn_connection_parent_class)->finalize (object);
g_clear_object (&priv->netns);
}
static gboolean