device: rename device-state-reason argument to out_failure_reason
This argument is only relevant when the NMActStageReturn argument indicates NM_ACT_STAGE_RETURN_FAILURE. In all other cases it is ignored. Rename the argument to make the meaning clearer. The argument is passed through several layers of code, it isn't obvious that this argument only matters for the failure case. Also, the distinct name makes it easier to distinguish from other uses of the "reason" name. While at it, do some drive-by cleanup: - use g_return_*() instead of g_assert() to have a more graceful assertion. - functions like dhcp4_start() don't need to return a failure reason. Most callers don't care, and the caller who does can determine the proper reason. - allow omitting the out-argument via NM_SET_OUT().
This commit is contained in:
@@ -329,12 +329,12 @@ nas_update_cb (gpointer user_data)
|
||||
static NMActStageReturn
|
||||
br2684_create_iface (NMDeviceAdsl *self,
|
||||
NMSettingAdsl *s_adsl,
|
||||
NMDeviceStateReason *out_reason)
|
||||
NMDeviceStateReason *out_failure_reason)
|
||||
{
|
||||
NMDeviceAdslPrivate *priv = NM_DEVICE_ADSL_GET_PRIVATE (self);
|
||||
struct atm_newif_br2684 ni;
|
||||
int err, fd, errsv;
|
||||
NMActStageReturn ret = NM_ACT_STAGE_RETURN_FAILURE;
|
||||
nm_auto_close int fd = -1;
|
||||
int err, errsv;
|
||||
guint num = 0;
|
||||
|
||||
g_return_val_if_fail (s_adsl != NULL, FALSE);
|
||||
@@ -348,7 +348,7 @@ br2684_create_iface (NMDeviceAdsl *self,
|
||||
if (fd < 0) {
|
||||
errsv = errno;
|
||||
_LOGE (LOGD_ADSL, "failed to open ATM control socket (%d)", errsv);
|
||||
*out_reason = NM_DEVICE_STATE_REASON_BR2684_FAILED;
|
||||
NM_SET_OUT (out_failure_reason, NM_DEVICE_STATE_REASON_BR2684_FAILED);
|
||||
return NM_ACT_STAGE_RETURN_FAILURE;
|
||||
}
|
||||
|
||||
@@ -374,39 +374,36 @@ br2684_create_iface (NMDeviceAdsl *self,
|
||||
|
||||
priv->nas_update_count = 0;
|
||||
priv->nas_update_id = g_timeout_add (100, nas_update_cb, self);
|
||||
ret = NM_ACT_STAGE_RETURN_POSTPONE;
|
||||
break;
|
||||
} else if (errno != EEXIST) {
|
||||
return NM_ACT_STAGE_RETURN_POSTPONE;
|
||||
}
|
||||
if (errno != EEXIST) {
|
||||
errsv = errno;
|
||||
_LOGW (LOGD_ADSL, "failed to create br2684 interface (%d)", errsv);
|
||||
*out_reason = NM_DEVICE_STATE_REASON_BR2684_FAILED;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
close (fd);
|
||||
return ret;
|
||||
NM_SET_OUT (out_failure_reason, NM_DEVICE_STATE_REASON_BR2684_FAILED);
|
||||
return NM_ACT_STAGE_RETURN_FAILURE;
|
||||
}
|
||||
|
||||
static NMActStageReturn
|
||||
act_stage2_config (NMDevice *device, NMDeviceStateReason *out_reason)
|
||||
act_stage2_config (NMDevice *device, NMDeviceStateReason *out_failure_reason)
|
||||
{
|
||||
NMDeviceAdsl *self = NM_DEVICE_ADSL (device);
|
||||
NMActStageReturn ret = NM_ACT_STAGE_RETURN_FAILURE;
|
||||
NMSettingAdsl *s_adsl;
|
||||
const char *protocol;
|
||||
|
||||
g_assert (out_reason);
|
||||
|
||||
s_adsl = nm_connection_get_setting_adsl (nm_device_get_applied_connection (device));
|
||||
g_assert (s_adsl);
|
||||
g_return_val_if_fail (s_adsl, NM_ACT_STAGE_RETURN_FAILURE);
|
||||
|
||||
protocol = nm_setting_adsl_get_protocol (s_adsl);
|
||||
_LOGD (LOGD_ADSL, "using ADSL protocol '%s'", protocol);
|
||||
|
||||
if (g_strcmp0 (protocol, NM_SETTING_ADSL_PROTOCOL_PPPOE) == 0) {
|
||||
/* PPPoE needs RFC2684 bridging before we can do PPP over it */
|
||||
ret = br2684_create_iface (self, s_adsl, out_reason);
|
||||
ret = br2684_create_iface (self, s_adsl, out_failure_reason);
|
||||
} else if (g_strcmp0 (protocol, NM_SETTING_ADSL_PROTOCOL_PPPOA) == 0) {
|
||||
/* PPPoA doesn't need anything special */
|
||||
ret = NM_ACT_STAGE_RETURN_SUCCESS;
|
||||
@@ -451,20 +448,19 @@ ppp_ip4_config (NMPPPManager *ppp_manager,
|
||||
static NMActStageReturn
|
||||
act_stage3_ip4_config_start (NMDevice *device,
|
||||
NMIP4Config **out_config,
|
||||
NMDeviceStateReason *reason)
|
||||
NMDeviceStateReason *out_failure_reason)
|
||||
{
|
||||
NMDeviceAdsl *self = NM_DEVICE_ADSL (device);
|
||||
NMDeviceAdslPrivate *priv = NM_DEVICE_ADSL_GET_PRIVATE (self);
|
||||
NMSettingAdsl *s_adsl;
|
||||
NMActRequest *req;
|
||||
GError *err = NULL;
|
||||
NMActStageReturn ret = NM_ACT_STAGE_RETURN_FAILURE;
|
||||
const char *ppp_iface;
|
||||
|
||||
req = nm_device_get_act_request (device);
|
||||
g_assert (req);
|
||||
g_return_val_if_fail (req, NM_ACT_STAGE_RETURN_FAILURE);
|
||||
s_adsl = (NMSettingAdsl *) nm_device_get_applied_setting (device, NM_TYPE_SETTING_ADSL);
|
||||
g_assert (s_adsl);
|
||||
g_return_val_if_fail (s_adsl, NM_ACT_STAGE_RETURN_FAILURE);
|
||||
|
||||
/* PPPoE uses the NAS interface, not the ATM interface */
|
||||
if (g_strcmp0 (nm_setting_adsl_get_protocol (s_adsl), NM_SETTING_ADSL_PROTOCOL_PPPOE) == 0) {
|
||||
@@ -478,27 +474,26 @@ act_stage3_ip4_config_start (NMDevice *device,
|
||||
}
|
||||
|
||||
priv->ppp_manager = nm_ppp_manager_create (ppp_iface, &err);
|
||||
if ( priv->ppp_manager
|
||||
&& nm_ppp_manager_start (priv->ppp_manager, req,
|
||||
if ( !priv->ppp_manager
|
||||
|| !nm_ppp_manager_start (priv->ppp_manager, req,
|
||||
nm_setting_adsl_get_username (s_adsl),
|
||||
30, 0, &err)) {
|
||||
_LOGW (LOGD_ADSL, "PPP failed to start: %s", err->message);
|
||||
g_error_free (err);
|
||||
|
||||
g_clear_object (&priv->ppp_manager);
|
||||
|
||||
NM_SET_OUT (out_failure_reason, NM_DEVICE_STATE_REASON_PPP_START_FAILED);
|
||||
return NM_ACT_STAGE_RETURN_FAILURE;
|
||||
}
|
||||
|
||||
g_signal_connect (priv->ppp_manager, NM_PPP_MANAGER_SIGNAL_STATE_CHANGED,
|
||||
G_CALLBACK (ppp_state_changed),
|
||||
self);
|
||||
g_signal_connect (priv->ppp_manager, NM_PPP_MANAGER_SIGNAL_IP4_CONFIG,
|
||||
G_CALLBACK (ppp_ip4_config),
|
||||
self);
|
||||
ret = NM_ACT_STAGE_RETURN_POSTPONE;
|
||||
} else {
|
||||
_LOGW (LOGD_ADSL, "PPP failed to start: %s", err->message);
|
||||
g_error_free (err);
|
||||
|
||||
g_clear_object (&priv->ppp_manager);
|
||||
|
||||
*reason = NM_DEVICE_STATE_REASON_PPP_START_FAILED;
|
||||
}
|
||||
|
||||
return ret;
|
||||
return NM_ACT_STAGE_RETURN_POSTPONE;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@@ -99,7 +99,7 @@ G_DEFINE_TYPE (NMDeviceBt, nm_device_bt, NM_TYPE_DEVICE)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static gboolean modem_stage1 (NMDeviceBt *self, NMModem *modem, NMDeviceStateReason *reason);
|
||||
static gboolean modem_stage1 (NMDeviceBt *self, NMModem *modem, NMDeviceStateReason *out_failure_reason);
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
@@ -430,17 +430,18 @@ modem_auth_result (NMModem *modem, GError *error, gpointer user_data)
|
||||
{
|
||||
NMDevice *device = NM_DEVICE (user_data);
|
||||
NMDeviceBtPrivate *priv = NM_DEVICE_BT_GET_PRIVATE ((NMDeviceBt *) device);
|
||||
NMDeviceStateReason reason = NM_DEVICE_STATE_REASON_NONE;
|
||||
|
||||
if (error) {
|
||||
nm_device_state_changed (device,
|
||||
NM_DEVICE_STATE_FAILED,
|
||||
NM_DEVICE_STATE_REASON_NO_SECRETS);
|
||||
} else {
|
||||
NMDeviceStateReason failure_reason = NM_DEVICE_STATE_REASON_NONE;
|
||||
|
||||
/* Otherwise, on success for GSM/CDMA secrets we need to schedule modem stage1 again */
|
||||
g_return_if_fail (nm_device_get_state (device) == NM_DEVICE_STATE_NEED_AUTH);
|
||||
if (!modem_stage1 (NM_DEVICE_BT (device), priv->modem, &reason))
|
||||
nm_device_state_changed (device, NM_DEVICE_STATE_FAILED, reason);
|
||||
if (!modem_stage1 (NM_DEVICE_BT (device), priv->modem, &failure_reason))
|
||||
nm_device_state_changed (device, NM_DEVICE_STATE_FAILED, failure_reason);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -460,12 +461,12 @@ modem_prepare_result (NMModem *modem,
|
||||
if (success) {
|
||||
NMActRequest *req;
|
||||
NMActStageReturn ret;
|
||||
NMDeviceStateReason stage2_reason = NM_DEVICE_STATE_REASON_NONE;
|
||||
NMDeviceStateReason failure_reason = NM_DEVICE_STATE_REASON_NONE;
|
||||
|
||||
req = nm_device_get_act_request (device);
|
||||
g_assert (req);
|
||||
g_return_if_fail (req);
|
||||
|
||||
ret = nm_modem_act_stage2_config (modem, req, &stage2_reason);
|
||||
ret = nm_modem_act_stage2_config (modem, req, &failure_reason);
|
||||
switch (ret) {
|
||||
case NM_ACT_STAGE_RETURN_POSTPONE:
|
||||
break;
|
||||
@@ -474,7 +475,7 @@ modem_prepare_result (NMModem *modem,
|
||||
break;
|
||||
case NM_ACT_STAGE_RETURN_FAILURE:
|
||||
default:
|
||||
nm_device_state_changed (device, NM_DEVICE_STATE_FAILED, stage2_reason);
|
||||
nm_device_state_changed (device, NM_DEVICE_STATE_FAILED, failure_reason);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
@@ -541,17 +542,15 @@ data_port_changed_cb (NMModem *modem, GParamSpec *pspec, gpointer user_data)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
modem_stage1 (NMDeviceBt *self, NMModem *modem, NMDeviceStateReason *reason)
|
||||
modem_stage1 (NMDeviceBt *self, NMModem *modem, NMDeviceStateReason *out_failure_reason)
|
||||
{
|
||||
NMActRequest *req;
|
||||
NMActStageReturn ret;
|
||||
|
||||
g_return_val_if_fail (reason != NULL, FALSE);
|
||||
|
||||
req = nm_device_get_act_request (NM_DEVICE (self));
|
||||
g_assert (req);
|
||||
g_return_val_if_fail (req, FALSE);
|
||||
|
||||
ret = nm_modem_act_stage1_prepare (modem, req, reason);
|
||||
ret = nm_modem_act_stage1_prepare (modem, req, out_failure_reason);
|
||||
switch (ret) {
|
||||
case NM_ACT_STAGE_RETURN_POSTPONE:
|
||||
case NM_ACT_STAGE_RETURN_SUCCESS:
|
||||
@@ -639,7 +638,7 @@ component_added (NMDevice *device, GObject *component)
|
||||
const gchar *modem_control_port;
|
||||
char *base;
|
||||
NMDeviceState state;
|
||||
NMDeviceStateReason reason = NM_DEVICE_STATE_REASON_NONE;
|
||||
NMDeviceStateReason failure_reason = NM_DEVICE_STATE_REASON_NONE;
|
||||
|
||||
if (!NM_IS_MODEM (component))
|
||||
return FALSE;
|
||||
@@ -694,8 +693,8 @@ component_added (NMDevice *device, GObject *component)
|
||||
g_signal_connect (modem, "notify::" NM_MODEM_DATA_PORT, G_CALLBACK (data_port_changed_cb), self);
|
||||
|
||||
/* Kick off the modem connection */
|
||||
if (!modem_stage1 (self, modem, &reason))
|
||||
nm_device_state_changed (NM_DEVICE (self), NM_DEVICE_STATE_FAILED, reason);
|
||||
if (!modem_stage1 (self, modem, &failure_reason))
|
||||
nm_device_state_changed (NM_DEVICE (self), NM_DEVICE_STATE_FAILED, failure_reason);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -836,14 +835,15 @@ bt_connect_timeout (gpointer user_data)
|
||||
}
|
||||
|
||||
static NMActStageReturn
|
||||
act_stage2_config (NMDevice *device, NMDeviceStateReason *reason)
|
||||
act_stage2_config (NMDevice *device, NMDeviceStateReason *out_failure_reason)
|
||||
{
|
||||
NMDeviceBt *self = NM_DEVICE_BT (device);
|
||||
NMDeviceBtPrivate *priv = NM_DEVICE_BT_GET_PRIVATE (self);
|
||||
NMConnection *connection;
|
||||
|
||||
connection = nm_device_get_applied_connection (device);
|
||||
g_assert (connection);
|
||||
g_return_val_if_fail (connection, NM_ACT_STAGE_RETURN_FAILURE);
|
||||
|
||||
priv->bt_type = get_connection_bt_type (connection);
|
||||
if (priv->bt_type == NM_BT_CAPABILITY_NONE) {
|
||||
// FIXME: set a reason code
|
||||
@@ -851,7 +851,7 @@ act_stage2_config (NMDevice *device, NMDeviceStateReason *reason)
|
||||
}
|
||||
|
||||
if (priv->bt_type == NM_BT_CAPABILITY_DUN && !priv->mm_running) {
|
||||
*reason = NM_DEVICE_STATE_REASON_MODEM_MANAGER_UNAVAILABLE;
|
||||
NM_SET_OUT (out_failure_reason, NM_DEVICE_STATE_REASON_MODEM_MANAGER_UNAVAILABLE);
|
||||
return NM_ACT_STAGE_RETURN_FAILURE;
|
||||
}
|
||||
|
||||
@@ -862,8 +862,7 @@ act_stage2_config (NMDevice *device, NMDeviceStateReason *reason)
|
||||
priv->bt_type & (NM_BT_CAPABILITY_DUN | NM_BT_CAPABILITY_NAP),
|
||||
bluez_connect_cb, g_object_ref (device));
|
||||
|
||||
if (priv->timeout_id)
|
||||
g_source_remove (priv->timeout_id);
|
||||
nm_clear_g_source (&priv->timeout_id);
|
||||
priv->timeout_id = g_timeout_add_seconds (30, bt_connect_timeout, device);
|
||||
|
||||
return NM_ACT_STAGE_RETURN_POSTPONE;
|
||||
@@ -872,38 +871,34 @@ act_stage2_config (NMDevice *device, NMDeviceStateReason *reason)
|
||||
static NMActStageReturn
|
||||
act_stage3_ip4_config_start (NMDevice *device,
|
||||
NMIP4Config **out_config,
|
||||
NMDeviceStateReason *reason)
|
||||
NMDeviceStateReason *out_failure_reason)
|
||||
{
|
||||
NMDeviceBtPrivate *priv = NM_DEVICE_BT_GET_PRIVATE ((NMDeviceBt *) device);
|
||||
NMActStageReturn ret;
|
||||
|
||||
if (priv->bt_type == NM_BT_CAPABILITY_DUN) {
|
||||
ret = nm_modem_stage3_ip4_config_start (priv->modem,
|
||||
return nm_modem_stage3_ip4_config_start (priv->modem,
|
||||
device,
|
||||
NM_DEVICE_CLASS (nm_device_bt_parent_class),
|
||||
reason);
|
||||
} else
|
||||
ret = NM_DEVICE_CLASS (nm_device_bt_parent_class)->act_stage3_ip4_config_start (device, out_config, reason);
|
||||
out_failure_reason);
|
||||
}
|
||||
|
||||
return ret;
|
||||
return NM_DEVICE_CLASS (nm_device_bt_parent_class)->act_stage3_ip4_config_start (device, out_config, out_failure_reason);
|
||||
}
|
||||
|
||||
static NMActStageReturn
|
||||
act_stage3_ip6_config_start (NMDevice *device,
|
||||
NMIP6Config **out_config,
|
||||
NMDeviceStateReason *reason)
|
||||
NMDeviceStateReason *out_failure_reason)
|
||||
{
|
||||
NMDeviceBtPrivate *priv = NM_DEVICE_BT_GET_PRIVATE ((NMDeviceBt *) device);
|
||||
NMActStageReturn ret;
|
||||
|
||||
if (priv->bt_type == NM_BT_CAPABILITY_DUN) {
|
||||
ret = nm_modem_stage3_ip6_config_start (priv->modem,
|
||||
return nm_modem_stage3_ip6_config_start (priv->modem,
|
||||
nm_device_get_act_request (device),
|
||||
reason);
|
||||
} else
|
||||
ret = NM_DEVICE_CLASS (nm_device_bt_parent_class)->act_stage3_ip6_config_start (device, out_config, reason);
|
||||
out_failure_reason);
|
||||
}
|
||||
|
||||
return ret;
|
||||
return NM_DEVICE_CLASS (nm_device_bt_parent_class)->act_stage3_ip6_config_start (device, out_config, out_failure_reason);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@@ -363,21 +363,19 @@ apply_bonding_config (NMDevice *device)
|
||||
}
|
||||
|
||||
static NMActStageReturn
|
||||
act_stage1_prepare (NMDevice *dev, NMDeviceStateReason *reason)
|
||||
act_stage1_prepare (NMDevice *dev, NMDeviceStateReason *out_failure_reason)
|
||||
{
|
||||
NMActStageReturn ret = NM_ACT_STAGE_RETURN_SUCCESS;
|
||||
gboolean no_firmware = FALSE;
|
||||
|
||||
g_return_val_if_fail (reason != NULL, NM_ACT_STAGE_RETURN_FAILURE);
|
||||
|
||||
ret = NM_DEVICE_CLASS (nm_device_bond_parent_class)->act_stage1_prepare (dev, reason);
|
||||
ret = NM_DEVICE_CLASS (nm_device_bond_parent_class)->act_stage1_prepare (dev, out_failure_reason);
|
||||
if (ret != NM_ACT_STAGE_RETURN_SUCCESS)
|
||||
return ret;
|
||||
|
||||
/* Interface must be down to set bond options */
|
||||
nm_device_take_down (dev, TRUE);
|
||||
ret = apply_bonding_config (dev);
|
||||
if (ret)
|
||||
if (ret != NM_ACT_STAGE_RETURN_FAILURE)
|
||||
ret = nm_device_hw_addr_set_cloned (dev, nm_device_get_applied_connection (dev), FALSE);
|
||||
nm_device_bring_up (dev, TRUE, &no_firmware);
|
||||
|
||||
|
@@ -305,14 +305,14 @@ master_update_slave_connection (NMDevice *device,
|
||||
}
|
||||
|
||||
static NMActStageReturn
|
||||
act_stage1_prepare (NMDevice *device, NMDeviceStateReason *reason)
|
||||
act_stage1_prepare (NMDevice *device, NMDeviceStateReason *out_failure_reason)
|
||||
{
|
||||
NMActStageReturn ret;
|
||||
NMConnection *connection = nm_device_get_applied_connection (device);
|
||||
|
||||
g_assert (connection);
|
||||
g_return_val_if_fail (connection, NM_ACT_STAGE_RETURN_FAILURE);
|
||||
|
||||
ret = NM_DEVICE_CLASS (nm_device_bridge_parent_class)->act_stage1_prepare (device, reason);
|
||||
ret = NM_DEVICE_CLASS (nm_device_bridge_parent_class)->act_stage1_prepare (device, out_failure_reason);
|
||||
if (ret != NM_ACT_STAGE_RETURN_SUCCESS)
|
||||
return ret;
|
||||
|
||||
|
@@ -874,15 +874,13 @@ pppoe_reconnect_delay (gpointer user_data)
|
||||
}
|
||||
|
||||
static NMActStageReturn
|
||||
act_stage1_prepare (NMDevice *dev, NMDeviceStateReason *reason)
|
||||
act_stage1_prepare (NMDevice *dev, NMDeviceStateReason *out_failure_reason)
|
||||
{
|
||||
NMDeviceEthernet *self = NM_DEVICE_ETHERNET (dev);
|
||||
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self);
|
||||
NMActStageReturn ret;
|
||||
|
||||
g_return_val_if_fail (reason != NULL, NM_ACT_STAGE_RETURN_FAILURE);
|
||||
|
||||
ret = NM_DEVICE_CLASS (nm_device_ethernet_parent_class)->act_stage1_prepare (dev, reason);
|
||||
ret = NM_DEVICE_CLASS (nm_device_ethernet_parent_class)->act_stage1_prepare (dev, out_failure_reason);
|
||||
if (ret != NM_ACT_STAGE_RETURN_SUCCESS)
|
||||
return ret;
|
||||
|
||||
@@ -916,7 +914,7 @@ act_stage1_prepare (NMDevice *dev, NMDeviceStateReason *reason)
|
||||
}
|
||||
|
||||
static NMActStageReturn
|
||||
nm_8021x_stage2_config (NMDeviceEthernet *self, NMDeviceStateReason *reason)
|
||||
nm_8021x_stage2_config (NMDeviceEthernet *self, NMDeviceStateReason *out_failure_reason)
|
||||
{
|
||||
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self);
|
||||
NMConnection *connection;
|
||||
@@ -925,11 +923,12 @@ nm_8021x_stage2_config (NMDeviceEthernet *self, NMDeviceStateReason *reason)
|
||||
NMActStageReturn ret = NM_ACT_STAGE_RETURN_FAILURE;
|
||||
|
||||
connection = nm_device_get_applied_connection (NM_DEVICE (self));
|
||||
g_assert (connection);
|
||||
g_return_val_if_fail (connection, NM_ACT_STAGE_RETURN_FAILURE);
|
||||
|
||||
security = nm_connection_get_setting_802_1x (connection);
|
||||
if (!security) {
|
||||
_LOGE (LOGD_DEVICE, "Invalid or missing 802.1X security");
|
||||
*reason = NM_DEVICE_STATE_REASON_CONFIG_FAILED;
|
||||
NM_SET_OUT (out_failure_reason, NM_DEVICE_STATE_REASON_CONFIG_FAILED);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -947,7 +946,7 @@ nm_8021x_stage2_config (NMDeviceEthernet *self, NMDeviceStateReason *reason)
|
||||
|
||||
ret = handle_auth_or_fail (self, req, FALSE);
|
||||
if (ret != NM_ACT_STAGE_RETURN_POSTPONE)
|
||||
*reason = NM_DEVICE_STATE_REASON_NO_SECRETS;
|
||||
NM_SET_OUT (out_failure_reason, NM_DEVICE_STATE_REASON_NO_SECRETS);
|
||||
} else {
|
||||
_LOGI (LOGD_DEVICE | LOGD_ETHER,
|
||||
"Activation: (ethernet) connection '%s' requires no security. No secrets needed.",
|
||||
@@ -956,7 +955,7 @@ nm_8021x_stage2_config (NMDeviceEthernet *self, NMDeviceStateReason *reason)
|
||||
if (supplicant_interface_init (self))
|
||||
ret = NM_ACT_STAGE_RETURN_POSTPONE;
|
||||
else
|
||||
*reason = NM_DEVICE_STATE_REASON_CONFIG_FAILED;
|
||||
NM_SET_OUT (out_failure_reason, NM_DEVICE_STATE_REASON_CONFIG_FAILED);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -998,43 +997,42 @@ ppp_ip4_config (NMPPPManager *ppp_manager,
|
||||
}
|
||||
|
||||
static NMActStageReturn
|
||||
pppoe_stage3_ip4_config_start (NMDeviceEthernet *self, NMDeviceStateReason *reason)
|
||||
pppoe_stage3_ip4_config_start (NMDeviceEthernet *self, NMDeviceStateReason *out_failure_reason)
|
||||
{
|
||||
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self);
|
||||
NMSettingPppoe *s_pppoe;
|
||||
NMActRequest *req;
|
||||
GError *err = NULL;
|
||||
NMActStageReturn ret = NM_ACT_STAGE_RETURN_FAILURE;
|
||||
|
||||
req = nm_device_get_act_request (NM_DEVICE (self));
|
||||
g_assert (req);
|
||||
g_return_val_if_fail (req, NM_ACT_STAGE_RETURN_FAILURE);
|
||||
|
||||
s_pppoe = (NMSettingPppoe *) nm_device_get_applied_setting ((NMDevice *) self, NM_TYPE_SETTING_PPPOE);
|
||||
g_assert (s_pppoe);
|
||||
g_return_val_if_fail (s_pppoe, NM_ACT_STAGE_RETURN_FAILURE);
|
||||
|
||||
priv->ppp_manager = nm_ppp_manager_create (nm_device_get_iface (NM_DEVICE (self)),
|
||||
&err);
|
||||
if ( priv->ppp_manager
|
||||
&& nm_ppp_manager_start (priv->ppp_manager, req,
|
||||
|
||||
if ( !priv->ppp_manager
|
||||
|| !nm_ppp_manager_start (priv->ppp_manager, req,
|
||||
nm_setting_pppoe_get_username (s_pppoe),
|
||||
30, 0, &err)) {
|
||||
_LOGW (LOGD_DEVICE, "PPPoE failed to start: %s", err->message);
|
||||
g_error_free (err);
|
||||
|
||||
g_clear_object (&priv->ppp_manager);
|
||||
|
||||
NM_SET_OUT (out_failure_reason, NM_DEVICE_STATE_REASON_PPP_START_FAILED);
|
||||
return NM_ACT_STAGE_RETURN_FAILURE;
|
||||
}
|
||||
|
||||
g_signal_connect (priv->ppp_manager, NM_PPP_MANAGER_SIGNAL_STATE_CHANGED,
|
||||
G_CALLBACK (ppp_state_changed),
|
||||
self);
|
||||
g_signal_connect (priv->ppp_manager, NM_PPP_MANAGER_SIGNAL_IP4_CONFIG,
|
||||
G_CALLBACK (ppp_ip4_config),
|
||||
self);
|
||||
ret = NM_ACT_STAGE_RETURN_POSTPONE;
|
||||
} else {
|
||||
_LOGW (LOGD_DEVICE, "PPPoE failed to start: %s", err->message);
|
||||
g_error_free (err);
|
||||
|
||||
g_clear_object (&priv->ppp_manager);
|
||||
|
||||
*reason = NM_DEVICE_STATE_REASON_PPP_START_FAILED;
|
||||
}
|
||||
|
||||
return ret;
|
||||
return NM_ACT_STAGE_RETURN_POSTPONE;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -1249,7 +1247,7 @@ found:
|
||||
/*****************************************************************************/
|
||||
|
||||
static NMActStageReturn
|
||||
act_stage2_config (NMDevice *device, NMDeviceStateReason *reason)
|
||||
act_stage2_config (NMDevice *device, NMDeviceStateReason *out_failure_reason)
|
||||
{
|
||||
NMDeviceEthernet *self = (NMDeviceEthernet *) device;
|
||||
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self);
|
||||
@@ -1258,11 +1256,9 @@ act_stage2_config (NMDevice *device, NMDeviceStateReason *reason)
|
||||
NMActStageReturn ret = NM_ACT_STAGE_RETURN_SUCCESS;
|
||||
NMSettingDcb *s_dcb;
|
||||
|
||||
g_return_val_if_fail (reason != NULL, NM_ACT_STAGE_RETURN_FAILURE);
|
||||
|
||||
s_con = NM_SETTING_CONNECTION (nm_device_get_applied_setting (device,
|
||||
NM_TYPE_SETTING_CONNECTION));
|
||||
g_assert (s_con);
|
||||
g_return_val_if_fail (s_con, NM_ACT_STAGE_RETURN_FAILURE);
|
||||
|
||||
nm_clear_g_source (&priv->dcb_timeout_id);
|
||||
nm_clear_g_signal_handler (device, &priv->dcb_carrier_id);
|
||||
@@ -1278,7 +1274,7 @@ act_stage2_config (NMDevice *device, NMDeviceStateReason *reason)
|
||||
NM_TYPE_SETTING_802_1X);
|
||||
if (security) {
|
||||
/* FIXME: for now 802.1x is mutually exclusive with DCB */
|
||||
return nm_8021x_stage2_config (self, reason);
|
||||
return nm_8021x_stage2_config (self, out_failure_reason);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1290,7 +1286,7 @@ act_stage2_config (NMDevice *device, NMDeviceStateReason *reason)
|
||||
/* lldpad really really wants the carrier to be up */
|
||||
if (nm_platform_link_is_connected (NM_PLATFORM_GET, nm_device_get_ifindex (device))) {
|
||||
if (!dcb_enable (device)) {
|
||||
*reason = NM_DEVICE_STATE_REASON_DCB_FCOE_FAILED;
|
||||
NM_SET_OUT (out_failure_reason, NM_DEVICE_STATE_REASON_DCB_FCOE_FAILED);
|
||||
return NM_ACT_STAGE_RETURN_FAILURE;
|
||||
}
|
||||
} else {
|
||||
@@ -1337,21 +1333,19 @@ act_stage2_config (NMDevice *device, NMDeviceStateReason *reason)
|
||||
static NMActStageReturn
|
||||
act_stage3_ip4_config_start (NMDevice *device,
|
||||
NMIP4Config **out_config,
|
||||
NMDeviceStateReason *reason)
|
||||
NMDeviceStateReason *out_failure_reason)
|
||||
{
|
||||
NMSettingConnection *s_con;
|
||||
const char *connection_type;
|
||||
|
||||
g_return_val_if_fail (reason != NULL, NM_ACT_STAGE_RETURN_FAILURE);
|
||||
|
||||
s_con = NM_SETTING_CONNECTION (nm_device_get_applied_setting (device, NM_TYPE_SETTING_CONNECTION));
|
||||
g_assert (s_con);
|
||||
g_return_val_if_fail (s_con, NM_ACT_STAGE_RETURN_FAILURE);
|
||||
|
||||
connection_type = nm_setting_connection_get_connection_type (s_con);
|
||||
if (!strcmp (connection_type, NM_SETTING_PPPOE_SETTING_NAME))
|
||||
return pppoe_stage3_ip4_config_start (NM_DEVICE_ETHERNET (device), reason);
|
||||
return pppoe_stage3_ip4_config_start (NM_DEVICE_ETHERNET (device), out_failure_reason);
|
||||
|
||||
return NM_DEVICE_CLASS (nm_device_ethernet_parent_class)->act_stage3_ip4_config_start (device, out_config, reason);
|
||||
return NM_DEVICE_CLASS (nm_device_ethernet_parent_class)->act_stage3_ip4_config_start (device, out_config, out_failure_reason);
|
||||
}
|
||||
|
||||
static guint32
|
||||
|
@@ -75,7 +75,7 @@ get_generic_capabilities (NMDevice *device)
|
||||
}
|
||||
|
||||
static NMActStageReturn
|
||||
act_stage1_prepare (NMDevice *dev, NMDeviceStateReason *reason)
|
||||
act_stage1_prepare (NMDevice *dev, NMDeviceStateReason *out_failure_reason)
|
||||
{
|
||||
nm_auto_close int dirfd = -1;
|
||||
NMActStageReturn ret;
|
||||
@@ -84,14 +84,12 @@ act_stage1_prepare (NMDevice *dev, NMDeviceStateReason *reason)
|
||||
const char *transport_mode;
|
||||
gboolean ok, no_firmware = FALSE;
|
||||
|
||||
g_return_val_if_fail (reason != NULL, NM_ACT_STAGE_RETURN_FAILURE);
|
||||
|
||||
ret = NM_DEVICE_CLASS (nm_device_infiniband_parent_class)->act_stage1_prepare (dev, reason);
|
||||
ret = NM_DEVICE_CLASS (nm_device_infiniband_parent_class)->act_stage1_prepare (dev, 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);
|
||||
g_assert (s_infiniband);
|
||||
g_return_val_if_fail (s_infiniband, NM_ACT_STAGE_RETURN_FAILURE);
|
||||
|
||||
transport_mode = nm_setting_infiniband_get_transport_mode (s_infiniband);
|
||||
|
||||
@@ -100,7 +98,7 @@ act_stage1_prepare (NMDevice *dev, NMDeviceStateReason *reason)
|
||||
if (!strcmp (transport_mode, "datagram"))
|
||||
return NM_ACT_STAGE_RETURN_SUCCESS;
|
||||
else {
|
||||
*reason = NM_DEVICE_STATE_REASON_INFINIBAND_MODE;
|
||||
NM_SET_OUT (out_failure_reason, NM_DEVICE_STATE_REASON_INFINIBAND_MODE);
|
||||
return NM_ACT_STAGE_RETURN_FAILURE;
|
||||
}
|
||||
}
|
||||
@@ -111,7 +109,7 @@ act_stage1_prepare (NMDevice *dev, NMDeviceStateReason *reason)
|
||||
nm_device_bring_up (dev, TRUE, &no_firmware);
|
||||
|
||||
if (!ok) {
|
||||
*reason = NM_DEVICE_STATE_REASON_CONFIG_FAILED;
|
||||
NM_SET_OUT (out_failure_reason, NM_DEVICE_STATE_REASON_CONFIG_FAILED);
|
||||
return NM_ACT_STAGE_RETURN_FAILURE;
|
||||
}
|
||||
|
||||
|
@@ -585,7 +585,7 @@ supplicant_interface_init (NMDeviceMacsec *self)
|
||||
}
|
||||
|
||||
static NMActStageReturn
|
||||
act_stage2_config (NMDevice *device, NMDeviceStateReason *reason)
|
||||
act_stage2_config (NMDevice *device, NMDeviceStateReason *out_failure_reason)
|
||||
{
|
||||
NMDeviceMacsec *self = NM_DEVICE_MACSEC (device);
|
||||
NMDeviceMacsecPrivate *priv = NM_DEVICE_MACSEC_GET_PRIVATE (self);
|
||||
@@ -594,7 +594,7 @@ act_stage2_config (NMDevice *device, NMDeviceStateReason *reason)
|
||||
const char *setting_name;
|
||||
|
||||
connection = nm_device_get_applied_connection (NM_DEVICE (self));
|
||||
g_assert (connection);
|
||||
g_return_val_if_fail (connection, NM_ACT_STAGE_RETURN_FAILURE);
|
||||
|
||||
if (!priv->supplicant.mgr)
|
||||
priv->supplicant.mgr = g_object_ref (nm_supplicant_manager_get ());
|
||||
@@ -610,7 +610,7 @@ act_stage2_config (NMDevice *device, NMDeviceStateReason *reason)
|
||||
|
||||
ret = handle_auth_or_fail (self, req, FALSE);
|
||||
if (ret != NM_ACT_STAGE_RETURN_POSTPONE)
|
||||
*reason = NM_DEVICE_STATE_REASON_NO_SECRETS;
|
||||
NM_SET_OUT (out_failure_reason, NM_DEVICE_STATE_REASON_NO_SECRETS);
|
||||
} else {
|
||||
_LOGI (LOGD_DEVICE | LOGD_ETHER,
|
||||
"Activation: connection '%s' requires no security. No secrets needed.",
|
||||
@@ -619,7 +619,7 @@ act_stage2_config (NMDevice *device, NMDeviceStateReason *reason)
|
||||
if (supplicant_interface_init (self))
|
||||
ret = NM_ACT_STAGE_RETURN_POSTPONE;
|
||||
else
|
||||
*reason = NM_DEVICE_STATE_REASON_CONFIG_FAILED;
|
||||
NM_SET_OUT (out_failure_reason, NM_DEVICE_STATE_REASON_CONFIG_FAILED);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@@ -474,13 +474,11 @@ update_connection (NMDevice *device, NMConnection *connection)
|
||||
}
|
||||
|
||||
static NMActStageReturn
|
||||
act_stage1_prepare (NMDevice *dev, NMDeviceStateReason *reason)
|
||||
act_stage1_prepare (NMDevice *dev, NMDeviceStateReason *out_failure_reason)
|
||||
{
|
||||
NMActStageReturn ret;
|
||||
|
||||
g_return_val_if_fail (reason != NULL, NM_ACT_STAGE_RETURN_FAILURE);
|
||||
|
||||
ret = NM_DEVICE_CLASS (nm_device_macvlan_parent_class)->act_stage1_prepare (dev, reason);
|
||||
ret = NM_DEVICE_CLASS (nm_device_macvlan_parent_class)->act_stage1_prepare (dev, out_failure_reason);
|
||||
if (ret != NM_ACT_STAGE_RETURN_SUCCESS)
|
||||
return ret;
|
||||
|
||||
|
@@ -291,15 +291,13 @@ check_connection_compatible (NMDevice *device, NMConnection *connection)
|
||||
}
|
||||
|
||||
static NMActStageReturn
|
||||
act_stage1_prepare (NMDevice *device, NMDeviceStateReason *reason)
|
||||
act_stage1_prepare (NMDevice *device, NMDeviceStateReason *out_failure_reason)
|
||||
{
|
||||
NMDeviceTun *self = NM_DEVICE_TUN (device);
|
||||
NMDeviceTunPrivate *priv = NM_DEVICE_TUN_GET_PRIVATE (self);
|
||||
NMActStageReturn ret;
|
||||
|
||||
g_return_val_if_fail (reason != NULL, NM_ACT_STAGE_RETURN_FAILURE);
|
||||
|
||||
ret = NM_DEVICE_CLASS (nm_device_tun_parent_class)->act_stage1_prepare (device, reason);
|
||||
ret = NM_DEVICE_CLASS (nm_device_tun_parent_class)->act_stage1_prepare (device, out_failure_reason);
|
||||
if (ret != NM_ACT_STAGE_RETURN_SUCCESS)
|
||||
return ret;
|
||||
|
||||
|
@@ -522,15 +522,13 @@ update_connection (NMDevice *device, NMConnection *connection)
|
||||
}
|
||||
|
||||
static NMActStageReturn
|
||||
act_stage1_prepare (NMDevice *device, NMDeviceStateReason *reason)
|
||||
act_stage1_prepare (NMDevice *device, NMDeviceStateReason *out_failure_reason)
|
||||
{
|
||||
NMDevice *parent_device;
|
||||
NMSettingVlan *s_vlan;
|
||||
NMActStageReturn ret;
|
||||
|
||||
g_return_val_if_fail (reason != NULL, NM_ACT_STAGE_RETURN_FAILURE);
|
||||
|
||||
ret = NM_DEVICE_CLASS (nm_device_vlan_parent_class)->act_stage1_prepare (device, reason);
|
||||
ret = NM_DEVICE_CLASS (nm_device_vlan_parent_class)->act_stage1_prepare (device, out_failure_reason);
|
||||
if (ret != NM_ACT_STAGE_RETURN_SUCCESS)
|
||||
return ret;
|
||||
|
||||
|
@@ -496,13 +496,11 @@ update_connection (NMDevice *device, NMConnection *connection)
|
||||
}
|
||||
|
||||
static NMActStageReturn
|
||||
act_stage1_prepare (NMDevice *device, NMDeviceStateReason *reason)
|
||||
act_stage1_prepare (NMDevice *device, NMDeviceStateReason *out_failure_reason)
|
||||
{
|
||||
NMActStageReturn ret;
|
||||
|
||||
g_return_val_if_fail (reason != NULL, NM_ACT_STAGE_RETURN_FAILURE);
|
||||
|
||||
ret = NM_DEVICE_CLASS (nm_device_vxlan_parent_class)->act_stage1_prepare (device, reason);
|
||||
ret = NM_DEVICE_CLASS (nm_device_vxlan_parent_class)->act_stage1_prepare (device, out_failure_reason);
|
||||
if (ret != NM_ACT_STAGE_RETURN_SUCCESS)
|
||||
return ret;
|
||||
|
||||
|
@@ -459,7 +459,7 @@ static gboolean nm_device_set_ip4_config (NMDevice *self,
|
||||
guint32 default_route_metric,
|
||||
gboolean commit,
|
||||
gboolean routes_full_sync,
|
||||
NMDeviceStateReason *reason);
|
||||
NMDeviceStateReason *out_reason);
|
||||
static gboolean ip4_config_merge_and_apply (NMDevice *self,
|
||||
NMIP4Config *config,
|
||||
gboolean commit,
|
||||
@@ -469,7 +469,7 @@ static gboolean nm_device_set_ip6_config (NMDevice *self,
|
||||
NMIP6Config *config,
|
||||
gboolean commit,
|
||||
gboolean routes_full_sync,
|
||||
NMDeviceStateReason *reason);
|
||||
NMDeviceStateReason *out_reason);
|
||||
static gboolean ip6_config_merge_and_apply (NMDevice *self,
|
||||
gboolean commit,
|
||||
NMDeviceStateReason *out_reason);
|
||||
@@ -498,8 +498,8 @@ static gboolean queued_ip4_config_change (gpointer user_data);
|
||||
static gboolean queued_ip6_config_change (gpointer user_data);
|
||||
static void ip_check_ping_watch_cb (GPid pid, gint status, gpointer user_data);
|
||||
static gboolean ip_config_valid (NMDeviceState state);
|
||||
static NMActStageReturn dhcp4_start (NMDevice *self, NMConnection *connection, NMDeviceStateReason *reason);
|
||||
static gboolean dhcp6_start (NMDevice *self, gboolean wait_for_ll, NMDeviceStateReason *reason);
|
||||
static NMActStageReturn dhcp4_start (NMDevice *self, NMConnection *connection);
|
||||
static gboolean dhcp6_start (NMDevice *self, gboolean wait_for_ll);
|
||||
static void nm_device_start_ip_check (NMDevice *self);
|
||||
static void realize_start_setup (NMDevice *self, const NMPlatformLink *plink);
|
||||
static void _commit_mtu (NMDevice *self, const NMIP4Config *config);
|
||||
@@ -4220,7 +4220,7 @@ lldp_rx_enabled (NMDevice *self)
|
||||
}
|
||||
|
||||
static NMActStageReturn
|
||||
act_stage1_prepare (NMDevice *self, NMDeviceStateReason *reason)
|
||||
act_stage1_prepare (NMDevice *self, NMDeviceStateReason *out_failure_reason)
|
||||
{
|
||||
return NM_ACT_STAGE_RETURN_SUCCESS;
|
||||
}
|
||||
@@ -4236,7 +4236,7 @@ activate_stage1_device_prepare (NMDevice *self)
|
||||
{
|
||||
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
|
||||
NMActStageReturn ret = NM_ACT_STAGE_RETURN_SUCCESS;
|
||||
NMDeviceStateReason reason = NM_DEVICE_STATE_REASON_NONE;
|
||||
NMDeviceStateReason failure_reason = NM_DEVICE_STATE_REASON_NONE;
|
||||
NMActiveConnection *active = NM_ACTIVE_CONNECTION (priv->act_request);
|
||||
|
||||
_set_ip_state (self, AF_INET, IP_NONE);
|
||||
@@ -4250,14 +4250,14 @@ activate_stage1_device_prepare (NMDevice *self)
|
||||
|
||||
/* Assumed connections were already set up outside NetworkManager */
|
||||
if (!nm_active_connection_get_assumed (active)) {
|
||||
ret = NM_DEVICE_GET_CLASS (self)->act_stage1_prepare (self, &reason);
|
||||
ret = NM_DEVICE_GET_CLASS (self)->act_stage1_prepare (self, &failure_reason);
|
||||
if (ret == NM_ACT_STAGE_RETURN_POSTPONE) {
|
||||
return;
|
||||
} else if (ret == NM_ACT_STAGE_RETURN_FAILURE) {
|
||||
nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, reason);
|
||||
nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, failure_reason);
|
||||
return;
|
||||
}
|
||||
g_assert (ret == NM_ACT_STAGE_RETURN_SUCCESS);
|
||||
g_return_if_fail (ret == NM_ACT_STAGE_RETURN_SUCCESS);
|
||||
}
|
||||
|
||||
nm_device_activate_schedule_stage2_device_config (self);
|
||||
@@ -4284,9 +4284,8 @@ nm_device_activate_schedule_stage1_device_prepare (NMDevice *self)
|
||||
}
|
||||
|
||||
static NMActStageReturn
|
||||
act_stage2_config (NMDevice *self, NMDeviceStateReason *reason)
|
||||
act_stage2_config (NMDevice *self, NMDeviceStateReason *out_failure_reason)
|
||||
{
|
||||
/* Nothing to do */
|
||||
return NM_ACT_STAGE_RETURN_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -4302,7 +4301,6 @@ activate_stage2_device_config (NMDevice *self)
|
||||
{
|
||||
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
|
||||
NMActStageReturn ret;
|
||||
NMDeviceStateReason reason = NM_DEVICE_STATE_REASON_NONE;
|
||||
gboolean no_firmware = FALSE;
|
||||
NMActiveConnection *active = NM_ACTIVE_CONNECTION (priv->act_request);
|
||||
GSList *iter;
|
||||
@@ -4311,6 +4309,8 @@ activate_stage2_device_config (NMDevice *self)
|
||||
|
||||
/* Assumed connections were already set up outside NetworkManager */
|
||||
if (!nm_active_connection_get_assumed (active)) {
|
||||
NMDeviceStateReason failure_reason = NM_DEVICE_STATE_REASON_NONE;
|
||||
|
||||
if (!nm_device_bring_up (self, FALSE, &no_firmware)) {
|
||||
if (no_firmware)
|
||||
nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_FIRMWARE_MISSING);
|
||||
@@ -4319,11 +4319,11 @@ activate_stage2_device_config (NMDevice *self)
|
||||
return;
|
||||
}
|
||||
|
||||
ret = NM_DEVICE_GET_CLASS (self)->act_stage2_config (self, &reason);
|
||||
ret = NM_DEVICE_GET_CLASS (self)->act_stage2_config (self, &failure_reason);
|
||||
if (ret == NM_ACT_STAGE_RETURN_POSTPONE)
|
||||
return;
|
||||
else if (ret == NM_ACT_STAGE_RETURN_FAILURE) {
|
||||
nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, reason);
|
||||
nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, failure_reason);
|
||||
return;
|
||||
}
|
||||
g_assert (ret == NM_ACT_STAGE_RETURN_SUCCESS);
|
||||
@@ -4828,7 +4828,7 @@ ipv4ll_timeout_cb (gpointer user_data)
|
||||
}
|
||||
|
||||
static NMActStageReturn
|
||||
ipv4ll_start (NMDevice *self, NMDeviceStateReason *reason)
|
||||
ipv4ll_start (NMDevice *self)
|
||||
{
|
||||
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
|
||||
const struct ether_addr *addr;
|
||||
@@ -4840,55 +4840,51 @@ ipv4ll_start (NMDevice *self, NMDeviceStateReason *reason)
|
||||
r = sd_ipv4ll_new (&priv->ipv4ll);
|
||||
if (r < 0) {
|
||||
_LOGE (LOGD_AUTOIP4, "IPv4LL: new() failed with error %d", r);
|
||||
goto fail;
|
||||
return NM_ACT_STAGE_RETURN_FAILURE;
|
||||
}
|
||||
|
||||
r = sd_ipv4ll_attach_event (priv->ipv4ll, NULL, 0);
|
||||
if (r < 0) {
|
||||
_LOGE (LOGD_AUTOIP4, "IPv4LL: attach_event() failed with error %d", r);
|
||||
goto fail;
|
||||
return NM_ACT_STAGE_RETURN_FAILURE;
|
||||
}
|
||||
|
||||
ifindex = nm_device_get_ip_ifindex (self);
|
||||
addr = nm_platform_link_get_address (NM_PLATFORM_GET, ifindex, &addr_len);
|
||||
if (!addr || addr_len != ETH_ALEN) {
|
||||
_LOGE (LOGD_AUTOIP4, "IPv4LL: can't retrieve hardware address");
|
||||
goto fail;
|
||||
return NM_ACT_STAGE_RETURN_FAILURE;
|
||||
}
|
||||
|
||||
r = sd_ipv4ll_set_mac (priv->ipv4ll, addr);
|
||||
if (r < 0) {
|
||||
_LOGE (LOGD_AUTOIP4, "IPv4LL: set_mac() failed with error %d", r);
|
||||
goto fail;
|
||||
return NM_ACT_STAGE_RETURN_FAILURE;
|
||||
}
|
||||
|
||||
r = sd_ipv4ll_set_ifindex (priv->ipv4ll, ifindex);
|
||||
if (r < 0) {
|
||||
_LOGE (LOGD_AUTOIP4, "IPv4LL: set_ifindex() failed with error %d", r);
|
||||
goto fail;
|
||||
return NM_ACT_STAGE_RETURN_FAILURE;
|
||||
}
|
||||
|
||||
r = sd_ipv4ll_set_callback (priv->ipv4ll, nm_device_handle_ipv4ll_event, self);
|
||||
if (r < 0) {
|
||||
_LOGE (LOGD_AUTOIP4, "IPv4LL: set_callback() failed with error %d", r);
|
||||
goto fail;
|
||||
return NM_ACT_STAGE_RETURN_FAILURE;
|
||||
}
|
||||
|
||||
r = sd_ipv4ll_start (priv->ipv4ll);
|
||||
if (r < 0) {
|
||||
_LOGE (LOGD_AUTOIP4, "IPv4LL: start() failed with error %d", r);
|
||||
goto fail;
|
||||
return NM_ACT_STAGE_RETURN_FAILURE;
|
||||
}
|
||||
|
||||
_LOGI (LOGD_DEVICE | LOGD_AUTOIP4, "IPv4LL: started");
|
||||
|
||||
/* Start a timeout to bound the address attempt */
|
||||
priv->ipv4ll_timeout = g_timeout_add_seconds (20, ipv4ll_timeout_cb, self);
|
||||
|
||||
return NM_ACT_STAGE_RETURN_POSTPONE;
|
||||
fail:
|
||||
*reason = NM_DEVICE_STATE_REASON_AUTOIP_START_FAILED;
|
||||
return NM_ACT_STAGE_RETURN_FAILURE;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -5215,11 +5211,9 @@ END_ADD_DEFAULT_ROUTE:
|
||||
static gboolean
|
||||
dhcp4_lease_change (NMDevice *self, NMIP4Config *config)
|
||||
{
|
||||
NMDeviceStateReason reason = NM_DEVICE_STATE_REASON_NONE;
|
||||
g_return_val_if_fail (config, FALSE);
|
||||
|
||||
g_return_val_if_fail (config != NULL, FALSE);
|
||||
|
||||
if (!ip4_config_merge_and_apply (self, config, TRUE, &reason)) {
|
||||
if (!ip4_config_merge_and_apply (self, config, TRUE, NULL)) {
|
||||
_LOGW (LOGD_DHCP4, "failed to update IPv4 config for DHCP change.");
|
||||
return FALSE;
|
||||
}
|
||||
@@ -5243,7 +5237,6 @@ dhcp4_restart_cb (gpointer user_data)
|
||||
{
|
||||
NMDevice *self = user_data;
|
||||
NMDevicePrivate *priv;
|
||||
NMDeviceStateReason reason;
|
||||
NMConnection *connection;
|
||||
|
||||
g_return_val_if_fail (NM_IS_DEVICE (self), FALSE);
|
||||
@@ -5252,7 +5245,7 @@ dhcp4_restart_cb (gpointer user_data)
|
||||
priv->dhcp4.restart_id = 0;
|
||||
connection = nm_device_get_applied_connection (self);
|
||||
|
||||
if (dhcp4_start (self, connection, &reason) == NM_ACT_STAGE_RETURN_FAILURE)
|
||||
if (dhcp4_start (self, connection) == NM_ACT_STAGE_RETURN_FAILURE)
|
||||
dhcp_schedule_restart (self, AF_INET, NULL);
|
||||
|
||||
return FALSE;
|
||||
@@ -5408,8 +5401,7 @@ dhcp4_get_timeout (NMDevice *self, NMSettingIP4Config *s_ip4)
|
||||
|
||||
static NMActStageReturn
|
||||
dhcp4_start (NMDevice *self,
|
||||
NMConnection *connection,
|
||||
NMDeviceStateReason *reason)
|
||||
NMConnection *connection)
|
||||
{
|
||||
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
|
||||
NMSettingIPConfig *s_ip4;
|
||||
@@ -5448,10 +5440,8 @@ dhcp4_start (NMDevice *self,
|
||||
if (tmp)
|
||||
g_byte_array_free (tmp, TRUE);
|
||||
|
||||
if (!priv->dhcp4.client) {
|
||||
*reason = NM_DEVICE_STATE_REASON_DHCP_START_FAILED;
|
||||
if (!priv->dhcp4.client)
|
||||
return NM_ACT_STAGE_RETURN_FAILURE;
|
||||
}
|
||||
|
||||
priv->dhcp4.state_sigid = g_signal_connect (priv->dhcp4.client,
|
||||
NM_DHCP_CLIENT_SIGNAL_STATE_CHANGED,
|
||||
@@ -5468,8 +5458,6 @@ gboolean
|
||||
nm_device_dhcp4_renew (NMDevice *self, gboolean release)
|
||||
{
|
||||
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
|
||||
NMActStageReturn ret;
|
||||
NMDeviceStateReason reason;
|
||||
NMConnection *connection;
|
||||
|
||||
g_return_val_if_fail (priv->dhcp4.client != NULL, FALSE);
|
||||
@@ -5480,12 +5468,10 @@ nm_device_dhcp4_renew (NMDevice *self, gboolean release)
|
||||
dhcp4_cleanup (self, CLEANUP_TYPE_DECONFIGURE, release);
|
||||
|
||||
connection = nm_device_get_applied_connection (self);
|
||||
g_assert (connection);
|
||||
g_return_val_if_fail (connection, FALSE);
|
||||
|
||||
/* Start DHCP again on the interface */
|
||||
ret = dhcp4_start (self, connection, &reason);
|
||||
|
||||
return (ret != NM_ACT_STAGE_RETURN_FAILURE);
|
||||
return dhcp4_start (self, connection) != NM_ACT_STAGE_RETURN_FAILURE;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -5534,17 +5520,15 @@ reserve_shared_ip (NMDevice *self, NMSettingIPConfig *s_ip4, NMPlatformIP4Addres
|
||||
}
|
||||
|
||||
static NMIP4Config *
|
||||
shared4_new_config (NMDevice *self, NMConnection *connection, NMDeviceStateReason *reason)
|
||||
shared4_new_config (NMDevice *self, NMConnection *connection)
|
||||
{
|
||||
NMIP4Config *config = NULL;
|
||||
NMPlatformIP4Address address;
|
||||
|
||||
g_return_val_if_fail (self != NULL, NULL);
|
||||
|
||||
if (!reserve_shared_ip (self, nm_connection_get_setting_ip4_config (connection), &address)) {
|
||||
*reason = NM_DEVICE_STATE_REASON_IP_CONFIG_UNAVAILABLE;
|
||||
if (!reserve_shared_ip (self, nm_connection_get_setting_ip4_config (connection), &address))
|
||||
return NULL;
|
||||
}
|
||||
|
||||
config = nm_ip4_config_new (nm_device_get_ip_ifindex (self));
|
||||
address.addr_source = NM_IP_CONFIG_SOURCE_SHARED;
|
||||
@@ -5661,7 +5645,7 @@ ip4_requires_slaves (NMConnection *connection)
|
||||
static NMActStageReturn
|
||||
act_stage3_ip4_config_start (NMDevice *self,
|
||||
NMIP4Config **out_config,
|
||||
NMDeviceStateReason *reason)
|
||||
NMDeviceStateReason *out_failure_reason)
|
||||
{
|
||||
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
|
||||
NMConnection *connection;
|
||||
@@ -5670,10 +5654,8 @@ act_stage3_ip4_config_start (NMDevice *self,
|
||||
GSList *slaves;
|
||||
gboolean ready_slaves;
|
||||
|
||||
g_return_val_if_fail (reason != NULL, NM_ACT_STAGE_RETURN_FAILURE);
|
||||
|
||||
connection = nm_device_get_applied_connection (self);
|
||||
g_assert (connection);
|
||||
g_return_val_if_fail (connection, NM_ACT_STAGE_RETURN_FAILURE);
|
||||
|
||||
if ( connection_ip4_method_requires_carrier (connection, NULL)
|
||||
&& priv->is_master
|
||||
@@ -5702,11 +5684,15 @@ act_stage3_ip4_config_start (NMDevice *self,
|
||||
priv->dhcp4.num_tries_left = DHCP_NUM_TRIES_MAX;
|
||||
|
||||
/* Start IPv4 addressing based on the method requested */
|
||||
if (strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0)
|
||||
ret = dhcp4_start (self, connection, reason);
|
||||
else if (strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL) == 0)
|
||||
ret = ipv4ll_start (self, reason);
|
||||
else if (strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_MANUAL) == 0) {
|
||||
if (strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0) {
|
||||
ret = dhcp4_start (self, connection);
|
||||
if (ret == NM_ACT_STAGE_RETURN_FAILURE)
|
||||
NM_SET_OUT (out_failure_reason, NM_DEVICE_STATE_REASON_DHCP_START_FAILED);
|
||||
} else if (strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL) == 0) {
|
||||
ret = ipv4ll_start (self);
|
||||
if (ret == NM_ACT_STAGE_RETURN_FAILURE)
|
||||
NM_SET_OUT (out_failure_reason, NM_DEVICE_STATE_REASON_AUTOIP_START_FAILED);
|
||||
} else if (strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_MANUAL) == 0) {
|
||||
NMIP4Config **configs, *config;
|
||||
|
||||
config = nm_ip4_config_new (nm_device_get_ip_ifindex (self));
|
||||
@@ -5720,12 +5706,14 @@ act_stage3_ip4_config_start (NMDevice *self,
|
||||
ret = NM_ACT_STAGE_RETURN_POSTPONE;
|
||||
} else if (strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_SHARED) == 0) {
|
||||
if (out_config) {
|
||||
*out_config = shared4_new_config (self, connection, reason);
|
||||
*out_config = shared4_new_config (self, connection);
|
||||
if (*out_config) {
|
||||
priv->dnsmasq_manager = nm_dnsmasq_manager_new (nm_device_get_ip_iface (self));
|
||||
ret = NM_ACT_STAGE_RETURN_SUCCESS;
|
||||
} else
|
||||
} else {
|
||||
NM_SET_OUT (out_failure_reason, NM_DEVICE_STATE_REASON_IP_CONFIG_UNAVAILABLE);
|
||||
ret = NM_ACT_STAGE_RETURN_FAILURE;
|
||||
}
|
||||
} else
|
||||
g_return_val_if_reached (NM_ACT_STAGE_RETURN_FAILURE);
|
||||
} else if (strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_DISABLED) == 0)
|
||||
@@ -5980,7 +5968,6 @@ dhcp6_lease_change (NMDevice *self)
|
||||
{
|
||||
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
|
||||
NMSettingsConnection *settings_connection;
|
||||
NMDeviceStateReason reason = NM_DEVICE_STATE_REASON_NONE;
|
||||
|
||||
if (priv->dhcp6.ip6_config == NULL) {
|
||||
_LOGW (LOGD_DHCP6, "failed to get DHCPv6 config for rebind");
|
||||
@@ -5993,7 +5980,7 @@ dhcp6_lease_change (NMDevice *self)
|
||||
g_assert (settings_connection);
|
||||
|
||||
/* Apply the updated config */
|
||||
if (!ip6_config_merge_and_apply (self, TRUE, &reason)) {
|
||||
if (!ip6_config_merge_and_apply (self, TRUE, NULL)) {
|
||||
_LOGW (LOGD_DHCP6, "failed to update IPv6 config in response to DHCP event");
|
||||
return FALSE;
|
||||
}
|
||||
@@ -6014,14 +6001,13 @@ dhcp6_restart_cb (gpointer user_data)
|
||||
{
|
||||
NMDevice *self = user_data;
|
||||
NMDevicePrivate *priv;
|
||||
NMDeviceStateReason reason;
|
||||
|
||||
g_return_val_if_fail (NM_IS_DEVICE (self), FALSE);
|
||||
|
||||
priv = NM_DEVICE_GET_PRIVATE (self);
|
||||
priv->dhcp6.restart_id = 0;
|
||||
|
||||
if (!dhcp6_start (self, FALSE, &reason))
|
||||
if (!dhcp6_start (self, FALSE))
|
||||
dhcp_schedule_restart (self, AF_INET6, NULL);
|
||||
|
||||
return FALSE;
|
||||
@@ -6272,7 +6258,7 @@ dhcp6_start_with_link_ready (NMDevice *self, NMConnection *connection)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
dhcp6_start (NMDevice *self, gboolean wait_for_ll, NMDeviceStateReason *reason)
|
||||
dhcp6_start (NMDevice *self, gboolean wait_for_ll)
|
||||
{
|
||||
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
|
||||
NMConnection *connection;
|
||||
@@ -6306,10 +6292,8 @@ dhcp6_start (NMDevice *self, gboolean wait_for_ll, NMDeviceStateReason *reason)
|
||||
g_assert (ret == NM_ACT_STAGE_RETURN_SUCCESS);
|
||||
}
|
||||
|
||||
if (!dhcp6_start_with_link_ready (self, connection)) {
|
||||
NM_SET_OUT (reason, NM_DEVICE_STATE_REASON_DHCP_START_FAILED);
|
||||
if (!dhcp6_start_with_link_ready (self, connection))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -6327,7 +6311,7 @@ nm_device_dhcp6_renew (NMDevice *self, gboolean release)
|
||||
dhcp6_cleanup (self, CLEANUP_TYPE_DECONFIGURE, release);
|
||||
|
||||
/* Start DHCP again on the interface */
|
||||
return dhcp6_start (self, FALSE, NULL);
|
||||
return dhcp6_start (self, FALSE);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -6894,14 +6878,13 @@ ndisc_config_changed (NMNDisc *ndisc, const NMNDiscData *rdata, guint changed_in
|
||||
|
||||
priv->dhcp6.mode = rdata->dhcp_level;
|
||||
if (priv->dhcp6.mode != NM_NDISC_DHCP_LEVEL_NONE) {
|
||||
NMDeviceStateReason reason;
|
||||
|
||||
_LOGD (LOGD_DEVICE | LOGD_DHCP6,
|
||||
"Activation: Stage 3 of 5 (IP Configure Start) starting DHCPv6"
|
||||
" as requested by IPv6 router...");
|
||||
if (!dhcp6_start (self, FALSE, &reason)) {
|
||||
if (!dhcp6_start (self, FALSE)) {
|
||||
if (priv->dhcp6.mode == NM_NDISC_DHCP_LEVEL_MANAGED) {
|
||||
nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, reason);
|
||||
nm_device_state_changed (self, NM_DEVICE_STATE_FAILED,
|
||||
NM_DEVICE_STATE_REASON_DHCP_START_FAILED);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -7267,7 +7250,7 @@ ip6_requires_slaves (NMConnection *connection)
|
||||
static NMActStageReturn
|
||||
act_stage3_ip6_config_start (NMDevice *self,
|
||||
NMIP6Config **out_config,
|
||||
NMDeviceStateReason *reason)
|
||||
NMDeviceStateReason *out_failure_reason)
|
||||
{
|
||||
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
|
||||
NMActStageReturn ret = NM_ACT_STAGE_RETURN_FAILURE;
|
||||
@@ -7278,10 +7261,8 @@ act_stage3_ip6_config_start (NMDevice *self,
|
||||
GSList *slaves;
|
||||
gboolean ready_slaves;
|
||||
|
||||
g_return_val_if_fail (reason != NULL, NM_ACT_STAGE_RETURN_FAILURE);
|
||||
|
||||
connection = nm_device_get_applied_connection (self);
|
||||
g_assert (connection);
|
||||
g_return_val_if_fail (connection, NM_ACT_STAGE_RETURN_FAILURE);
|
||||
|
||||
if ( connection_ip6_method_requires_carrier (connection, NULL)
|
||||
&& priv->is_master
|
||||
@@ -7356,7 +7337,7 @@ act_stage3_ip6_config_start (NMDevice *self,
|
||||
ret = linklocal6_start (self);
|
||||
} else if (strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_DHCP) == 0) {
|
||||
priv->dhcp6.mode = NM_NDISC_DHCP_LEVEL_MANAGED;
|
||||
if (!dhcp6_start (self, TRUE, reason)) {
|
||||
if (!dhcp6_start (self, TRUE)) {
|
||||
/* IPv6 might be disabled; allow IPv4 to proceed */
|
||||
ret = NM_ACT_STAGE_RETURN_IP_FAIL;
|
||||
} else
|
||||
@@ -7397,13 +7378,13 @@ nm_device_activate_stage3_ip4_start (NMDevice *self)
|
||||
{
|
||||
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
|
||||
NMActStageReturn ret;
|
||||
NMDeviceStateReason reason = NM_DEVICE_STATE_REASON_NONE;
|
||||
NMDeviceStateReason failure_reason = NM_DEVICE_STATE_REASON_NONE;
|
||||
NMIP4Config *ip4_config = NULL;
|
||||
|
||||
g_assert (priv->ip4_state == IP_WAIT);
|
||||
|
||||
_set_ip_state (self, AF_INET, IP_CONF);
|
||||
ret = NM_DEVICE_GET_CLASS (self)->act_stage3_ip4_config_start (self, &ip4_config, &reason);
|
||||
ret = NM_DEVICE_GET_CLASS (self)->act_stage3_ip4_config_start (self, &ip4_config, &failure_reason);
|
||||
if (ret == NM_ACT_STAGE_RETURN_SUCCESS) {
|
||||
if (!ip4_config)
|
||||
ip4_config = nm_ip4_config_new (nm_device_get_ip_ifindex (self));
|
||||
@@ -7413,7 +7394,7 @@ nm_device_activate_stage3_ip4_start (NMDevice *self)
|
||||
_set_ip_state (self, AF_INET, IP_DONE);
|
||||
check_ip_state (self, FALSE);
|
||||
} else if (ret == NM_ACT_STAGE_RETURN_FAILURE) {
|
||||
nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, reason);
|
||||
nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, failure_reason);
|
||||
return FALSE;
|
||||
} else if (ret == NM_ACT_STAGE_RETURN_IP_FAIL) {
|
||||
/* Activation not wanted */
|
||||
@@ -7438,13 +7419,13 @@ nm_device_activate_stage3_ip6_start (NMDevice *self)
|
||||
{
|
||||
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
|
||||
NMActStageReturn ret;
|
||||
NMDeviceStateReason reason = NM_DEVICE_STATE_REASON_NONE;
|
||||
NMDeviceStateReason failure_reason = NM_DEVICE_STATE_REASON_NONE;
|
||||
NMIP6Config *ip6_config = NULL;
|
||||
|
||||
g_assert (priv->ip6_state == IP_WAIT);
|
||||
|
||||
_set_ip_state (self, AF_INET6, IP_CONF);
|
||||
ret = NM_DEVICE_GET_CLASS (self)->act_stage3_ip6_config_start (self, &ip6_config, &reason);
|
||||
ret = NM_DEVICE_GET_CLASS (self)->act_stage3_ip6_config_start (self, &ip6_config, &failure_reason);
|
||||
if (ret == NM_ACT_STAGE_RETURN_SUCCESS) {
|
||||
if (!ip6_config)
|
||||
ip6_config = nm_ip6_config_new (nm_device_get_ip_ifindex (self));
|
||||
@@ -7458,7 +7439,7 @@ nm_device_activate_stage3_ip6_start (NMDevice *self)
|
||||
_set_ip_state (self, AF_INET6, IP_DONE);
|
||||
check_ip_state (self, FALSE);
|
||||
} else if (ret == NM_ACT_STAGE_RETURN_FAILURE) {
|
||||
nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, reason);
|
||||
nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, failure_reason);
|
||||
return FALSE;
|
||||
} else if (ret == NM_ACT_STAGE_RETURN_IP_FAIL) {
|
||||
/* Activation not wanted */
|
||||
@@ -7632,10 +7613,10 @@ nm_device_activate_schedule_stage3_ip_config_start (NMDevice *self)
|
||||
}
|
||||
|
||||
static NMActStageReturn
|
||||
act_stage4_ip4_config_timeout (NMDevice *self, NMDeviceStateReason *reason)
|
||||
act_stage4_ip4_config_timeout (NMDevice *self, NMDeviceStateReason *out_failure_reason)
|
||||
{
|
||||
if (!get_ip_config_may_fail (self, AF_INET)) {
|
||||
*reason = NM_DEVICE_STATE_REASON_IP_CONFIG_UNAVAILABLE;
|
||||
NM_SET_OUT (out_failure_reason, NM_DEVICE_STATE_REASON_IP_CONFIG_UNAVAILABLE);
|
||||
return NM_ACT_STAGE_RETURN_FAILURE;
|
||||
}
|
||||
return NM_ACT_STAGE_RETURN_SUCCESS;
|
||||
@@ -7651,13 +7632,13 @@ static void
|
||||
activate_stage4_ip4_config_timeout (NMDevice *self)
|
||||
{
|
||||
NMActStageReturn ret = NM_ACT_STAGE_RETURN_FAILURE;
|
||||
NMDeviceStateReason reason = NM_DEVICE_STATE_REASON_NONE;
|
||||
NMDeviceStateReason failure_reason = NM_DEVICE_STATE_REASON_NONE;
|
||||
|
||||
ret = NM_DEVICE_GET_CLASS (self)->act_stage4_ip4_config_timeout (self, &reason);
|
||||
ret = NM_DEVICE_GET_CLASS (self)->act_stage4_ip4_config_timeout (self, &failure_reason);
|
||||
if (ret == NM_ACT_STAGE_RETURN_POSTPONE)
|
||||
return;
|
||||
else if (ret == NM_ACT_STAGE_RETURN_FAILURE) {
|
||||
nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, reason);
|
||||
nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, failure_reason);
|
||||
return;
|
||||
}
|
||||
g_assert (ret == NM_ACT_STAGE_RETURN_SUCCESS);
|
||||
@@ -7687,10 +7668,10 @@ nm_device_activate_schedule_ip4_config_timeout (NMDevice *self)
|
||||
}
|
||||
|
||||
static NMActStageReturn
|
||||
act_stage4_ip6_config_timeout (NMDevice *self, NMDeviceStateReason *reason)
|
||||
act_stage4_ip6_config_timeout (NMDevice *self, NMDeviceStateReason *out_failure_reason)
|
||||
{
|
||||
if (!get_ip_config_may_fail (self, AF_INET6)) {
|
||||
*reason = NM_DEVICE_STATE_REASON_IP_CONFIG_UNAVAILABLE;
|
||||
NM_SET_OUT (out_failure_reason, NM_DEVICE_STATE_REASON_IP_CONFIG_UNAVAILABLE);
|
||||
return NM_ACT_STAGE_RETURN_FAILURE;
|
||||
}
|
||||
|
||||
@@ -7707,13 +7688,13 @@ static void
|
||||
activate_stage4_ip6_config_timeout (NMDevice *self)
|
||||
{
|
||||
NMActStageReturn ret = NM_ACT_STAGE_RETURN_FAILURE;
|
||||
NMDeviceStateReason reason = NM_DEVICE_STATE_REASON_NONE;
|
||||
NMDeviceStateReason failure_reason = NM_DEVICE_STATE_REASON_NONE;
|
||||
|
||||
ret = NM_DEVICE_GET_CLASS (self)->act_stage4_ip6_config_timeout (self, &reason);
|
||||
ret = NM_DEVICE_GET_CLASS (self)->act_stage4_ip6_config_timeout (self, &failure_reason);
|
||||
if (ret == NM_ACT_STAGE_RETURN_POSTPONE)
|
||||
return;
|
||||
if (ret == NM_ACT_STAGE_RETURN_FAILURE) {
|
||||
nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, reason);
|
||||
nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, failure_reason);
|
||||
return;
|
||||
}
|
||||
g_assert (ret == NM_ACT_STAGE_RETURN_SUCCESS);
|
||||
@@ -9201,7 +9182,7 @@ nm_device_set_ip4_config (NMDevice *self,
|
||||
guint32 default_route_metric,
|
||||
gboolean commit,
|
||||
gboolean routes_full_sync,
|
||||
NMDeviceStateReason *reason)
|
||||
NMDeviceStateReason *out_reason)
|
||||
{
|
||||
NMDevicePrivate *priv;
|
||||
NMIP4Config *old_config = NULL;
|
||||
@@ -9297,9 +9278,7 @@ nm_device_set_ip4_config (NMDevice *self,
|
||||
nm_device_queue_recheck_assume (self);
|
||||
}
|
||||
|
||||
if (reason)
|
||||
*reason = reason_local;
|
||||
|
||||
NM_SET_OUT (out_reason, reason_local);
|
||||
return success;
|
||||
}
|
||||
|
||||
@@ -9371,7 +9350,7 @@ nm_device_set_ip6_config (NMDevice *self,
|
||||
NMIP6Config *new_config,
|
||||
gboolean commit,
|
||||
gboolean routes_full_sync,
|
||||
NMDeviceStateReason *reason)
|
||||
NMDeviceStateReason *out_reason)
|
||||
{
|
||||
NMDevicePrivate *priv;
|
||||
NMIP6Config *old_config = NULL;
|
||||
@@ -9461,9 +9440,7 @@ nm_device_set_ip6_config (NMDevice *self,
|
||||
ndisc_set_router_config (priv->ndisc, self);
|
||||
}
|
||||
|
||||
if (reason)
|
||||
*reason = reason_local;
|
||||
|
||||
NM_SET_OUT (out_reason, reason_local);
|
||||
return success;
|
||||
}
|
||||
|
||||
|
@@ -283,19 +283,19 @@ typedef struct {
|
||||
GError **error);
|
||||
|
||||
NMActStageReturn (* act_stage1_prepare) (NMDevice *self,
|
||||
NMDeviceStateReason *reason);
|
||||
NMDeviceStateReason *out_failure_reason);
|
||||
NMActStageReturn (* act_stage2_config) (NMDevice *self,
|
||||
NMDeviceStateReason *reason);
|
||||
NMDeviceStateReason *out_failure_reason);
|
||||
NMActStageReturn (* act_stage3_ip4_config_start) (NMDevice *self,
|
||||
NMIP4Config **out_config,
|
||||
NMDeviceStateReason *reason);
|
||||
NMDeviceStateReason *out_failure_reason);
|
||||
NMActStageReturn (* act_stage3_ip6_config_start) (NMDevice *self,
|
||||
NMIP6Config **out_config,
|
||||
NMDeviceStateReason *reason);
|
||||
NMDeviceStateReason *out_failure_reason);
|
||||
NMActStageReturn (* act_stage4_ip4_config_timeout) (NMDevice *self,
|
||||
NMDeviceStateReason *reason);
|
||||
NMDeviceStateReason *out_failure_reason);
|
||||
NMActStageReturn (* act_stage4_ip6_config_timeout) (NMDevice *self,
|
||||
NMDeviceStateReason *reason);
|
||||
NMDeviceStateReason *out_failure_reason);
|
||||
|
||||
void (* ip4_config_pre_commit) (NMDevice *self, NMIP4Config *config);
|
||||
|
||||
|
@@ -580,7 +580,7 @@ teamd_start (NMDevice *device, NMSettingTeam *s_team)
|
||||
}
|
||||
|
||||
static NMActStageReturn
|
||||
act_stage1_prepare (NMDevice *device, NMDeviceStateReason *reason)
|
||||
act_stage1_prepare (NMDevice *device, NMDeviceStateReason *out_failure_reason)
|
||||
{
|
||||
NMDeviceTeam *self = NM_DEVICE_TEAM (device);
|
||||
NMDeviceTeamPrivate *priv = NM_DEVICE_TEAM_GET_PRIVATE (self);
|
||||
@@ -589,14 +589,12 @@ act_stage1_prepare (NMDevice *device, NMDeviceStateReason *reason)
|
||||
NMSettingTeam *s_team;
|
||||
const char *cfg;
|
||||
|
||||
g_return_val_if_fail (reason != NULL, NM_ACT_STAGE_RETURN_FAILURE);
|
||||
|
||||
ret = NM_DEVICE_CLASS (nm_device_team_parent_class)->act_stage1_prepare (device, reason);
|
||||
ret = NM_DEVICE_CLASS (nm_device_team_parent_class)->act_stage1_prepare (device, out_failure_reason);
|
||||
if (ret != NM_ACT_STAGE_RETURN_SUCCESS)
|
||||
return ret;
|
||||
|
||||
s_team = (NMSettingTeam *) nm_device_get_applied_setting (device, NM_TYPE_SETTING_TEAM);
|
||||
g_assert (s_team);
|
||||
g_return_val_if_fail (s_team, NM_ACT_STAGE_RETURN_FAILURE);
|
||||
|
||||
if (priv->tdc) {
|
||||
/* If the existing teamd config is the same as we're about to use,
|
||||
@@ -614,7 +612,7 @@ act_stage1_prepare (NMDevice *device, NMDeviceStateReason *reason)
|
||||
_LOGD (LOGD_TEAM, "existing teamd config mismatch; killing existing via teamdctl");
|
||||
if (!teamd_kill (self, NULL, &error)) {
|
||||
_LOGW (LOGD_TEAM, "existing teamd config mismatch; failed to kill existing teamd: %s", error->message);
|
||||
*reason = NM_DEVICE_STATE_REASON_TEAMD_CONTROL_FAILED;
|
||||
NM_SET_OUT (out_failure_reason, NM_DEVICE_STATE_REASON_TEAMD_CONTROL_FAILED);
|
||||
return NM_ACT_STAGE_RETURN_FAILURE;
|
||||
}
|
||||
}
|
||||
|
@@ -163,14 +163,14 @@ complete_connection (NMDevice *device,
|
||||
/*****************************************************************************/
|
||||
|
||||
static NMActStageReturn
|
||||
act_stage1_prepare (NMDevice *device, NMDeviceStateReason *reason)
|
||||
act_stage1_prepare (NMDevice *device, NMDeviceStateReason *out_failure_reason)
|
||||
{
|
||||
NMDeviceOlpcMesh *self = NM_DEVICE_OLPC_MESH (device);
|
||||
NMDeviceOlpcMeshPrivate *priv = NM_DEVICE_OLPC_MESH_GET_PRIVATE (self);
|
||||
NMActStageReturn ret;
|
||||
gboolean scanning;
|
||||
|
||||
ret = NM_DEVICE_CLASS (nm_device_olpc_mesh_parent_class)->act_stage1_prepare (device, reason);
|
||||
ret = NM_DEVICE_CLASS (nm_device_olpc_mesh_parent_class)->act_stage1_prepare (device, out_failure_reason);
|
||||
if (ret != NM_ACT_STAGE_RETURN_SUCCESS)
|
||||
return ret;
|
||||
|
||||
@@ -209,7 +209,7 @@ _mesh_set_channel (NMDeviceOlpcMesh *self, guint32 channel)
|
||||
}
|
||||
|
||||
static NMActStageReturn
|
||||
act_stage2_config (NMDevice *device, NMDeviceStateReason *reason)
|
||||
act_stage2_config (NMDevice *device, NMDeviceStateReason *out_failure_reason)
|
||||
{
|
||||
NMDeviceOlpcMesh *self = NM_DEVICE_OLPC_MESH (device);
|
||||
NMConnection *connection;
|
||||
@@ -219,10 +219,10 @@ act_stage2_config (NMDevice *device, NMDeviceStateReason *reason)
|
||||
const char *anycast_addr;
|
||||
|
||||
connection = nm_device_get_applied_connection (device);
|
||||
g_assert (connection);
|
||||
g_return_val_if_fail (connection, NM_ACT_STAGE_RETURN_FAILURE);
|
||||
|
||||
s_mesh = nm_connection_get_setting_olpc_mesh (connection);
|
||||
g_assert (s_mesh);
|
||||
g_return_val_if_fail (s_mesh, NM_ACT_STAGE_RETURN_FAILURE);
|
||||
|
||||
channel = nm_setting_olpc_mesh_get_channel (s_mesh);
|
||||
if (channel != 0)
|
||||
|
@@ -2218,7 +2218,7 @@ supplicant_iface_notify_current_bss (NMSupplicantInterface *iface,
|
||||
}
|
||||
}
|
||||
|
||||
static NMActStageReturn
|
||||
static gboolean
|
||||
handle_auth_or_fail (NMDeviceWifi *self,
|
||||
NMActRequest *req,
|
||||
gboolean new_secrets)
|
||||
@@ -2226,35 +2226,34 @@ handle_auth_or_fail (NMDeviceWifi *self,
|
||||
const char *setting_name;
|
||||
guint32 tries;
|
||||
NMConnection *applied_connection;
|
||||
NMActStageReturn ret = NM_ACT_STAGE_RETURN_FAILURE;
|
||||
|
||||
g_return_val_if_fail (NM_IS_DEVICE_WIFI (self), NM_ACT_STAGE_RETURN_FAILURE);
|
||||
g_return_val_if_fail (NM_IS_DEVICE_WIFI (self), FALSE);
|
||||
|
||||
if (!req) {
|
||||
req = nm_device_get_act_request (NM_DEVICE (self));
|
||||
g_return_val_if_fail (req, NM_ACT_STAGE_RETURN_FAILURE);
|
||||
g_return_val_if_fail (req, FALSE);
|
||||
}
|
||||
|
||||
applied_connection = nm_act_request_get_applied_connection (req);
|
||||
|
||||
tries = GPOINTER_TO_UINT (g_object_get_qdata (G_OBJECT (applied_connection), wireless_secrets_tries_quark ()));
|
||||
if (tries > 3)
|
||||
return NM_ACT_STAGE_RETURN_FAILURE;
|
||||
return FALSE;
|
||||
|
||||
nm_device_state_changed (NM_DEVICE (self), NM_DEVICE_STATE_NEED_AUTH, NM_DEVICE_STATE_REASON_NONE);
|
||||
|
||||
nm_act_request_clear_secrets (req);
|
||||
setting_name = nm_connection_need_secrets (applied_connection, NULL);
|
||||
if (setting_name) {
|
||||
if (!setting_name) {
|
||||
_LOGW (LOGD_DEVICE, "Cleared secrets, but setting didn't need any secrets.");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
wifi_secrets_get_secrets (self, setting_name,
|
||||
NM_SECRET_AGENT_GET_SECRETS_FLAG_ALLOW_INTERACTION
|
||||
| (new_secrets ? NM_SECRET_AGENT_GET_SECRETS_FLAG_REQUEST_NEW : 0));
|
||||
g_object_set_qdata (G_OBJECT (applied_connection), wireless_secrets_tries_quark (), GUINT_TO_POINTER (++tries));
|
||||
ret = NM_ACT_STAGE_RETURN_POSTPONE;
|
||||
} else
|
||||
_LOGW (LOGD_DEVICE, "Cleared secrets, but setting didn't need any secrets.");
|
||||
|
||||
return ret;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2323,7 +2322,7 @@ supplicant_connection_timeout_cb (gpointer user_data)
|
||||
if (nm_settings_connection_get_timestamp (nm_act_request_get_settings_connection (req), ×tamp))
|
||||
new_secrets = !timestamp;
|
||||
|
||||
if (handle_auth_or_fail (self, req, new_secrets) == NM_ACT_STAGE_RETURN_POSTPONE)
|
||||
if (handle_auth_or_fail (self, req, new_secrets))
|
||||
_LOGW (LOGD_DEVICE | LOGD_WIFI, "Activation: (wifi) asking for new secrets");
|
||||
else {
|
||||
nm_device_state_changed (device, NM_DEVICE_STATE_FAILED,
|
||||
@@ -2407,7 +2406,7 @@ error:
|
||||
/*****************************************************************************/
|
||||
|
||||
static NMActStageReturn
|
||||
act_stage1_prepare (NMDevice *device, NMDeviceStateReason *reason)
|
||||
act_stage1_prepare (NMDevice *device, NMDeviceStateReason *out_failure_reason)
|
||||
{
|
||||
NMDeviceWifi *self = NM_DEVICE_WIFI (device);
|
||||
NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self);
|
||||
@@ -2419,18 +2418,18 @@ act_stage1_prepare (NMDevice *device, NMDeviceStateReason *reason)
|
||||
const char *mode;
|
||||
const char *ap_path;
|
||||
|
||||
ret = NM_DEVICE_CLASS (nm_device_wifi_parent_class)->act_stage1_prepare (device, reason);
|
||||
ret = NM_DEVICE_CLASS (nm_device_wifi_parent_class)->act_stage1_prepare (device, out_failure_reason);
|
||||
if (ret != NM_ACT_STAGE_RETURN_SUCCESS)
|
||||
return ret;
|
||||
|
||||
req = nm_device_get_act_request (NM_DEVICE (self));
|
||||
g_return_val_if_fail (req != NULL, NM_ACT_STAGE_RETURN_FAILURE);
|
||||
g_return_val_if_fail (req, NM_ACT_STAGE_RETURN_FAILURE);
|
||||
|
||||
connection = nm_act_request_get_applied_connection (req);
|
||||
g_return_val_if_fail (connection != NULL, NM_ACT_STAGE_RETURN_FAILURE);
|
||||
g_return_val_if_fail (connection, NM_ACT_STAGE_RETURN_FAILURE);
|
||||
|
||||
s_wireless = nm_connection_get_setting_wireless (connection);
|
||||
g_assert (s_wireless);
|
||||
g_return_val_if_fail (s_wireless, NM_ACT_STAGE_RETURN_FAILURE);
|
||||
|
||||
mode = nm_setting_wireless_get_mode (s_wireless);
|
||||
if (g_strcmp0 (mode, NM_SETTING_WIRELESS_MODE_INFRA) == 0)
|
||||
@@ -2451,7 +2450,7 @@ act_stage1_prepare (NMDevice *device, NMDeviceStateReason *reason)
|
||||
*/
|
||||
if (is_adhoc_wpa (connection)) {
|
||||
_LOGW (LOGD_WIFI, "Ad-Hoc WPA disabled due to kernel bugs");
|
||||
*reason = NM_DEVICE_STATE_REASON_SUPPLICANT_CONFIG_FAILED;
|
||||
NM_SET_OUT (out_failure_reason, NM_DEVICE_STATE_REASON_SUPPLICANT_CONFIG_FAILED);
|
||||
return NM_ACT_STAGE_RETURN_FAILURE;
|
||||
}
|
||||
|
||||
@@ -2563,7 +2562,7 @@ set_powersave (NMDevice *device)
|
||||
}
|
||||
|
||||
static NMActStageReturn
|
||||
act_stage2_config (NMDevice *device, NMDeviceStateReason *reason)
|
||||
act_stage2_config (NMDevice *device, NMDeviceStateReason *out_failure_reason)
|
||||
{
|
||||
NMDeviceWifi *self = NM_DEVICE_WIFI (device);
|
||||
NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self);
|
||||
@@ -2577,17 +2576,15 @@ act_stage2_config (NMDevice *device, NMDeviceStateReason *reason)
|
||||
GError *error = NULL;
|
||||
guint timeout;
|
||||
|
||||
g_return_val_if_fail (reason != NULL, NM_ACT_STAGE_RETURN_FAILURE);
|
||||
|
||||
nm_clear_g_source (&priv->sup_timeout_id);
|
||||
nm_clear_g_source (&priv->link_timeout_id);
|
||||
|
||||
req = nm_device_get_act_request (device);
|
||||
g_assert (req);
|
||||
g_return_val_if_fail (req, NM_ACT_STAGE_RETURN_FAILURE);
|
||||
|
||||
ap = priv->current_ap;
|
||||
if (!ap) {
|
||||
*reason = NM_DEVICE_STATE_REASON_SUPPLICANT_FAILED;
|
||||
NM_SET_OUT (out_failure_reason, NM_DEVICE_STATE_REASON_SUPPLICANT_FAILED);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -2604,9 +2601,12 @@ act_stage2_config (NMDevice *device, NMDeviceStateReason *reason)
|
||||
"Activation: (wifi) access point '%s' has security, but secrets are required.",
|
||||
nm_connection_get_id (connection));
|
||||
|
||||
ret = handle_auth_or_fail (self, req, FALSE);
|
||||
if (ret == NM_ACT_STAGE_RETURN_FAILURE)
|
||||
*reason = NM_DEVICE_STATE_REASON_NO_SECRETS;
|
||||
if (handle_auth_or_fail (self, req, FALSE))
|
||||
ret = NM_ACT_STAGE_RETURN_POSTPONE;
|
||||
else {
|
||||
NM_SET_OUT (out_failure_reason, NM_DEVICE_STATE_REASON_NO_SECRETS);
|
||||
ret = NM_ACT_STAGE_RETURN_FAILURE;
|
||||
}
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -2640,7 +2640,7 @@ act_stage2_config (NMDevice *device, NMDeviceStateReason *reason)
|
||||
"Activation: (wifi) couldn't build wireless configuration: %s",
|
||||
error->message);
|
||||
g_clear_error (&error);
|
||||
*reason = NM_DEVICE_STATE_REASON_SUPPLICANT_CONFIG_FAILED;
|
||||
NM_SET_OUT (out_failure_reason, NM_DEVICE_STATE_REASON_SUPPLICANT_CONFIG_FAILED);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -2675,14 +2675,15 @@ out:
|
||||
static NMActStageReturn
|
||||
act_stage3_ip4_config_start (NMDevice *device,
|
||||
NMIP4Config **out_config,
|
||||
NMDeviceStateReason *reason)
|
||||
NMDeviceStateReason *out_failure_reason)
|
||||
{
|
||||
NMConnection *connection;
|
||||
NMSettingIPConfig *s_ip4;
|
||||
const char *method = NM_SETTING_IP4_CONFIG_METHOD_AUTO;
|
||||
|
||||
connection = nm_device_get_applied_connection (device);
|
||||
g_assert (connection);
|
||||
g_return_val_if_fail (connection, NM_ACT_STAGE_RETURN_FAILURE);
|
||||
|
||||
s_ip4 = nm_connection_get_setting_ip4_config (connection);
|
||||
if (s_ip4)
|
||||
method = nm_setting_ip_config_get_method (s_ip4);
|
||||
@@ -2691,20 +2692,21 @@ act_stage3_ip4_config_start (NMDevice *device,
|
||||
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);
|
||||
|
||||
return NM_DEVICE_CLASS (nm_device_wifi_parent_class)->act_stage3_ip4_config_start (device, out_config, reason);
|
||||
return NM_DEVICE_CLASS (nm_device_wifi_parent_class)->act_stage3_ip4_config_start (device, out_config, out_failure_reason);
|
||||
}
|
||||
|
||||
static NMActStageReturn
|
||||
act_stage3_ip6_config_start (NMDevice *device,
|
||||
NMIP6Config **out_config,
|
||||
NMDeviceStateReason *reason)
|
||||
NMDeviceStateReason *out_failure_reason)
|
||||
{
|
||||
NMConnection *connection;
|
||||
NMSettingIPConfig *s_ip6;
|
||||
const char *method = NM_SETTING_IP6_CONFIG_METHOD_AUTO;
|
||||
|
||||
connection = nm_device_get_applied_connection (device);
|
||||
g_assert (connection);
|
||||
g_return_val_if_fail (connection, NM_ACT_STAGE_RETURN_FAILURE);
|
||||
|
||||
s_ip6 = nm_connection_get_setting_ip6_config (connection);
|
||||
if (s_ip6)
|
||||
method = nm_setting_ip_config_get_method (s_ip6);
|
||||
@@ -2714,7 +2716,7 @@ act_stage3_ip6_config_start (NMDevice *device,
|
||||
strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_DHCP) == 0)
|
||||
nm_platform_wifi_indicate_addressing_running (NM_PLATFORM_GET, nm_device_get_ifindex (device), TRUE);
|
||||
|
||||
return NM_DEVICE_CLASS (nm_device_wifi_parent_class)->act_stage3_ip6_config_start (device, out_config, reason);
|
||||
return NM_DEVICE_CLASS (nm_device_wifi_parent_class)->act_stage3_ip6_config_start (device, out_config, out_failure_reason);
|
||||
}
|
||||
|
||||
static guint32
|
||||
@@ -2771,7 +2773,7 @@ handle_ip_config_timeout (NMDeviceWifi *self,
|
||||
NMConnection *connection,
|
||||
gboolean may_fail,
|
||||
gboolean *chain_up,
|
||||
NMDeviceStateReason *reason)
|
||||
NMDeviceStateReason *out_failure_reason)
|
||||
{
|
||||
NMActStageReturn ret = NM_ACT_STAGE_RETURN_FAILURE;
|
||||
|
||||
@@ -2779,7 +2781,7 @@ handle_ip_config_timeout (NMDeviceWifi *self,
|
||||
|
||||
if (NM_DEVICE_WIFI_GET_PRIVATE (self)->mode == NM_802_11_MODE_AP) {
|
||||
*chain_up = TRUE;
|
||||
return ret;
|
||||
return NM_ACT_STAGE_RETURN_FAILURE;
|
||||
}
|
||||
|
||||
/* If IP configuration times out and it's a static WEP connection, that
|
||||
@@ -2795,12 +2797,13 @@ handle_ip_config_timeout (NMDeviceWifi *self,
|
||||
"Activation: (wifi) could not get IP configuration for connection '%s'.",
|
||||
nm_connection_get_id (connection));
|
||||
|
||||
ret = handle_auth_or_fail (self, NULL, TRUE);
|
||||
if (ret == NM_ACT_STAGE_RETURN_POSTPONE) {
|
||||
if (handle_auth_or_fail (self, NULL, TRUE)) {
|
||||
_LOGI (LOGD_DEVICE | LOGD_WIFI,
|
||||
"Activation: (wifi) asking for new secrets");
|
||||
ret = NM_ACT_STAGE_RETURN_POSTPONE;
|
||||
} else {
|
||||
*reason = NM_DEVICE_STATE_REASON_NO_SECRETS;
|
||||
NM_SET_OUT (out_failure_reason, NM_DEVICE_STATE_REASON_NO_SECRETS);
|
||||
ret = NM_ACT_STAGE_RETURN_FAILURE;
|
||||
}
|
||||
} else {
|
||||
/* Not static WEP or failure allowed; let superclass handle it */
|
||||
@@ -2812,7 +2815,7 @@ handle_ip_config_timeout (NMDeviceWifi *self,
|
||||
|
||||
|
||||
static NMActStageReturn
|
||||
act_stage4_ip4_config_timeout (NMDevice *device, NMDeviceStateReason *reason)
|
||||
act_stage4_ip4_config_timeout (NMDevice *device, NMDeviceStateReason *out_failure_reason)
|
||||
{
|
||||
NMConnection *connection;
|
||||
NMSettingIPConfig *s_ip4;
|
||||
@@ -2820,20 +2823,20 @@ act_stage4_ip4_config_timeout (NMDevice *device, NMDeviceStateReason *reason)
|
||||
NMActStageReturn ret;
|
||||
|
||||
connection = nm_device_get_applied_connection (device);
|
||||
g_assert (connection);
|
||||
g_return_val_if_fail (connection, NM_ACT_STAGE_RETURN_FAILURE);
|
||||
|
||||
s_ip4 = nm_connection_get_setting_ip4_config (connection);
|
||||
may_fail = nm_setting_ip_config_get_may_fail (s_ip4);
|
||||
|
||||
ret = handle_ip_config_timeout (NM_DEVICE_WIFI (device), connection, may_fail, &chain_up, reason);
|
||||
ret = handle_ip_config_timeout (NM_DEVICE_WIFI (device), connection, may_fail, &chain_up, out_failure_reason);
|
||||
if (chain_up)
|
||||
ret = NM_DEVICE_CLASS (nm_device_wifi_parent_class)->act_stage4_ip4_config_timeout (device, reason);
|
||||
ret = NM_DEVICE_CLASS (nm_device_wifi_parent_class)->act_stage4_ip4_config_timeout (device, out_failure_reason);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static NMActStageReturn
|
||||
act_stage4_ip6_config_timeout (NMDevice *device, NMDeviceStateReason *reason)
|
||||
act_stage4_ip6_config_timeout (NMDevice *device, NMDeviceStateReason *out_failure_reason)
|
||||
{
|
||||
NMConnection *connection;
|
||||
NMSettingIPConfig *s_ip6;
|
||||
@@ -2841,14 +2844,14 @@ act_stage4_ip6_config_timeout (NMDevice *device, NMDeviceStateReason *reason)
|
||||
NMActStageReturn ret;
|
||||
|
||||
connection = nm_device_get_applied_connection (device);
|
||||
g_assert (connection);
|
||||
g_return_val_if_fail (connection, NM_ACT_STAGE_RETURN_FAILURE);
|
||||
|
||||
s_ip6 = nm_connection_get_setting_ip6_config (connection);
|
||||
may_fail = nm_setting_ip_config_get_may_fail (s_ip6);
|
||||
|
||||
ret = handle_ip_config_timeout (NM_DEVICE_WIFI (device), connection, may_fail, &chain_up, reason);
|
||||
ret = handle_ip_config_timeout (NM_DEVICE_WIFI (device), connection, may_fail, &chain_up, out_failure_reason);
|
||||
if (chain_up)
|
||||
ret = NM_DEVICE_CLASS (nm_device_wifi_parent_class)->act_stage4_ip6_config_timeout (device, reason);
|
||||
ret = NM_DEVICE_CLASS (nm_device_wifi_parent_class)->act_stage4_ip6_config_timeout (device, out_failure_reason);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@@ -201,7 +201,7 @@ modem_ip6_config_result (NMModem *modem,
|
||||
NMDeviceModem *self = NM_DEVICE_MODEM (user_data);
|
||||
NMDevice *device = NM_DEVICE (self);
|
||||
NMActStageReturn ret;
|
||||
NMDeviceStateReason reason = NM_DEVICE_STATE_REASON_NONE;
|
||||
NMDeviceStateReason failure_reason = NM_DEVICE_STATE_REASON_NONE;
|
||||
NMIP6Config *ignored = NULL;
|
||||
gboolean got_config = !!config;
|
||||
|
||||
@@ -235,11 +235,11 @@ modem_ip6_config_result (NMModem *modem,
|
||||
}
|
||||
|
||||
/* Start SLAAC now that we have a link-local address from the modem */
|
||||
ret = NM_DEVICE_CLASS (nm_device_modem_parent_class)->act_stage3_ip6_config_start (device, &ignored, &reason);
|
||||
ret = NM_DEVICE_CLASS (nm_device_modem_parent_class)->act_stage3_ip6_config_start (device, &ignored, &failure_reason);
|
||||
g_assert (ignored == NULL);
|
||||
switch (ret) {
|
||||
case NM_ACT_STAGE_RETURN_FAILURE:
|
||||
nm_device_ip_method_failed (device, AF_INET6, reason);
|
||||
nm_device_ip_method_failed (device, AF_INET6, failure_reason);
|
||||
break;
|
||||
case NM_ACT_STAGE_RETURN_IP_FAIL:
|
||||
/* all done */
|
||||
@@ -509,41 +509,41 @@ deactivate_async (NMDevice *self,
|
||||
/*****************************************************************************/
|
||||
|
||||
static NMActStageReturn
|
||||
act_stage1_prepare (NMDevice *device, NMDeviceStateReason *reason)
|
||||
act_stage1_prepare (NMDevice *device, NMDeviceStateReason *out_failure_reason)
|
||||
{
|
||||
NMActStageReturn ret;
|
||||
NMActRequest *req;
|
||||
|
||||
ret = NM_DEVICE_CLASS (nm_device_modem_parent_class)->act_stage1_prepare (device, reason);
|
||||
ret = NM_DEVICE_CLASS (nm_device_modem_parent_class)->act_stage1_prepare (device, out_failure_reason);
|
||||
if (ret != NM_ACT_STAGE_RETURN_SUCCESS)
|
||||
return ret;
|
||||
|
||||
req = nm_device_get_act_request (device);
|
||||
g_assert (req);
|
||||
g_return_val_if_fail (req, NM_ACT_STAGE_RETURN_FAILURE);
|
||||
|
||||
return nm_modem_act_stage1_prepare (NM_DEVICE_MODEM_GET_PRIVATE ((NMDeviceModem *) device)->modem, req, reason);
|
||||
return nm_modem_act_stage1_prepare (NM_DEVICE_MODEM_GET_PRIVATE ((NMDeviceModem *) device)->modem, req, out_failure_reason);
|
||||
}
|
||||
|
||||
static NMActStageReturn
|
||||
act_stage2_config (NMDevice *device, NMDeviceStateReason *reason)
|
||||
act_stage2_config (NMDevice *device, NMDeviceStateReason *out_failure_reason)
|
||||
{
|
||||
NMActRequest *req;
|
||||
|
||||
req = nm_device_get_act_request (device);
|
||||
g_assert (req);
|
||||
g_return_val_if_fail (req, NM_ACT_STAGE_RETURN_FAILURE);
|
||||
|
||||
return nm_modem_act_stage2_config (NM_DEVICE_MODEM_GET_PRIVATE ((NMDeviceModem *) device)->modem, req, reason);
|
||||
return nm_modem_act_stage2_config (NM_DEVICE_MODEM_GET_PRIVATE ((NMDeviceModem *) device)->modem, req, out_failure_reason);
|
||||
}
|
||||
|
||||
static NMActStageReturn
|
||||
act_stage3_ip4_config_start (NMDevice *device,
|
||||
NMIP4Config **out_config,
|
||||
NMDeviceStateReason *reason)
|
||||
NMDeviceStateReason *out_failure_reason)
|
||||
{
|
||||
return nm_modem_stage3_ip4_config_start (NM_DEVICE_MODEM_GET_PRIVATE ((NMDeviceModem *) device)->modem,
|
||||
device,
|
||||
NM_DEVICE_CLASS (nm_device_modem_parent_class),
|
||||
reason);
|
||||
out_failure_reason);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -555,11 +555,11 @@ ip4_config_pre_commit (NMDevice *device, NMIP4Config *config)
|
||||
static NMActStageReturn
|
||||
act_stage3_ip6_config_start (NMDevice *device,
|
||||
NMIP6Config **out_config,
|
||||
NMDeviceStateReason *reason)
|
||||
NMDeviceStateReason *out_failure_reason)
|
||||
{
|
||||
return nm_modem_stage3_ip6_config_start (NM_DEVICE_MODEM_GET_PRIVATE ((NMDeviceModem *) device)->modem,
|
||||
nm_device_get_act_request (device),
|
||||
reason);
|
||||
out_failure_reason);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@@ -581,7 +581,7 @@ connect_context_step (NMModemBroadband *self)
|
||||
static NMActStageReturn
|
||||
act_stage1_prepare (NMModem *_self,
|
||||
NMConnection *connection,
|
||||
NMDeviceStateReason *reason)
|
||||
NMDeviceStateReason *out_failure_reason)
|
||||
{
|
||||
NMModemBroadband *self = NM_MODEM_BROADBAND (_self);
|
||||
|
||||
@@ -590,7 +590,7 @@ act_stage1_prepare (NMModem *_self,
|
||||
self->_priv.simple_iface = mm_object_get_modem_simple (self->_priv.modem_object);
|
||||
if (!self->_priv.simple_iface) {
|
||||
_LOGW ("cannot access the Simple mobile broadband modem interface");
|
||||
*reason = NM_DEVICE_STATE_REASON_MODEM_INIT_FAILED;
|
||||
NM_SET_OUT (out_failure_reason, NM_DEVICE_STATE_REASON_MODEM_INIT_FAILED);
|
||||
return NM_ACT_STAGE_RETURN_FAILURE;
|
||||
}
|
||||
}
|
||||
@@ -944,7 +944,7 @@ out:
|
||||
static NMActStageReturn
|
||||
static_stage3_ip4_config_start (NMModem *_self,
|
||||
NMActRequest *req,
|
||||
NMDeviceStateReason *reason)
|
||||
NMDeviceStateReason *out_failure_reason)
|
||||
{
|
||||
NMModemBroadband *self = NM_MODEM_BROADBAND (_self);
|
||||
|
||||
@@ -1050,7 +1050,7 @@ out:
|
||||
}
|
||||
|
||||
static NMActStageReturn
|
||||
stage3_ip6_config_request (NMModem *_self, NMDeviceStateReason *reason)
|
||||
stage3_ip6_config_request (NMModem *_self, NMDeviceStateReason *out_failure_reason)
|
||||
{
|
||||
NMModemBroadband *self = NM_MODEM_BROADBAND (_self);
|
||||
|
||||
|
@@ -922,14 +922,17 @@ out:
|
||||
static NMActStageReturn
|
||||
static_stage3_ip4_config_start (NMModem *modem,
|
||||
NMActRequest *req,
|
||||
NMDeviceStateReason *reason)
|
||||
NMDeviceStateReason *out_failure_reason)
|
||||
{
|
||||
NMModemOfono *self = NM_MODEM_OFONO (modem);
|
||||
NMModemOfonoPrivate *priv = NM_MODEM_OFONO_GET_PRIVATE (self);
|
||||
NMActStageReturn ret = NM_ACT_STAGE_RETURN_FAILURE;
|
||||
GError *error = NULL;
|
||||
|
||||
if (priv->ip4_config) {
|
||||
if (!priv->ip4_config) {
|
||||
_LOGD ("IP4 config not ready(?)");
|
||||
return NM_ACT_STAGE_RETURN_FAILURE;
|
||||
}
|
||||
|
||||
_LOGD ("IP4 config is done; setting modem_state -> CONNECTED");
|
||||
g_signal_emit_by_name (self, NM_MODEM_IP4_CONFIG_RESULT, priv->ip4_config, error);
|
||||
|
||||
@@ -939,10 +942,7 @@ static_stage3_ip4_config_start (NMModem *modem,
|
||||
nm_modem_set_state (NM_MODEM (self),
|
||||
NM_MODEM_STATE_CONNECTED,
|
||||
nm_modem_state_to_string (NM_MODEM_STATE_CONNECTED));
|
||||
ret = NM_ACT_STAGE_RETURN_POSTPONE;
|
||||
}
|
||||
|
||||
return ret;
|
||||
return NM_ACT_STAGE_RETURN_POSTPONE;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1038,7 +1038,7 @@ create_connect_properties (NMConnection *connection)
|
||||
static NMActStageReturn
|
||||
act_stage1_prepare (NMModem *modem,
|
||||
NMConnection *connection,
|
||||
NMDeviceStateReason *reason)
|
||||
NMDeviceStateReason *out_failure_reason)
|
||||
{
|
||||
NMModemOfono *self = NM_MODEM_OFONO (modem);
|
||||
NMModemOfonoPrivate *priv = NM_MODEM_OFONO_GET_PRIVATE (self);
|
||||
@@ -1047,7 +1047,7 @@ act_stage1_prepare (NMModem *modem,
|
||||
|
||||
context_id = nm_connection_get_id (connection);
|
||||
id = g_strsplit (context_id, "/", 0);
|
||||
g_assert (id[2]);
|
||||
g_return_val_if_fail (id[2], NM_ACT_STAGE_RETURN_FAILURE);
|
||||
|
||||
_LOGD ("trying %s %s", id[1], id[2]);
|
||||
|
||||
@@ -1058,7 +1058,7 @@ act_stage1_prepare (NMModem *modem,
|
||||
g_strfreev (id);
|
||||
|
||||
if (!priv->context_path) {
|
||||
*reason = NM_DEVICE_STATE_REASON_GSM_APN_FAILED;
|
||||
NM_SET_OUT (out_failure_reason, NM_DEVICE_STATE_REASON_GSM_APN_FAILED);
|
||||
return NM_ACT_STAGE_RETURN_FAILURE;
|
||||
}
|
||||
|
||||
@@ -1073,7 +1073,7 @@ act_stage1_prepare (NMModem *modem,
|
||||
do_context_activate (self);
|
||||
} else {
|
||||
_LOGW ("could not activate context: modem is not registered.");
|
||||
*reason = NM_DEVICE_STATE_REASON_MODEM_NO_CARRIER;
|
||||
NM_SET_OUT (out_failure_reason, NM_DEVICE_STATE_REASON_MODEM_NO_CARRIER);
|
||||
return NM_ACT_STAGE_RETURN_FAILURE;
|
||||
}
|
||||
|
||||
|
@@ -514,18 +514,16 @@ port_speed_is_zero (const char *port)
|
||||
static NMActStageReturn
|
||||
ppp_stage3_ip_config_start (NMModem *self,
|
||||
NMActRequest *req,
|
||||
NMDeviceStateReason *reason)
|
||||
NMDeviceStateReason *out_failure_reason)
|
||||
{
|
||||
NMModemPrivate *priv = NM_MODEM_GET_PRIVATE (self);
|
||||
const char *ppp_name = NULL;
|
||||
GError *error = NULL;
|
||||
NMActStageReturn ret;
|
||||
guint ip_timeout = 30;
|
||||
guint baud_override = 0;
|
||||
|
||||
g_return_val_if_fail (NM_IS_MODEM (self), NM_ACT_STAGE_RETURN_FAILURE);
|
||||
g_return_val_if_fail (NM_IS_ACT_REQUEST (req), NM_ACT_STAGE_RETURN_FAILURE);
|
||||
g_return_val_if_fail (reason != NULL, NM_ACT_STAGE_RETURN_FAILURE);
|
||||
|
||||
/* If we're already running PPP don't restart it; for example, if both
|
||||
* IPv4 and IPv6 are requested, IPv4 gets started first, but we use the
|
||||
@@ -560,9 +558,21 @@ ppp_stage3_ip_config_start (NMModem *self,
|
||||
baud_override = 57600;
|
||||
|
||||
priv->ppp_manager = nm_ppp_manager_create (priv->data_port, &error);
|
||||
if ( priv->ppp_manager
|
||||
&& nm_ppp_manager_start (priv->ppp_manager, req, ppp_name,
|
||||
|
||||
if ( !priv->ppp_manager
|
||||
|| !nm_ppp_manager_start (priv->ppp_manager, req, ppp_name,
|
||||
ip_timeout, baud_override, &error)) {
|
||||
nm_log_err (LOGD_PPP, "(%s): error starting PPP: %s",
|
||||
nm_modem_get_uid (self),
|
||||
error->message);
|
||||
g_error_free (error);
|
||||
|
||||
g_clear_object (&priv->ppp_manager);
|
||||
|
||||
NM_SET_OUT (out_failure_reason, NM_DEVICE_STATE_REASON_PPP_START_FAILED);
|
||||
return NM_ACT_STAGE_RETURN_FAILURE;
|
||||
}
|
||||
|
||||
g_signal_connect (priv->ppp_manager, NM_PPP_MANAGER_SIGNAL_STATE_CHANGED,
|
||||
G_CALLBACK (ppp_state_changed),
|
||||
self);
|
||||
@@ -576,20 +586,7 @@ ppp_stage3_ip_config_start (NMModem *self,
|
||||
G_CALLBACK (ppp_stats),
|
||||
self);
|
||||
|
||||
ret = NM_ACT_STAGE_RETURN_POSTPONE;
|
||||
} else {
|
||||
nm_log_err (LOGD_PPP, "(%s): error starting PPP: %s",
|
||||
nm_modem_get_uid (self),
|
||||
error->message);
|
||||
g_error_free (error);
|
||||
|
||||
g_clear_object (&priv->ppp_manager);
|
||||
|
||||
*reason = NM_DEVICE_STATE_REASON_PPP_START_FAILED;
|
||||
ret = NM_ACT_STAGE_RETURN_FAILURE;
|
||||
}
|
||||
|
||||
return ret;
|
||||
return NM_ACT_STAGE_RETURN_POSTPONE;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
@@ -598,7 +595,7 @@ NMActStageReturn
|
||||
nm_modem_stage3_ip4_config_start (NMModem *self,
|
||||
NMDevice *device,
|
||||
NMDeviceClass *device_class,
|
||||
NMDeviceStateReason *reason)
|
||||
NMDeviceStateReason *out_failure_reason)
|
||||
{
|
||||
NMModemPrivate *priv;
|
||||
NMActRequest *req;
|
||||
@@ -611,12 +608,13 @@ nm_modem_stage3_ip4_config_start (NMModem *self,
|
||||
g_return_val_if_fail (NM_IS_MODEM (self), NM_ACT_STAGE_RETURN_FAILURE);
|
||||
g_return_val_if_fail (NM_IS_DEVICE (device), NM_ACT_STAGE_RETURN_FAILURE);
|
||||
g_return_val_if_fail (NM_IS_DEVICE_CLASS (device_class), NM_ACT_STAGE_RETURN_FAILURE);
|
||||
g_return_val_if_fail (reason != NULL, NM_ACT_STAGE_RETURN_FAILURE);
|
||||
|
||||
req = nm_device_get_act_request (device);
|
||||
g_assert (req);
|
||||
g_return_val_if_fail (req, NM_ACT_STAGE_RETURN_FAILURE);
|
||||
|
||||
connection = nm_act_request_get_applied_connection (req);
|
||||
g_assert (connection);
|
||||
g_return_val_if_fail (connection, NM_ACT_STAGE_RETURN_FAILURE);
|
||||
|
||||
method = nm_utils_get_ip_config_method (connection, NM_TYPE_SETTING_IP4_CONFIG);
|
||||
|
||||
/* Only Disabled and Auto methods make sense for WWAN */
|
||||
@@ -627,22 +625,22 @@ nm_modem_stage3_ip4_config_start (NMModem *self,
|
||||
nm_log_warn (LOGD_MB | LOGD_IP4,
|
||||
"(%s): unhandled WWAN IPv4 method '%s'; will fail",
|
||||
nm_modem_get_uid (self), method);
|
||||
*reason = NM_DEVICE_STATE_REASON_IP_CONFIG_UNAVAILABLE;
|
||||
NM_SET_OUT (out_failure_reason, NM_DEVICE_STATE_REASON_IP_CONFIG_UNAVAILABLE);
|
||||
return NM_ACT_STAGE_RETURN_FAILURE;
|
||||
}
|
||||
|
||||
priv = NM_MODEM_GET_PRIVATE (self);
|
||||
switch (priv->ip4_method) {
|
||||
case NM_MODEM_IP_METHOD_PPP:
|
||||
ret = ppp_stage3_ip_config_start (self, req, reason);
|
||||
ret = ppp_stage3_ip_config_start (self, req, out_failure_reason);
|
||||
break;
|
||||
case NM_MODEM_IP_METHOD_STATIC:
|
||||
nm_log_dbg (LOGD_MB, "MODEM_IP_METHOD_STATIC");
|
||||
ret = NM_MODEM_GET_CLASS (self)->static_stage3_ip4_config_start (self, req, reason);
|
||||
ret = NM_MODEM_GET_CLASS (self)->static_stage3_ip4_config_start (self, req, out_failure_reason);
|
||||
break;
|
||||
case NM_MODEM_IP_METHOD_AUTO:
|
||||
nm_log_dbg (LOGD_MB, "MODEM_IP_METHOD_AUTO");
|
||||
ret = device_class->act_stage3_ip4_config_start (device, NULL, reason);
|
||||
ret = device_class->act_stage3_ip4_config_start (device, NULL, out_failure_reason);
|
||||
break;
|
||||
default:
|
||||
nm_log_info (LOGD_MB, "(%s): IPv4 configuration disabled", nm_modem_get_uid (self));
|
||||
@@ -712,30 +710,28 @@ nm_modem_emit_ip6_config_result (NMModem *self,
|
||||
}
|
||||
|
||||
static NMActStageReturn
|
||||
stage3_ip6_config_request (NMModem *self, NMDeviceStateReason *reason)
|
||||
stage3_ip6_config_request (NMModem *self, NMDeviceStateReason *out_failure_reason)
|
||||
{
|
||||
*reason = NM_DEVICE_STATE_REASON_IP_CONFIG_UNAVAILABLE;
|
||||
NM_SET_OUT (out_failure_reason, NM_DEVICE_STATE_REASON_IP_CONFIG_UNAVAILABLE);
|
||||
return NM_ACT_STAGE_RETURN_FAILURE;
|
||||
}
|
||||
|
||||
NMActStageReturn
|
||||
nm_modem_stage3_ip6_config_start (NMModem *self,
|
||||
NMActRequest *req,
|
||||
NMDeviceStateReason *reason)
|
||||
NMDeviceStateReason *out_failure_reason)
|
||||
{
|
||||
NMModemPrivate *priv;
|
||||
NMActStageReturn ret;
|
||||
NMConnection *connection;
|
||||
const char *method;
|
||||
|
||||
g_return_val_if_fail (self != NULL, NM_ACT_STAGE_RETURN_FAILURE);
|
||||
g_return_val_if_fail (NM_IS_MODEM (self), NM_ACT_STAGE_RETURN_FAILURE);
|
||||
g_return_val_if_fail (req != NULL, NM_ACT_STAGE_RETURN_FAILURE);
|
||||
g_return_val_if_fail (NM_IS_ACT_REQUEST (req), NM_ACT_STAGE_RETURN_FAILURE);
|
||||
g_return_val_if_fail (reason != NULL, NM_ACT_STAGE_RETURN_FAILURE);
|
||||
|
||||
connection = nm_act_request_get_applied_connection (req);
|
||||
g_assert (connection);
|
||||
g_return_val_if_fail (connection, NM_ACT_STAGE_RETURN_FAILURE);
|
||||
|
||||
method = nm_utils_get_ip_config_method (connection, NM_TYPE_SETTING_IP6_CONFIG);
|
||||
|
||||
/* Only Ignore and Auto methods make sense for WWAN */
|
||||
@@ -746,14 +742,14 @@ nm_modem_stage3_ip6_config_start (NMModem *self,
|
||||
nm_log_warn (LOGD_MB | LOGD_IP6,
|
||||
"(%s): unhandled WWAN IPv6 method '%s'; will fail",
|
||||
nm_modem_get_uid (self), method);
|
||||
*reason = NM_DEVICE_STATE_REASON_IP_CONFIG_UNAVAILABLE;
|
||||
NM_SET_OUT (out_failure_reason, NM_DEVICE_STATE_REASON_IP_CONFIG_UNAVAILABLE);
|
||||
return NM_ACT_STAGE_RETURN_FAILURE;
|
||||
}
|
||||
|
||||
priv = NM_MODEM_GET_PRIVATE (self);
|
||||
switch (priv->ip6_method) {
|
||||
case NM_MODEM_IP_METHOD_PPP:
|
||||
ret = ppp_stage3_ip_config_start (self, req, reason);
|
||||
ret = ppp_stage3_ip_config_start (self, req, out_failure_reason);
|
||||
break;
|
||||
case NM_MODEM_IP_METHOD_STATIC:
|
||||
case NM_MODEM_IP_METHOD_AUTO:
|
||||
@@ -761,7 +757,7 @@ nm_modem_stage3_ip6_config_start (NMModem *self,
|
||||
* which in the static case is the full config, and the DHCP/Auto case
|
||||
* is just the IPv6LL address to use for SLAAC.
|
||||
*/
|
||||
ret = NM_MODEM_GET_CLASS (self)->stage3_ip6_config_request (self, reason);
|
||||
ret = NM_MODEM_GET_CLASS (self)->stage3_ip6_config_request (self, out_failure_reason);
|
||||
break;
|
||||
default:
|
||||
nm_log_info (LOGD_MB, "(%s): IPv6 configuration disabled", nm_modem_get_uid (self));
|
||||
@@ -874,16 +870,16 @@ nm_modem_get_secrets (NMModem *self,
|
||||
static NMActStageReturn
|
||||
act_stage1_prepare (NMModem *modem,
|
||||
NMConnection *connection,
|
||||
NMDeviceStateReason *reason)
|
||||
NMDeviceStateReason *out_failure_reason)
|
||||
{
|
||||
*reason = NM_DEVICE_STATE_REASON_UNKNOWN;
|
||||
NM_SET_OUT (out_failure_reason, NM_DEVICE_STATE_REASON_UNKNOWN);
|
||||
return NM_ACT_STAGE_RETURN_FAILURE;
|
||||
}
|
||||
|
||||
NMActStageReturn
|
||||
nm_modem_act_stage1_prepare (NMModem *self,
|
||||
NMActRequest *req,
|
||||
NMDeviceStateReason *reason)
|
||||
NMDeviceStateReason *out_failure_reason)
|
||||
{
|
||||
NMModemPrivate *priv = NM_MODEM_GET_PRIVATE (self);
|
||||
gs_unref_ptrarray GPtrArray *hints = NULL;
|
||||
@@ -896,13 +892,13 @@ nm_modem_act_stage1_prepare (NMModem *self,
|
||||
priv->act_request = g_object_ref (req);
|
||||
|
||||
connection = nm_act_request_get_applied_connection (req);
|
||||
g_assert (connection);
|
||||
g_return_val_if_fail (connection, NM_ACT_STAGE_RETURN_FAILURE);
|
||||
|
||||
setting_name = nm_connection_need_secrets (connection, &hints);
|
||||
if (!setting_name) {
|
||||
/* Ready to connect */
|
||||
g_assert (!hints);
|
||||
return NM_MODEM_GET_CLASS (self)->act_stage1_prepare (self, connection, reason);
|
||||
return NM_MODEM_GET_CLASS (self)->act_stage1_prepare (self, connection, out_failure_reason);
|
||||
}
|
||||
|
||||
/* Secrets required... */
|
||||
@@ -926,7 +922,7 @@ nm_modem_act_stage1_prepare (NMModem *self,
|
||||
NMActStageReturn
|
||||
nm_modem_act_stage2_config (NMModem *self,
|
||||
NMActRequest *req,
|
||||
NMDeviceStateReason *reason)
|
||||
NMDeviceStateReason *out_failure_reason)
|
||||
{
|
||||
NMModemPrivate *priv = NM_MODEM_GET_PRIVATE (self);
|
||||
|
||||
|
@@ -132,17 +132,17 @@ typedef struct {
|
||||
|
||||
NMActStageReturn (*act_stage1_prepare) (NMModem *modem,
|
||||
NMConnection *connection,
|
||||
NMDeviceStateReason *reason);
|
||||
NMDeviceStateReason *out_failure_reason);
|
||||
|
||||
NMActStageReturn (*static_stage3_ip4_config_start) (NMModem *self,
|
||||
NMActRequest *req,
|
||||
NMDeviceStateReason *reason);
|
||||
NMDeviceStateReason *out_failure_reason);
|
||||
|
||||
/* Request the IP6 config; when the config returns the modem
|
||||
* subclass should emit the ip6_config_result signal.
|
||||
*/
|
||||
NMActStageReturn (*stage3_ip6_config_request) (NMModem *self,
|
||||
NMDeviceStateReason *reason);
|
||||
NMDeviceStateReason *out_failure_reason);
|
||||
|
||||
void (*set_mm_enabled) (NMModem *self, gboolean enabled);
|
||||
|
||||
@@ -187,20 +187,20 @@ gboolean nm_modem_complete_connection (NMModem *self,
|
||||
|
||||
NMActStageReturn nm_modem_act_stage1_prepare (NMModem *modem,
|
||||
NMActRequest *req,
|
||||
NMDeviceStateReason *reason);
|
||||
NMDeviceStateReason *out_failure_reason);
|
||||
|
||||
NMActStageReturn nm_modem_act_stage2_config (NMModem *modem,
|
||||
NMActRequest *req,
|
||||
NMDeviceStateReason *reason);
|
||||
NMDeviceStateReason *out_failure_reason);
|
||||
|
||||
NMActStageReturn nm_modem_stage3_ip4_config_start (NMModem *modem,
|
||||
NMDevice *device,
|
||||
NMDeviceClass *device_class,
|
||||
NMDeviceStateReason *reason);
|
||||
NMDeviceStateReason *out_failure_reason);
|
||||
|
||||
NMActStageReturn nm_modem_stage3_ip6_config_start (NMModem *modem,
|
||||
NMActRequest *req,
|
||||
NMDeviceStateReason *reason);
|
||||
NMDeviceStateReason *out_failure_reason);
|
||||
|
||||
void nm_modem_ip4_pre_commit (NMModem *modem, NMDevice *device, NMIP4Config *config);
|
||||
|
||||
|
Reference in New Issue
Block a user