mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-28 18:50:27 +01:00
device: merge stage3 and stage4 ip-config function for IPv4 and IPv6
This commit is contained in:
parent
03b708f7f7
commit
5e71f01605
13 changed files with 378 additions and 517 deletions
|
|
@ -518,6 +518,18 @@ act_stage3_ip4_config_start (NMDevice *device,
|
||||||
return NM_ACT_STAGE_RETURN_POSTPONE;
|
return NM_ACT_STAGE_RETURN_POSTPONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static NMActStageReturn
|
||||||
|
act_stage3_ip_config_start (NMDevice *device,
|
||||||
|
int addr_family,
|
||||||
|
gpointer *out_config,
|
||||||
|
NMDeviceStateReason *out_failure_reason)
|
||||||
|
{
|
||||||
|
if (addr_family == AF_INET)
|
||||||
|
return act_stage3_ip4_config_start (device, (NMIP4Config **) out_config, out_failure_reason);
|
||||||
|
|
||||||
|
return NM_DEVICE_CLASS (nm_device_adsl_parent_class)->act_stage3_ip_config_start (device, addr_family, out_config, out_failure_reason);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
adsl_cleanup (NMDeviceAdsl *self)
|
adsl_cleanup (NMDeviceAdsl *self)
|
||||||
{
|
{
|
||||||
|
|
@ -687,7 +699,7 @@ nm_device_adsl_class_init (NMDeviceAdslClass *klass)
|
||||||
device_class->complete_connection = complete_connection;
|
device_class->complete_connection = complete_connection;
|
||||||
|
|
||||||
device_class->act_stage2_config = act_stage2_config;
|
device_class->act_stage2_config = act_stage2_config;
|
||||||
device_class->act_stage3_ip4_config_start = act_stage3_ip4_config_start;
|
device_class->act_stage3_ip_config_start = act_stage3_ip_config_start;
|
||||||
device_class->deactivate = deactivate;
|
device_class->deactivate = deactivate;
|
||||||
|
|
||||||
obj_properties[PROP_ATM_INDEX] =
|
obj_properties[PROP_ATM_INDEX] =
|
||||||
|
|
|
||||||
|
|
@ -899,33 +899,29 @@ act_stage2_config (NMDevice *device, NMDeviceStateReason *out_failure_reason)
|
||||||
}
|
}
|
||||||
|
|
||||||
static NMActStageReturn
|
static NMActStageReturn
|
||||||
act_stage3_ip4_config_start (NMDevice *device,
|
act_stage3_ip_config_start (NMDevice *device,
|
||||||
NMIP4Config **out_config,
|
int addr_family,
|
||||||
NMDeviceStateReason *out_failure_reason)
|
gpointer *out_config,
|
||||||
|
NMDeviceStateReason *out_failure_reason)
|
||||||
{
|
{
|
||||||
NMDeviceBtPrivate *priv = NM_DEVICE_BT_GET_PRIVATE ((NMDeviceBt *) device);
|
NMDeviceBtPrivate *priv = NM_DEVICE_BT_GET_PRIVATE ((NMDeviceBt *) device);
|
||||||
|
|
||||||
|
nm_assert_addr_family (addr_family);
|
||||||
|
|
||||||
if (priv->bt_type == NM_BT_CAPABILITY_DUN) {
|
if (priv->bt_type == NM_BT_CAPABILITY_DUN) {
|
||||||
return nm_modem_stage3_ip4_config_start (priv->modem,
|
if (addr_family == AF_INET) {
|
||||||
device,
|
return nm_modem_stage3_ip4_config_start (priv->modem,
|
||||||
NM_DEVICE_CLASS (nm_device_bt_parent_class),
|
device,
|
||||||
out_failure_reason);
|
NM_DEVICE_CLASS (nm_device_bt_parent_class),
|
||||||
|
out_failure_reason);
|
||||||
|
} else {
|
||||||
|
return nm_modem_stage3_ip6_config_start (priv->modem,
|
||||||
|
device,
|
||||||
|
out_failure_reason);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NM_DEVICE_CLASS (nm_device_bt_parent_class)->act_stage3_ip4_config_start (device, out_config, out_failure_reason);
|
return NM_DEVICE_CLASS (nm_device_bt_parent_class)->act_stage3_ip_config_start (device, addr_family, out_config, out_failure_reason);
|
||||||
}
|
|
||||||
|
|
||||||
static NMActStageReturn
|
|
||||||
act_stage3_ip6_config_start (NMDevice *device,
|
|
||||||
NMIP6Config **out_config,
|
|
||||||
NMDeviceStateReason *out_failure_reason)
|
|
||||||
{
|
|
||||||
NMDeviceBtPrivate *priv = NM_DEVICE_BT_GET_PRIVATE ((NMDeviceBt *) device);
|
|
||||||
|
|
||||||
if (priv->bt_type == NM_BT_CAPABILITY_DUN)
|
|
||||||
return nm_modem_stage3_ip6_config_start (priv->modem, device, out_failure_reason);
|
|
||||||
|
|
||||||
return NM_DEVICE_CLASS (nm_device_bt_parent_class)->act_stage3_ip6_config_start (device, out_config, out_failure_reason);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -1204,8 +1200,7 @@ nm_device_bt_class_init (NMDeviceBtClass *klass)
|
||||||
device_class->can_auto_connect = can_auto_connect;
|
device_class->can_auto_connect = can_auto_connect;
|
||||||
device_class->deactivate = deactivate;
|
device_class->deactivate = deactivate;
|
||||||
device_class->act_stage2_config = act_stage2_config;
|
device_class->act_stage2_config = act_stage2_config;
|
||||||
device_class->act_stage3_ip4_config_start = act_stage3_ip4_config_start;
|
device_class->act_stage3_ip_config_start = act_stage3_ip_config_start;
|
||||||
device_class->act_stage3_ip6_config_start = act_stage3_ip6_config_start;
|
|
||||||
device_class->check_connection_compatible = check_connection_compatible;
|
device_class->check_connection_compatible = check_connection_compatible;
|
||||||
device_class->check_connection_available = check_connection_available;
|
device_class->check_connection_available = check_connection_available;
|
||||||
device_class->complete_connection = complete_connection;
|
device_class->complete_connection = complete_connection;
|
||||||
|
|
|
||||||
|
|
@ -1314,22 +1314,25 @@ act_stage2_config (NMDevice *device, NMDeviceStateReason *out_failure_reason)
|
||||||
}
|
}
|
||||||
|
|
||||||
static NMActStageReturn
|
static NMActStageReturn
|
||||||
act_stage3_ip4_config_start (NMDevice *device,
|
act_stage3_ip_config_start (NMDevice *device,
|
||||||
NMIP4Config **out_config,
|
int addr_family,
|
||||||
NMDeviceStateReason *out_failure_reason)
|
gpointer *out_config,
|
||||||
|
NMDeviceStateReason *out_failure_reason)
|
||||||
{
|
{
|
||||||
NMSettingConnection *s_con;
|
NMSettingConnection *s_con;
|
||||||
const char *connection_type;
|
const char *connection_type;
|
||||||
|
|
||||||
s_con = nm_device_get_applied_setting (device, NM_TYPE_SETTING_CONNECTION);
|
if (addr_family == AF_INET) {
|
||||||
|
s_con = nm_device_get_applied_setting (device, NM_TYPE_SETTING_CONNECTION);
|
||||||
|
|
||||||
g_return_val_if_fail (s_con, NM_ACT_STAGE_RETURN_FAILURE);
|
g_return_val_if_fail (s_con, NM_ACT_STAGE_RETURN_FAILURE);
|
||||||
|
|
||||||
connection_type = nm_setting_connection_get_connection_type (s_con);
|
connection_type = nm_setting_connection_get_connection_type (s_con);
|
||||||
if (!strcmp (connection_type, NM_SETTING_PPPOE_SETTING_NAME))
|
if (!strcmp (connection_type, NM_SETTING_PPPOE_SETTING_NAME))
|
||||||
return pppoe_stage3_ip4_config_start (NM_DEVICE_ETHERNET (device), out_failure_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, out_failure_reason);
|
return NM_DEVICE_CLASS (nm_device_ethernet_parent_class)->act_stage3_ip_config_start (device, addr_family, out_config, out_failure_reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
static guint32
|
static guint32
|
||||||
|
|
@ -1791,7 +1794,7 @@ nm_device_ethernet_class_init (NMDeviceEthernetClass *klass)
|
||||||
|
|
||||||
device_class->act_stage1_prepare = act_stage1_prepare;
|
device_class->act_stage1_prepare = act_stage1_prepare;
|
||||||
device_class->act_stage2_config = act_stage2_config;
|
device_class->act_stage2_config = act_stage2_config;
|
||||||
device_class->act_stage3_ip4_config_start = act_stage3_ip4_config_start;
|
device_class->act_stage3_ip_config_start = act_stage3_ip_config_start;
|
||||||
device_class->get_configured_mtu = get_configured_mtu;
|
device_class->get_configured_mtu = get_configured_mtu;
|
||||||
device_class->deactivate = deactivate;
|
device_class->deactivate = deactivate;
|
||||||
device_class->get_s390_subchannels = get_s390_subchannels;
|
device_class->get_s390_subchannels = get_s390_subchannels;
|
||||||
|
|
|
||||||
|
|
@ -173,23 +173,31 @@ act_stage2_config (NMDevice *device, NMDeviceStateReason *out_failure_reason)
|
||||||
}
|
}
|
||||||
|
|
||||||
static NMActStageReturn
|
static NMActStageReturn
|
||||||
act_stage3_ip4_config_start (NMDevice *device,
|
act_stage3_ip_config_start (NMDevice *device,
|
||||||
NMIP4Config **out_config,
|
int addr_family,
|
||||||
NMDeviceStateReason *out_failure_reason)
|
gpointer *out_config,
|
||||||
|
NMDeviceStateReason *out_failure_reason)
|
||||||
{
|
{
|
||||||
NMDevicePpp *self = NM_DEVICE_PPP (device);
|
if (addr_family == AF_INET) {
|
||||||
NMDevicePppPrivate *priv = NM_DEVICE_PPP_GET_PRIVATE (self);
|
NMDevicePpp *self = NM_DEVICE_PPP (device);
|
||||||
|
NMDevicePppPrivate *priv = NM_DEVICE_PPP_GET_PRIVATE (self);
|
||||||
|
|
||||||
if (priv->ip4_config) {
|
if (priv->ip4_config) {
|
||||||
if (out_config)
|
if (out_config)
|
||||||
*out_config = g_steal_pointer (&priv->ip4_config);
|
*out_config = g_steal_pointer (&priv->ip4_config);
|
||||||
else
|
else
|
||||||
g_clear_object (&priv->ip4_config);
|
g_clear_object (&priv->ip4_config);
|
||||||
return NM_ACT_STAGE_RETURN_SUCCESS;
|
return NM_ACT_STAGE_RETURN_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Wait IPCP termination */
|
||||||
|
return NM_ACT_STAGE_RETURN_POSTPONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Wait IPCP termination */
|
return NM_DEVICE_CLASS (nm_device_ppp_parent_class)->act_stage3_ip_config_start (device,
|
||||||
return NM_ACT_STAGE_RETURN_POSTPONE;
|
addr_family,
|
||||||
|
out_config,
|
||||||
|
out_failure_reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
|
@ -271,7 +279,7 @@ nm_device_ppp_class_init (NMDevicePppClass *klass)
|
||||||
device_class->link_types = NM_DEVICE_DEFINE_LINK_TYPES (NM_LINK_TYPE_PPP);
|
device_class->link_types = NM_DEVICE_DEFINE_LINK_TYPES (NM_LINK_TYPE_PPP);
|
||||||
|
|
||||||
device_class->act_stage2_config = act_stage2_config;
|
device_class->act_stage2_config = act_stage2_config;
|
||||||
device_class->act_stage3_ip4_config_start = act_stage3_ip4_config_start;
|
device_class->act_stage3_ip_config_start = act_stage3_ip_config_start;
|
||||||
device_class->create_and_realize = create_and_realize;
|
device_class->create_and_realize = create_and_realize;
|
||||||
device_class->deactivate = deactivate;
|
device_class->deactivate = deactivate;
|
||||||
device_class->get_generic_capabilities = get_generic_capabilities;
|
device_class->get_generic_capabilities = get_generic_capabilities;
|
||||||
|
|
|
||||||
|
|
@ -7785,25 +7785,21 @@ shared4_new_config (NMDevice *self, NMConnection *connection)
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
connection_ip4_method_requires_carrier (NMConnection *connection,
|
connection_ip_method_requires_carrier (NMConnection *connection,
|
||||||
gboolean *out_ip4_enabled)
|
int addr_family,
|
||||||
|
gboolean *out_ip_enabled)
|
||||||
{
|
{
|
||||||
const char *method;
|
const char *method;
|
||||||
|
|
||||||
method = nm_utils_get_ip_config_method (connection, AF_INET);
|
method = nm_utils_get_ip_config_method (connection, addr_family);
|
||||||
NM_SET_OUT (out_ip4_enabled, !nm_streq (method, NM_SETTING_IP4_CONFIG_METHOD_DISABLED));
|
|
||||||
return NM_IN_STRSET (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
|
|
||||||
NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL);
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
if (addr_family == AF_INET) {
|
||||||
connection_ip6_method_requires_carrier (NMConnection *connection,
|
NM_SET_OUT (out_ip_enabled, !nm_streq (method, NM_SETTING_IP4_CONFIG_METHOD_DISABLED));
|
||||||
gboolean *out_ip6_enabled)
|
return NM_IN_STRSET (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
|
||||||
{
|
NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL);
|
||||||
const char *method;
|
}
|
||||||
|
|
||||||
method = nm_utils_get_ip_config_method (connection, AF_INET6);
|
NM_SET_OUT (out_ip_enabled, !nm_streq (method, NM_SETTING_IP6_CONFIG_METHOD_IGNORE));
|
||||||
NM_SET_OUT (out_ip6_enabled, !nm_streq (method, NM_SETTING_IP6_CONFIG_METHOD_IGNORE));
|
|
||||||
return NM_IN_STRSET (method, NM_SETTING_IP6_CONFIG_METHOD_AUTO,
|
return NM_IN_STRSET (method, NM_SETTING_IP6_CONFIG_METHOD_AUTO,
|
||||||
NM_SETTING_IP6_CONFIG_METHOD_DHCP,
|
NM_SETTING_IP6_CONFIG_METHOD_DHCP,
|
||||||
NM_SETTING_IP6_CONFIG_METHOD_SHARED,
|
NM_SETTING_IP6_CONFIG_METHOD_SHARED,
|
||||||
|
|
@ -7824,7 +7820,7 @@ connection_requires_carrier (NMConnection *connection)
|
||||||
if (nm_setting_connection_get_master (s_con))
|
if (nm_setting_connection_get_master (s_con))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
ip4_carrier_wanted = connection_ip4_method_requires_carrier (connection, &ip4_used);
|
ip4_carrier_wanted = connection_ip_method_requires_carrier (connection, AF_INET, &ip4_used);
|
||||||
if (ip4_carrier_wanted) {
|
if (ip4_carrier_wanted) {
|
||||||
/* If IPv4 wants a carrier and cannot fail, the whole connection
|
/* If IPv4 wants a carrier and cannot fail, the whole connection
|
||||||
* requires a carrier regardless of the IPv6 method.
|
* requires a carrier regardless of the IPv6 method.
|
||||||
|
|
@ -7834,7 +7830,7 @@ connection_requires_carrier (NMConnection *connection)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ip6_carrier_wanted = connection_ip6_method_requires_carrier (connection, &ip6_used);
|
ip6_carrier_wanted = connection_ip_method_requires_carrier (connection, AF_INET6, &ip6_used);
|
||||||
if (ip6_carrier_wanted) {
|
if (ip6_carrier_wanted) {
|
||||||
/* If IPv6 wants a carrier and cannot fail, the whole connection
|
/* If IPv6 wants a carrier and cannot fail, the whole connection
|
||||||
* requires a carrier regardless of the IPv4 method.
|
* requires a carrier regardless of the IPv4 method.
|
||||||
|
|
@ -7875,108 +7871,6 @@ have_any_ready_slaves (NMDevice *self)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
|
||||||
ip4_requires_slaves (NMDevice *self)
|
|
||||||
{
|
|
||||||
const char *method;
|
|
||||||
|
|
||||||
method = nm_device_get_effective_ip_config_method (self, AF_INET);
|
|
||||||
return nm_streq (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO);
|
|
||||||
}
|
|
||||||
|
|
||||||
static NMActStageReturn
|
|
||||||
act_stage3_ip4_config_start (NMDevice *self,
|
|
||||||
NMIP4Config **out_config,
|
|
||||||
NMDeviceStateReason *out_failure_reason)
|
|
||||||
{
|
|
||||||
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
|
|
||||||
NMConnection *connection;
|
|
||||||
NMActStageReturn ret = NM_ACT_STAGE_RETURN_FAILURE;
|
|
||||||
const char *method;
|
|
||||||
|
|
||||||
connection = nm_device_get_applied_connection (self);
|
|
||||||
g_return_val_if_fail (connection, NM_ACT_STAGE_RETURN_FAILURE);
|
|
||||||
|
|
||||||
if ( connection_ip4_method_requires_carrier (connection, NULL)
|
|
||||||
&& nm_device_is_master (self)
|
|
||||||
&& !priv->carrier) {
|
|
||||||
_LOGI (LOGD_IP4 | LOGD_DEVICE,
|
|
||||||
"IPv4 config waiting until carrier is on");
|
|
||||||
return NM_ACT_STAGE_RETURN_IP_WAIT;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nm_device_is_master (self) && ip4_requires_slaves (self)) {
|
|
||||||
/* If the master has no ready slaves, and depends on slaves for
|
|
||||||
* a successful IPv4 attempt, then postpone IPv4 addressing.
|
|
||||||
*/
|
|
||||||
if (!have_any_ready_slaves (self)) {
|
|
||||||
_LOGI (LOGD_DEVICE | LOGD_IP4,
|
|
||||||
"IPv4 config waiting until slaves are ready");
|
|
||||||
return NM_ACT_STAGE_RETURN_IP_WAIT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
method = nm_device_get_effective_ip_config_method (self, AF_INET);
|
|
||||||
_LOGD (LOGD_IP4 | LOGD_DEVICE, "IPv4 config method is %s", method);
|
|
||||||
|
|
||||||
if (NM_IN_STRSET (method,
|
|
||||||
NM_SETTING_IP4_CONFIG_METHOD_AUTO,
|
|
||||||
NM_SETTING_IP4_CONFIG_METHOD_MANUAL)) {
|
|
||||||
NMSettingIPConfig *s_ip4;
|
|
||||||
NMIP4Config **configs, *config;
|
|
||||||
guint num_addresses;
|
|
||||||
|
|
||||||
s_ip4 = nm_connection_get_setting_ip4_config (connection);
|
|
||||||
g_return_val_if_fail (s_ip4, NM_ACT_STAGE_RETURN_FAILURE);
|
|
||||||
num_addresses = nm_setting_ip_config_get_num_addresses (s_ip4);
|
|
||||||
|
|
||||||
if (nm_streq (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO)) {
|
|
||||||
ret = dhcp4_start (self);
|
|
||||||
if (ret == NM_ACT_STAGE_RETURN_FAILURE) {
|
|
||||||
NM_SET_OUT (out_failure_reason, NM_DEVICE_STATE_REASON_DHCP_START_FAILED);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
g_return_val_if_fail (num_addresses != 0, NM_ACT_STAGE_RETURN_FAILURE);
|
|
||||||
ret = NM_ACT_STAGE_RETURN_POSTPONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (num_addresses) {
|
|
||||||
config = _ip4_config_new (self);
|
|
||||||
nm_ip4_config_merge_setting (config,
|
|
||||||
nm_connection_get_setting_ip4_config (connection),
|
|
||||||
NM_SETTING_CONNECTION_MDNS_DEFAULT,
|
|
||||||
NM_SETTING_CONNECTION_LLMNR_DEFAULT,
|
|
||||||
nm_device_get_route_table (self, AF_INET, TRUE),
|
|
||||||
nm_device_get_route_metric (self, AF_INET));
|
|
||||||
configs = g_new0 (NMIP4Config *, 2);
|
|
||||||
configs[0] = config;
|
|
||||||
ipv4_dad_start (self, configs, ipv4_manual_method_apply);
|
|
||||||
}
|
|
||||||
} else if (nm_streq (method, NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL)) {
|
|
||||||
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 (nm_streq (method, NM_SETTING_IP4_CONFIG_METHOD_SHARED)) {
|
|
||||||
if (out_config) {
|
|
||||||
*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 {
|
|
||||||
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 (nm_streq (method, NM_SETTING_IP4_CONFIG_METHOD_DISABLED))
|
|
||||||
ret = NM_ACT_STAGE_RETURN_SUCCESS;
|
|
||||||
else
|
|
||||||
_LOGW (LOGD_IP4, "unhandled IPv4 config method '%s'; will fail", method);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
/* DHCPv6 stuff */
|
/* DHCPv6 stuff */
|
||||||
|
|
||||||
|
|
@ -9682,11 +9576,14 @@ _ip6_privacy_get (NMDevice *self)
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
ip6_requires_slaves (NMDevice *self)
|
ip_requires_slaves (NMDevice *self, int addr_family)
|
||||||
{
|
{
|
||||||
const char *method;
|
const char *method;
|
||||||
|
|
||||||
method = nm_device_get_effective_ip_config_method (self, AF_INET6);
|
method = nm_device_get_effective_ip_config_method (self, addr_family);
|
||||||
|
|
||||||
|
if (addr_family == AF_INET)
|
||||||
|
return nm_streq (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO);
|
||||||
|
|
||||||
/* SLAAC, DHCP, and Link-Local depend on connectivity (and thus slaves)
|
/* SLAAC, DHCP, and Link-Local depend on connectivity (and thus slaves)
|
||||||
* to complete addressing. SLAAC and DHCP need a peer to provide a prefix.
|
* to complete addressing. SLAAC and DHCP need a peer to provide a prefix.
|
||||||
|
|
@ -9696,128 +9593,202 @@ ip6_requires_slaves (NMDevice *self)
|
||||||
}
|
}
|
||||||
|
|
||||||
static NMActStageReturn
|
static NMActStageReturn
|
||||||
act_stage3_ip6_config_start (NMDevice *self,
|
act_stage3_ip_config_start (NMDevice *self,
|
||||||
NMIP6Config **out_config,
|
int addr_family,
|
||||||
NMDeviceStateReason *out_failure_reason)
|
gpointer *out_config,
|
||||||
|
NMDeviceStateReason *out_failure_reason)
|
||||||
{
|
{
|
||||||
|
const gboolean IS_IPv4 = (addr_family == AF_INET);
|
||||||
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
|
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
|
||||||
NMActStageReturn ret = NM_ACT_STAGE_RETURN_FAILURE;
|
|
||||||
NMConnection *connection;
|
NMConnection *connection;
|
||||||
|
NMActStageReturn ret = NM_ACT_STAGE_RETURN_FAILURE;
|
||||||
const char *method;
|
const char *method;
|
||||||
NMSettingIP6ConfigPrivacy ip6_privacy = NM_SETTING_IP6_CONFIG_PRIVACY_UNKNOWN;
|
|
||||||
const char *ip6_privacy_str = "0";
|
nm_assert_addr_family (addr_family);
|
||||||
|
|
||||||
connection = nm_device_get_applied_connection (self);
|
connection = nm_device_get_applied_connection (self);
|
||||||
|
|
||||||
g_return_val_if_fail (connection, NM_ACT_STAGE_RETURN_FAILURE);
|
g_return_val_if_fail (connection, NM_ACT_STAGE_RETURN_FAILURE);
|
||||||
|
|
||||||
if ( connection_ip6_method_requires_carrier (connection, NULL)
|
if ( connection_ip_method_requires_carrier (connection, addr_family, NULL)
|
||||||
&& nm_device_is_master (self)
|
&& nm_device_is_master (self)
|
||||||
&& !priv->carrier) {
|
&& !priv->carrier) {
|
||||||
_LOGI (LOGD_IP6 | LOGD_DEVICE,
|
_LOGI (LOGD_IP | LOGD_DEVICE,
|
||||||
"IPv6 config waiting until carrier is on");
|
"IPv%c config waiting until carrier is on",
|
||||||
|
nm_utils_addr_family_to_char (addr_family));
|
||||||
return NM_ACT_STAGE_RETURN_IP_WAIT;
|
return NM_ACT_STAGE_RETURN_IP_WAIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nm_device_is_master (self) && ip6_requires_slaves (self)) {
|
if ( nm_device_is_master (self)
|
||||||
|
&& ip_requires_slaves (self, addr_family)) {
|
||||||
/* If the master has no ready slaves, and depends on slaves for
|
/* If the master has no ready slaves, and depends on slaves for
|
||||||
* a successful IPv6 attempt, then postpone IPv6 addressing.
|
* a successful IP configuration attempt, then postpone IP addressing.
|
||||||
*/
|
*/
|
||||||
if (!have_any_ready_slaves (self)) {
|
if (!have_any_ready_slaves (self)) {
|
||||||
_LOGI (LOGD_DEVICE | LOGD_IP6,
|
_LOGI (LOGD_DEVICE | LOGD_IP,
|
||||||
"IPv6 config waiting until slaves are ready");
|
"IPv%c config waiting until slaves are ready",
|
||||||
|
nm_utils_addr_family_to_char (addr_family));
|
||||||
return NM_ACT_STAGE_RETURN_IP_WAIT;
|
return NM_ACT_STAGE_RETURN_IP_WAIT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
priv->dhcp6.mode = NM_NDISC_DHCP_LEVEL_NONE;
|
if (!IS_IPv4)
|
||||||
method = nm_device_get_effective_ip_config_method (self, AF_INET6);
|
priv->dhcp6.mode = NM_NDISC_DHCP_LEVEL_NONE;
|
||||||
if (nm_streq (method, NM_SETTING_IP6_CONFIG_METHOD_IGNORE)) {
|
|
||||||
if ( !priv->master
|
|
||||||
&& !nm_device_sys_iface_state_is_external (self)) {
|
|
||||||
gboolean ipv6ll_handle_old = priv->ipv6ll_handle;
|
|
||||||
|
|
||||||
/* When activating an IPv6 'ignore' connection we need to revert back
|
method = nm_device_get_effective_ip_config_method (self, addr_family);
|
||||||
* to kernel IPv6LL, but the kernel won't actually assign an address
|
|
||||||
* to the interface until disable_ipv6 is bounced.
|
_LOGD (LOGD_IP | LOGD_DEVICE, "IPv%c config method is %s",
|
||||||
*/
|
nm_utils_addr_family_to_char (addr_family), method);
|
||||||
set_nm_ipv6ll (self, FALSE);
|
|
||||||
if (ipv6ll_handle_old)
|
if (IS_IPv4) {
|
||||||
nm_device_sysctl_ip_conf_set (self, AF_INET6, "disable_ipv6", "1");
|
if (NM_IN_STRSET (method,
|
||||||
restore_ip6_properties (self);
|
NM_SETTING_IP4_CONFIG_METHOD_AUTO,
|
||||||
|
NM_SETTING_IP4_CONFIG_METHOD_MANUAL)) {
|
||||||
|
NMSettingIPConfig *s_ip4;
|
||||||
|
NMIP4Config **configs, *config;
|
||||||
|
guint num_addresses;
|
||||||
|
|
||||||
|
s_ip4 = nm_connection_get_setting_ip4_config (connection);
|
||||||
|
g_return_val_if_fail (s_ip4, NM_ACT_STAGE_RETURN_FAILURE);
|
||||||
|
num_addresses = nm_setting_ip_config_get_num_addresses (s_ip4);
|
||||||
|
|
||||||
|
if (nm_streq (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO)) {
|
||||||
|
ret = dhcp4_start (self);
|
||||||
|
if (ret == NM_ACT_STAGE_RETURN_FAILURE) {
|
||||||
|
NM_SET_OUT (out_failure_reason, NM_DEVICE_STATE_REASON_DHCP_START_FAILED);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
g_return_val_if_fail (num_addresses != 0, NM_ACT_STAGE_RETURN_FAILURE);
|
||||||
|
ret = NM_ACT_STAGE_RETURN_POSTPONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (num_addresses) {
|
||||||
|
config = _ip4_config_new (self);
|
||||||
|
nm_ip4_config_merge_setting (config,
|
||||||
|
nm_connection_get_setting_ip4_config (connection),
|
||||||
|
NM_SETTING_CONNECTION_MDNS_DEFAULT,
|
||||||
|
NM_SETTING_CONNECTION_LLMNR_DEFAULT,
|
||||||
|
nm_device_get_route_table (self, AF_INET, TRUE),
|
||||||
|
nm_device_get_route_metric (self, AF_INET));
|
||||||
|
configs = g_new0 (NMIP4Config *, 2);
|
||||||
|
configs[0] = config;
|
||||||
|
ipv4_dad_start (self, configs, ipv4_manual_method_apply);
|
||||||
|
}
|
||||||
|
} else if (nm_streq (method, NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL)) {
|
||||||
|
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 (nm_streq (method, NM_SETTING_IP4_CONFIG_METHOD_SHARED)) {
|
||||||
|
if (out_config) {
|
||||||
|
*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 {
|
||||||
|
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 (nm_streq (method, NM_SETTING_IP4_CONFIG_METHOD_DISABLED))
|
||||||
|
ret = NM_ACT_STAGE_RETURN_SUCCESS;
|
||||||
|
else
|
||||||
|
_LOGW (LOGD_IP4, "unhandled IPv4 config method '%s'; will fail", method);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
} else {
|
||||||
|
NMSettingIP6ConfigPrivacy ip6_privacy = NM_SETTING_IP6_CONFIG_PRIVACY_UNKNOWN;
|
||||||
|
const char *ip6_privacy_str = "0";
|
||||||
|
|
||||||
|
if (nm_streq (method, NM_SETTING_IP6_CONFIG_METHOD_IGNORE)) {
|
||||||
|
if ( !priv->master
|
||||||
|
&& !nm_device_sys_iface_state_is_external (self)) {
|
||||||
|
gboolean ipv6ll_handle_old = priv->ipv6ll_handle;
|
||||||
|
|
||||||
|
/* When activating an IPv6 'ignore' connection we need to revert back
|
||||||
|
* to kernel IPv6LL, but the kernel won't actually assign an address
|
||||||
|
* to the interface until disable_ipv6 is bounced.
|
||||||
|
*/
|
||||||
|
set_nm_ipv6ll (self, FALSE);
|
||||||
|
if (ipv6ll_handle_old)
|
||||||
|
nm_device_sysctl_ip_conf_set (self, AF_INET6, "disable_ipv6", "1");
|
||||||
|
restore_ip6_properties (self);
|
||||||
|
}
|
||||||
|
return NM_ACT_STAGE_RETURN_IP_DONE;
|
||||||
}
|
}
|
||||||
return NM_ACT_STAGE_RETURN_IP_DONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Ensure the MTU makes sense. If it was below 1280 the kernel would not
|
/* Ensure the MTU makes sense. If it was below 1280 the kernel would not
|
||||||
* expose any ipv6 sysctls or allow presence of any addresses on the interface,
|
* expose any ipv6 sysctls or allow presence of any addresses on the interface,
|
||||||
* including LL, which * would make it impossible to autoconfigure MTU to a
|
* including LL, which * would make it impossible to autoconfigure MTU to a
|
||||||
* correct value. */
|
* correct value. */
|
||||||
_commit_mtu (self, priv->ip_config_4);
|
_commit_mtu (self, priv->ip_config_4);
|
||||||
|
|
||||||
/* Any method past this point requires an IPv6LL address. Use NM-controlled
|
/* Any method past this point requires an IPv6LL address. Use NM-controlled
|
||||||
* IPv6LL if this is not an assumed connection, since assumed connections
|
* IPv6LL if this is not an assumed connection, since assumed connections
|
||||||
* will already have IPv6 set up.
|
* will already have IPv6 set up.
|
||||||
*/
|
*/
|
||||||
if (!nm_device_sys_iface_state_is_external_or_assume (self))
|
if (!nm_device_sys_iface_state_is_external_or_assume (self))
|
||||||
set_nm_ipv6ll (self, TRUE);
|
set_nm_ipv6ll (self, TRUE);
|
||||||
|
|
||||||
/* Re-enable IPv6 on the interface */
|
/* Re-enable IPv6 on the interface */
|
||||||
set_disable_ipv6 (self, "0");
|
set_disable_ipv6 (self, "0");
|
||||||
|
|
||||||
/* Synchronize external IPv6 configuration with kernel, since
|
/* Synchronize external IPv6 configuration with kernel, since
|
||||||
* linklocal6_start() uses the information there to determine if we can
|
* linklocal6_start() uses the information there to determine if we can
|
||||||
* proceed with the selected method (SLAAC, DHCP, link-local).
|
* proceed with the selected method (SLAAC, DHCP, link-local).
|
||||||
*/
|
*/
|
||||||
nm_platform_process_events (nm_device_get_platform (self));
|
nm_platform_process_events (nm_device_get_platform (self));
|
||||||
g_clear_object (&priv->ext_ip6_config_captured);
|
g_clear_object (&priv->ext_ip6_config_captured);
|
||||||
priv->ext_ip6_config_captured = nm_ip6_config_capture (nm_device_get_multi_index (self),
|
priv->ext_ip6_config_captured = nm_ip6_config_capture (nm_device_get_multi_index (self),
|
||||||
nm_device_get_platform (self),
|
nm_device_get_platform (self),
|
||||||
nm_device_get_ip_ifindex (self),
|
nm_device_get_ip_ifindex (self),
|
||||||
NM_SETTING_IP6_CONFIG_PRIVACY_UNKNOWN);
|
NM_SETTING_IP6_CONFIG_PRIVACY_UNKNOWN);
|
||||||
|
|
||||||
ip6_privacy = _ip6_privacy_get (self);
|
ip6_privacy = _ip6_privacy_get (self);
|
||||||
|
|
||||||
if (NM_IN_STRSET (method, NM_SETTING_IP6_CONFIG_METHOD_AUTO,
|
if (NM_IN_STRSET (method, NM_SETTING_IP6_CONFIG_METHOD_AUTO,
|
||||||
NM_SETTING_IP6_CONFIG_METHOD_SHARED)) {
|
NM_SETTING_IP6_CONFIG_METHOD_SHARED)) {
|
||||||
if (!addrconf6_start (self, ip6_privacy)) {
|
if (!addrconf6_start (self, ip6_privacy)) {
|
||||||
/* IPv6 might be disabled; allow IPv4 to proceed */
|
/* IPv6 might be disabled; allow IPv4 to proceed */
|
||||||
ret = NM_ACT_STAGE_RETURN_IP_FAIL;
|
ret = NM_ACT_STAGE_RETURN_IP_FAIL;
|
||||||
} else
|
} else
|
||||||
ret = NM_ACT_STAGE_RETURN_POSTPONE;
|
ret = NM_ACT_STAGE_RETURN_POSTPONE;
|
||||||
} else if (nm_streq (method, NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL)) {
|
} else if (nm_streq (method, NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL)) {
|
||||||
ret = linklocal6_start (self)
|
ret = linklocal6_start (self)
|
||||||
? NM_ACT_STAGE_RETURN_SUCCESS
|
? NM_ACT_STAGE_RETURN_SUCCESS
|
||||||
: NM_ACT_STAGE_RETURN_POSTPONE;
|
: NM_ACT_STAGE_RETURN_POSTPONE;
|
||||||
} else if (nm_streq (method, NM_SETTING_IP6_CONFIG_METHOD_DHCP)) {
|
} else if (nm_streq (method, NM_SETTING_IP6_CONFIG_METHOD_DHCP)) {
|
||||||
priv->dhcp6.mode = NM_NDISC_DHCP_LEVEL_MANAGED;
|
priv->dhcp6.mode = NM_NDISC_DHCP_LEVEL_MANAGED;
|
||||||
if (!dhcp6_start (self, TRUE)) {
|
if (!dhcp6_start (self, TRUE)) {
|
||||||
/* IPv6 might be disabled; allow IPv4 to proceed */
|
/* IPv6 might be disabled; allow IPv4 to proceed */
|
||||||
ret = NM_ACT_STAGE_RETURN_IP_FAIL;
|
ret = NM_ACT_STAGE_RETURN_IP_FAIL;
|
||||||
} else
|
} else
|
||||||
ret = NM_ACT_STAGE_RETURN_POSTPONE;
|
ret = NM_ACT_STAGE_RETURN_POSTPONE;
|
||||||
} else if (nm_streq (method, NM_SETTING_IP6_CONFIG_METHOD_MANUAL))
|
} else if (nm_streq (method, NM_SETTING_IP6_CONFIG_METHOD_MANUAL))
|
||||||
ret = NM_ACT_STAGE_RETURN_SUCCESS;
|
ret = NM_ACT_STAGE_RETURN_SUCCESS;
|
||||||
else
|
else
|
||||||
_LOGW (LOGD_IP6, "unhandled IPv6 config method '%s'; will fail", method);
|
_LOGW (LOGD_IP6, "unhandled IPv6 config method '%s'; will fail", method);
|
||||||
|
|
||||||
if ( ret != NM_ACT_STAGE_RETURN_FAILURE
|
if ( ret != NM_ACT_STAGE_RETURN_FAILURE
|
||||||
&& !nm_device_sys_iface_state_is_external_or_assume (self)) {
|
&& !nm_device_sys_iface_state_is_external_or_assume (self)) {
|
||||||
switch (ip6_privacy) {
|
switch (ip6_privacy) {
|
||||||
case NM_SETTING_IP6_CONFIG_PRIVACY_UNKNOWN:
|
case NM_SETTING_IP6_CONFIG_PRIVACY_UNKNOWN:
|
||||||
case NM_SETTING_IP6_CONFIG_PRIVACY_DISABLED:
|
case NM_SETTING_IP6_CONFIG_PRIVACY_DISABLED:
|
||||||
ip6_privacy_str = "0";
|
ip6_privacy_str = "0";
|
||||||
break;
|
break;
|
||||||
case NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_PUBLIC_ADDR:
|
case NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_PUBLIC_ADDR:
|
||||||
ip6_privacy_str = "1";
|
ip6_privacy_str = "1";
|
||||||
break;
|
break;
|
||||||
case NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_TEMP_ADDR:
|
case NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_TEMP_ADDR:
|
||||||
ip6_privacy_str = "2";
|
ip6_privacy_str = "2";
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
nm_device_sysctl_ip_conf_set (self, AF_INET6, "use_tempaddr", ip6_privacy_str);
|
||||||
}
|
}
|
||||||
nm_device_sysctl_ip_conf_set (self, AF_INET6, "use_tempaddr", ip6_privacy_str);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -9843,7 +9814,7 @@ nm_device_activate_stage3_ip4_start (NMDevice *self)
|
||||||
}
|
}
|
||||||
|
|
||||||
_set_ip_state (self, AF_INET, NM_DEVICE_IP_STATE_CONF);
|
_set_ip_state (self, AF_INET, NM_DEVICE_IP_STATE_CONF);
|
||||||
ret = NM_DEVICE_GET_CLASS (self)->act_stage3_ip4_config_start (self, &ip4_config, &failure_reason);
|
ret = NM_DEVICE_GET_CLASS (self)->act_stage3_ip_config_start (self, AF_INET, (gpointer *) &ip4_config, &failure_reason);
|
||||||
if (ret == NM_ACT_STAGE_RETURN_SUCCESS)
|
if (ret == NM_ACT_STAGE_RETURN_SUCCESS)
|
||||||
nm_device_activate_schedule_ip_config_result (self, AF_INET, NM_IP_CONFIG_CAST (ip4_config));
|
nm_device_activate_schedule_ip_config_result (self, AF_INET, NM_IP_CONFIG_CAST (ip4_config));
|
||||||
else if (ret == NM_ACT_STAGE_RETURN_IP_DONE) {
|
else if (ret == NM_ACT_STAGE_RETURN_IP_DONE) {
|
||||||
|
|
@ -9887,7 +9858,7 @@ nm_device_activate_stage3_ip6_start (NMDevice *self)
|
||||||
}
|
}
|
||||||
|
|
||||||
_set_ip_state (self, AF_INET6, NM_DEVICE_IP_STATE_CONF);
|
_set_ip_state (self, AF_INET6, NM_DEVICE_IP_STATE_CONF);
|
||||||
ret = NM_DEVICE_GET_CLASS (self)->act_stage3_ip6_config_start (self, &ip6_config, &failure_reason);
|
ret = NM_DEVICE_GET_CLASS (self)->act_stage3_ip_config_start (self, AF_INET6, (gpointer *) &ip6_config, &failure_reason);
|
||||||
if (ret == NM_ACT_STAGE_RETURN_SUCCESS) {
|
if (ret == NM_ACT_STAGE_RETURN_SUCCESS) {
|
||||||
if (!ip6_config)
|
if (!ip6_config)
|
||||||
ip6_config = _ip6_config_new (self);
|
ip6_config = _ip6_config_new (self);
|
||||||
|
|
@ -10059,15 +10030,21 @@ nm_device_activate_schedule_stage3_ip_config_start (NMDevice *self)
|
||||||
}
|
}
|
||||||
|
|
||||||
static NMActStageReturn
|
static NMActStageReturn
|
||||||
act_stage4_ip4_config_timeout (NMDevice *self, NMDeviceStateReason *out_failure_reason)
|
act_stage4_ip_config_timeout (NMDevice *self,
|
||||||
|
int addr_family,
|
||||||
|
NMDeviceStateReason *out_failure_reason)
|
||||||
{
|
{
|
||||||
if (!get_ip_config_may_fail (self, AF_INET)) {
|
nm_assert_addr_family (addr_family);
|
||||||
|
|
||||||
|
if (!get_ip_config_may_fail (self, addr_family)) {
|
||||||
NM_SET_OUT (out_failure_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_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NM_ACT_STAGE_RETURN_SUCCESS;
|
return NM_ACT_STAGE_RETURN_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* nm_device_activate_stage4_ip4_config_timeout
|
* nm_device_activate_stage4_ip4_config_timeout
|
||||||
*
|
*
|
||||||
|
|
@ -10080,7 +10057,7 @@ activate_stage4_ip_config_timeout_4 (NMDevice *self)
|
||||||
NMActStageReturn ret = NM_ACT_STAGE_RETURN_FAILURE;
|
NMActStageReturn ret = NM_ACT_STAGE_RETURN_FAILURE;
|
||||||
NMDeviceStateReason failure_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, &failure_reason);
|
ret = NM_DEVICE_GET_CLASS (self)->act_stage4_ip_config_timeout (self, AF_INET6, &failure_reason);
|
||||||
if (ret == NM_ACT_STAGE_RETURN_POSTPONE)
|
if (ret == NM_ACT_STAGE_RETURN_POSTPONE)
|
||||||
return;
|
return;
|
||||||
else if (ret == NM_ACT_STAGE_RETURN_FAILURE) {
|
else if (ret == NM_ACT_STAGE_RETURN_FAILURE) {
|
||||||
|
|
@ -10111,24 +10088,13 @@ nm_device_activate_schedule_ip_config_timeout (NMDevice *self,
|
||||||
activation_source_schedule (self, activate_stage4_ip_config_timeout_x[IS_IPv4], addr_family);
|
activation_source_schedule (self, activate_stage4_ip_config_timeout_x[IS_IPv4], addr_family);
|
||||||
}
|
}
|
||||||
|
|
||||||
static NMActStageReturn
|
|
||||||
act_stage4_ip6_config_timeout (NMDevice *self, NMDeviceStateReason *out_failure_reason)
|
|
||||||
{
|
|
||||||
if (!get_ip_config_may_fail (self, AF_INET6)) {
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
activate_stage4_ip_config_timeout_6 (NMDevice *self)
|
activate_stage4_ip_config_timeout_6 (NMDevice *self)
|
||||||
{
|
{
|
||||||
NMActStageReturn ret = NM_ACT_STAGE_RETURN_FAILURE;
|
NMActStageReturn ret = NM_ACT_STAGE_RETURN_FAILURE;
|
||||||
NMDeviceStateReason failure_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, &failure_reason);
|
ret = NM_DEVICE_GET_CLASS (self)->act_stage4_ip_config_timeout (self, AF_INET6, &failure_reason);
|
||||||
if (ret == NM_ACT_STAGE_RETURN_POSTPONE)
|
if (ret == NM_ACT_STAGE_RETURN_POSTPONE)
|
||||||
return;
|
return;
|
||||||
if (ret == NM_ACT_STAGE_RETURN_FAILURE) {
|
if (ret == NM_ACT_STAGE_RETURN_FAILURE) {
|
||||||
|
|
@ -16710,10 +16676,8 @@ nm_device_class_init (NMDeviceClass *klass)
|
||||||
klass->is_available = is_available;
|
klass->is_available = is_available;
|
||||||
klass->act_stage1_prepare = act_stage1_prepare;
|
klass->act_stage1_prepare = act_stage1_prepare;
|
||||||
klass->act_stage2_config = act_stage2_config;
|
klass->act_stage2_config = act_stage2_config;
|
||||||
klass->act_stage3_ip4_config_start = act_stage3_ip4_config_start;
|
klass->act_stage3_ip_config_start = act_stage3_ip_config_start;
|
||||||
klass->act_stage3_ip6_config_start = act_stage3_ip6_config_start;
|
klass->act_stage4_ip_config_timeout = act_stage4_ip_config_timeout;
|
||||||
klass->act_stage4_ip4_config_timeout = act_stage4_ip4_config_timeout;
|
|
||||||
klass->act_stage4_ip6_config_timeout = act_stage4_ip6_config_timeout;
|
|
||||||
|
|
||||||
klass->get_type_description = get_type_description;
|
klass->get_type_description = get_type_description;
|
||||||
klass->can_auto_connect = can_auto_connect;
|
klass->can_auto_connect = can_auto_connect;
|
||||||
|
|
|
||||||
|
|
@ -369,16 +369,13 @@ typedef struct _NMDeviceClass {
|
||||||
NMDeviceStateReason *out_failure_reason);
|
NMDeviceStateReason *out_failure_reason);
|
||||||
NMActStageReturn (* act_stage2_config) (NMDevice *self,
|
NMActStageReturn (* act_stage2_config) (NMDevice *self,
|
||||||
NMDeviceStateReason *out_failure_reason);
|
NMDeviceStateReason *out_failure_reason);
|
||||||
NMActStageReturn (* act_stage3_ip4_config_start) (NMDevice *self,
|
NMActStageReturn (* act_stage3_ip_config_start) (NMDevice *self,
|
||||||
NMIP4Config **out_config,
|
int addr_family,
|
||||||
NMDeviceStateReason *out_failure_reason);
|
gpointer *out_config,
|
||||||
NMActStageReturn (* act_stage3_ip6_config_start) (NMDevice *self,
|
NMDeviceStateReason *out_failure_reason);
|
||||||
NMIP6Config **out_config,
|
NMActStageReturn (* act_stage4_ip_config_timeout) (NMDevice *self,
|
||||||
NMDeviceStateReason *out_failure_reason);
|
int addr_family,
|
||||||
NMActStageReturn (* act_stage4_ip4_config_timeout) (NMDevice *self,
|
NMDeviceStateReason *out_failure_reason);
|
||||||
NMDeviceStateReason *out_failure_reason);
|
|
||||||
NMActStageReturn (* act_stage4_ip6_config_timeout) (NMDevice *self,
|
|
||||||
NMDeviceStateReason *out_failure_reason);
|
|
||||||
|
|
||||||
void (* ip4_config_pre_commit) (NMDevice *self, NMIP4Config *config);
|
void (* ip4_config_pre_commit) (NMDevice *self, NMIP4Config *config);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -77,17 +77,10 @@ get_generic_capabilities (NMDevice *device)
|
||||||
}
|
}
|
||||||
|
|
||||||
static NMActStageReturn
|
static NMActStageReturn
|
||||||
act_stage3_ip4_config_start (NMDevice *device,
|
act_stage3_ip_config_start (NMDevice *device,
|
||||||
NMIP4Config **out_config,
|
int addr_family,
|
||||||
NMDeviceStateReason *out_failure_reason)
|
gpointer *out_config,
|
||||||
{
|
NMDeviceStateReason *out_failure_reason)
|
||||||
return NM_ACT_STAGE_RETURN_IP_FAIL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static NMActStageReturn
|
|
||||||
act_stage3_ip6_config_start (NMDevice *device,
|
|
||||||
NMIP6Config **out_config,
|
|
||||||
NMDeviceStateReason *out_failure_reason)
|
|
||||||
{
|
{
|
||||||
return NM_ACT_STAGE_RETURN_IP_FAIL;
|
return NM_ACT_STAGE_RETURN_IP_FAIL;
|
||||||
}
|
}
|
||||||
|
|
@ -146,8 +139,7 @@ nm_device_ovs_bridge_class_init (NMDeviceOvsBridgeClass *klass)
|
||||||
device_class->create_and_realize = create_and_realize;
|
device_class->create_and_realize = create_and_realize;
|
||||||
device_class->unrealize = unrealize;
|
device_class->unrealize = unrealize;
|
||||||
device_class->get_generic_capabilities = get_generic_capabilities;
|
device_class->get_generic_capabilities = get_generic_capabilities;
|
||||||
device_class->act_stage3_ip4_config_start = act_stage3_ip4_config_start;
|
device_class->act_stage3_ip_config_start = act_stage3_ip_config_start;
|
||||||
device_class->act_stage3_ip6_config_start = act_stage3_ip6_config_start;
|
|
||||||
device_class->enslave_slave = enslave_slave;
|
device_class->enslave_slave = enslave_slave;
|
||||||
device_class->release_slave = release_slave;
|
device_class->release_slave = release_slave;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -131,39 +131,22 @@ _is_internal_interface (NMDevice *device)
|
||||||
}
|
}
|
||||||
|
|
||||||
static NMActStageReturn
|
static NMActStageReturn
|
||||||
act_stage3_ip4_config_start (NMDevice *device,
|
act_stage3_ip_config_start (NMDevice *device,
|
||||||
NMIP4Config **out_config,
|
int addr_family,
|
||||||
NMDeviceStateReason *out_failure_reason)
|
gpointer *out_config,
|
||||||
|
NMDeviceStateReason *out_failure_reason)
|
||||||
{
|
{
|
||||||
NMDeviceOvsInterfacePrivate *priv = NM_DEVICE_OVS_INTERFACE_GET_PRIVATE (device);
|
NMDeviceOvsInterfacePrivate *priv = NM_DEVICE_OVS_INTERFACE_GET_PRIVATE (device);
|
||||||
|
|
||||||
if (!_is_internal_interface (device))
|
if (!_is_internal_interface (device))
|
||||||
return NM_ACT_STAGE_RETURN_IP_FAIL;
|
return NM_ACT_STAGE_RETURN_IP_FAIL;
|
||||||
|
|
||||||
if (!nm_device_get_ip_ifindex (device)) {
|
if (nm_device_get_ip_ifindex (device) <= 0) {
|
||||||
priv->waiting_for_interface = TRUE;
|
priv->waiting_for_interface = TRUE;
|
||||||
return NM_ACT_STAGE_RETURN_POSTPONE;
|
return NM_ACT_STAGE_RETURN_POSTPONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NM_DEVICE_CLASS (nm_device_ovs_interface_parent_class)->act_stage3_ip4_config_start (device, out_config, out_failure_reason);
|
return NM_DEVICE_CLASS (nm_device_ovs_interface_parent_class)->act_stage3_ip_config_start (device, addr_family, out_config, out_failure_reason);
|
||||||
}
|
|
||||||
|
|
||||||
static NMActStageReturn
|
|
||||||
act_stage3_ip6_config_start (NMDevice *device,
|
|
||||||
NMIP6Config **out_config,
|
|
||||||
NMDeviceStateReason *out_failure_reason)
|
|
||||||
{
|
|
||||||
NMDeviceOvsInterfacePrivate *priv = NM_DEVICE_OVS_INTERFACE_GET_PRIVATE (device);
|
|
||||||
|
|
||||||
if (!_is_internal_interface (device))
|
|
||||||
return NM_ACT_STAGE_RETURN_IP_FAIL;
|
|
||||||
|
|
||||||
if (!nm_device_get_ip_ifindex (device)) {
|
|
||||||
priv->waiting_for_interface = TRUE;
|
|
||||||
return NM_ACT_STAGE_RETURN_POSTPONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NM_DEVICE_CLASS (nm_device_ovs_interface_parent_class)->act_stage3_ip6_config_start (device, out_config, out_failure_reason);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
|
@ -207,7 +190,6 @@ nm_device_ovs_interface_class_init (NMDeviceOvsInterfaceClass *klass)
|
||||||
device_class->is_available = is_available;
|
device_class->is_available = is_available;
|
||||||
device_class->check_connection_compatible = check_connection_compatible;
|
device_class->check_connection_compatible = check_connection_compatible;
|
||||||
device_class->link_changed = link_changed;
|
device_class->link_changed = link_changed;
|
||||||
device_class->act_stage3_ip4_config_start = act_stage3_ip4_config_start;
|
device_class->act_stage3_ip_config_start = act_stage3_ip_config_start;
|
||||||
device_class->act_stage3_ip6_config_start = act_stage3_ip6_config_start;
|
|
||||||
device_class->can_unmanaged_external_down = can_unmanaged_external_down;
|
device_class->can_unmanaged_external_down = can_unmanaged_external_down;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -71,17 +71,10 @@ get_generic_capabilities (NMDevice *device)
|
||||||
}
|
}
|
||||||
|
|
||||||
static NMActStageReturn
|
static NMActStageReturn
|
||||||
act_stage3_ip4_config_start (NMDevice *device,
|
act_stage3_ip_config_start (NMDevice *device,
|
||||||
NMIP4Config **out_config,
|
int addr_family,
|
||||||
NMDeviceStateReason *out_failure_reason)
|
gpointer *out_config,
|
||||||
{
|
NMDeviceStateReason *out_failure_reason)
|
||||||
return NM_ACT_STAGE_RETURN_IP_FAIL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static NMActStageReturn
|
|
||||||
act_stage3_ip6_config_start (NMDevice *device,
|
|
||||||
NMIP6Config **out_config,
|
|
||||||
NMDeviceStateReason *out_failure_reason)
|
|
||||||
{
|
{
|
||||||
return NM_ACT_STAGE_RETURN_IP_FAIL;
|
return NM_ACT_STAGE_RETURN_IP_FAIL;
|
||||||
}
|
}
|
||||||
|
|
@ -186,8 +179,7 @@ nm_device_ovs_port_class_init (NMDeviceOvsPortClass *klass)
|
||||||
device_class->get_type_description = get_type_description;
|
device_class->get_type_description = get_type_description;
|
||||||
device_class->create_and_realize = create_and_realize;
|
device_class->create_and_realize = create_and_realize;
|
||||||
device_class->get_generic_capabilities = get_generic_capabilities;
|
device_class->get_generic_capabilities = get_generic_capabilities;
|
||||||
device_class->act_stage3_ip4_config_start = act_stage3_ip4_config_start;
|
device_class->act_stage3_ip_config_start = act_stage3_ip_config_start;
|
||||||
device_class->act_stage3_ip6_config_start = act_stage3_ip6_config_start;
|
|
||||||
device_class->enslave_slave = enslave_slave;
|
device_class->enslave_slave = enslave_slave;
|
||||||
device_class->release_slave = release_slave;
|
device_class->release_slave = release_slave;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -583,50 +583,30 @@ remove_all_peers (NMDeviceWifiP2P *self)
|
||||||
|
|
||||||
|
|
||||||
static NMActStageReturn
|
static NMActStageReturn
|
||||||
act_stage3_ip4_config_start (NMDevice *device,
|
act_stage3_ip_config_start (NMDevice *device,
|
||||||
NMIP4Config **out_config,
|
int addr_family,
|
||||||
NMDeviceStateReason *out_failure_reason)
|
gpointer *out_config,
|
||||||
|
NMDeviceStateReason *out_failure_reason)
|
||||||
{
|
{
|
||||||
|
gboolean indicate_addressing_running;
|
||||||
NMConnection *connection;
|
NMConnection *connection;
|
||||||
NMSettingIPConfig *s_ip4;
|
const char *method;
|
||||||
const char *method = NM_SETTING_IP4_CONFIG_METHOD_AUTO;
|
|
||||||
|
|
||||||
connection = nm_device_get_applied_connection (device);
|
connection = nm_device_get_applied_connection (device);
|
||||||
g_return_val_if_fail (connection, NM_ACT_STAGE_RETURN_FAILURE);
|
|
||||||
|
|
||||||
s_ip4 = nm_connection_get_setting_ip4_config (connection);
|
method = nm_utils_get_ip_config_method (connection, addr_family);
|
||||||
if (s_ip4)
|
|
||||||
method = nm_setting_ip_config_get_method (s_ip4);
|
|
||||||
|
|
||||||
/* Indicate that a critical protocol is about to start */
|
if (addr_family == AF_INET)
|
||||||
if (nm_streq (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO))
|
indicate_addressing_running = NM_IN_STRSET (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO);
|
||||||
|
else {
|
||||||
|
indicate_addressing_running = NM_IN_STRSET (method, NM_SETTING_IP6_CONFIG_METHOD_AUTO,
|
||||||
|
NM_SETTING_IP6_CONFIG_METHOD_DHCP);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (indicate_addressing_running)
|
||||||
nm_platform_wifi_indicate_addressing_running (nm_device_get_platform (device), nm_device_get_ip_ifindex (device), TRUE);
|
nm_platform_wifi_indicate_addressing_running (nm_device_get_platform (device), nm_device_get_ip_ifindex (device), TRUE);
|
||||||
|
|
||||||
return NM_DEVICE_CLASS (nm_device_wifi_p2p_parent_class)->act_stage3_ip4_config_start (device, out_config, out_failure_reason);
|
return NM_DEVICE_CLASS (nm_device_wifi_p2p_parent_class)->act_stage3_ip_config_start (device, addr_family, out_config, out_failure_reason);
|
||||||
}
|
|
||||||
|
|
||||||
static NMActStageReturn
|
|
||||||
act_stage3_ip6_config_start (NMDevice *device,
|
|
||||||
NMIP6Config **out_config,
|
|
||||||
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_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);
|
|
||||||
|
|
||||||
/* Indicate that a critical protocol is about to start */
|
|
||||||
if (NM_IN_STRSET (method, NM_SETTING_IP6_CONFIG_METHOD_AUTO
|
|
||||||
NM_SETTING_IP6_CONFIG_METHOD_DHCP))
|
|
||||||
nm_platform_wifi_indicate_addressing_running (nm_device_get_platform (device), nm_device_get_ip_ifindex (device), TRUE);
|
|
||||||
|
|
||||||
return NM_DEVICE_CLASS (nm_device_wifi_p2p_parent_class)->act_stage3_ip6_config_start (device, out_config, out_failure_reason);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -1315,8 +1295,7 @@ nm_device_wifi_p2p_class_init (NMDeviceWifiP2PClass *klass)
|
||||||
device_class->act_stage2_config = act_stage2_config;
|
device_class->act_stage2_config = act_stage2_config;
|
||||||
device_class->get_configured_mtu = get_configured_mtu;
|
device_class->get_configured_mtu = get_configured_mtu;
|
||||||
device_class->get_auto_ip_config_method = get_auto_ip_config_method;
|
device_class->get_auto_ip_config_method = get_auto_ip_config_method;
|
||||||
device_class->act_stage3_ip4_config_start = act_stage3_ip4_config_start;
|
device_class->act_stage3_ip_config_start = act_stage3_ip_config_start;
|
||||||
device_class->act_stage3_ip6_config_start = act_stage3_ip6_config_start;
|
|
||||||
|
|
||||||
device_class->deactivate = deactivate;
|
device_class->deactivate = deactivate;
|
||||||
device_class->unmanaged_on_quit = unmanaged_on_quit;
|
device_class->unmanaged_on_quit = unmanaged_on_quit;
|
||||||
|
|
|
||||||
|
|
@ -2874,52 +2874,29 @@ out:
|
||||||
}
|
}
|
||||||
|
|
||||||
static NMActStageReturn
|
static NMActStageReturn
|
||||||
act_stage3_ip4_config_start (NMDevice *device,
|
act_stage3_ip_config_start (NMDevice *device,
|
||||||
NMIP4Config **out_config,
|
int addr_family,
|
||||||
NMDeviceStateReason *out_failure_reason)
|
gpointer *out_config,
|
||||||
|
NMDeviceStateReason *out_failure_reason)
|
||||||
{
|
{
|
||||||
|
gboolean indicate_addressing_running;
|
||||||
NMConnection *connection;
|
NMConnection *connection;
|
||||||
NMSettingIPConfig *s_ip4;
|
const char *method;
|
||||||
const char *method = NM_SETTING_IP4_CONFIG_METHOD_AUTO;
|
|
||||||
|
|
||||||
connection = nm_device_get_applied_connection (device);
|
connection = nm_device_get_applied_connection (device);
|
||||||
|
|
||||||
g_return_val_if_fail (connection, NM_ACT_STAGE_RETURN_FAILURE);
|
method = nm_utils_get_ip_config_method (connection, addr_family);
|
||||||
|
if (addr_family == AF_INET)
|
||||||
|
indicate_addressing_running = NM_IN_STRSET (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO);
|
||||||
|
else {
|
||||||
|
indicate_addressing_running = NM_IN_STRSET (method, NM_SETTING_IP6_CONFIG_METHOD_AUTO,
|
||||||
|
NM_SETTING_IP6_CONFIG_METHOD_DHCP);
|
||||||
|
}
|
||||||
|
|
||||||
s_ip4 = nm_connection_get_setting_ip4_config (connection);
|
if (indicate_addressing_running)
|
||||||
if (s_ip4)
|
nm_platform_wifi_indicate_addressing_running (nm_device_get_platform (device), nm_device_get_ip_ifindex (device), TRUE);
|
||||||
method = nm_setting_ip_config_get_method (s_ip4);
|
|
||||||
|
|
||||||
/* Indicate that a critical protocol is about to start */
|
return NM_DEVICE_CLASS (nm_device_wifi_parent_class)->act_stage3_ip_config_start (device, addr_family, out_config, out_failure_reason);
|
||||||
if (strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0)
|
|
||||||
nm_platform_wifi_indicate_addressing_running (nm_device_get_platform (device), nm_device_get_ifindex (device), TRUE);
|
|
||||||
|
|
||||||
return NM_DEVICE_CLASS (nm_device_wifi_parent_class)->act_stage3_ip4_config_start (device, out_config, out_failure_reason);
|
|
||||||
}
|
|
||||||
|
|
||||||
static NMActStageReturn
|
|
||||||
act_stage3_ip6_config_start (NMDevice *device,
|
|
||||||
NMIP6Config **out_config,
|
|
||||||
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_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);
|
|
||||||
|
|
||||||
/* Indicate that a critical protocol is about to start */
|
|
||||||
if (strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_AUTO) == 0 ||
|
|
||||||
strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_DHCP) == 0)
|
|
||||||
nm_platform_wifi_indicate_addressing_running (nm_device_get_platform (device), nm_device_get_ifindex (device), TRUE);
|
|
||||||
|
|
||||||
return NM_DEVICE_CLASS (nm_device_wifi_parent_class)->act_stage3_ip6_config_start (device, out_config, out_failure_reason);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static guint32
|
static guint32
|
||||||
|
|
@ -2954,19 +2931,27 @@ is_static_wep (NMConnection *connection)
|
||||||
}
|
}
|
||||||
|
|
||||||
static NMActStageReturn
|
static NMActStageReturn
|
||||||
handle_ip_config_timeout (NMDeviceWifi *self,
|
act_stage4_ip_config_timeout (NMDevice *device,
|
||||||
NMConnection *connection,
|
int addr_family,
|
||||||
gboolean may_fail,
|
NMDeviceStateReason *out_failure_reason)
|
||||||
gboolean *chain_up,
|
|
||||||
NMDeviceStateReason *out_failure_reason)
|
|
||||||
{
|
{
|
||||||
NMActStageReturn ret = NM_ACT_STAGE_RETURN_FAILURE;
|
NMDeviceWifi *self = NM_DEVICE_WIFI (device);
|
||||||
|
NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self);
|
||||||
|
NMConnection *connection;
|
||||||
|
NMSettingIPConfig *s_ip;
|
||||||
|
gboolean may_fail;
|
||||||
|
|
||||||
g_return_val_if_fail (connection != NULL, NM_ACT_STAGE_RETURN_FAILURE);
|
connection = nm_device_get_applied_connection (device);
|
||||||
|
s_ip = nm_connection_get_setting_ip4_config (connection);
|
||||||
|
may_fail = nm_setting_ip_config_get_may_fail (s_ip);
|
||||||
|
|
||||||
if (NM_DEVICE_WIFI_GET_PRIVATE (self)->mode == NM_802_11_MODE_AP) {
|
if (priv->mode == NM_802_11_MODE_AP)
|
||||||
*chain_up = TRUE;
|
goto call_parent;
|
||||||
return NM_ACT_STAGE_RETURN_FAILURE;
|
|
||||||
|
if ( may_fail
|
||||||
|
&& !is_static_wep (connection)) {
|
||||||
|
/* Not static WEP or failure allowed; let superclass handle it */
|
||||||
|
goto call_parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If IP configuration times out and it's a static WEP connection, that
|
/* If IP configuration times out and it's a static WEP connection, that
|
||||||
|
|
@ -2975,71 +2960,23 @@ handle_ip_config_timeout (NMDeviceWifi *self,
|
||||||
* to wait for DHCP to fail to figure it out. For all other Wi-Fi security
|
* to wait for DHCP to fail to figure it out. For all other Wi-Fi security
|
||||||
* types (open, WPA, 802.1x, etc) if the secrets/certs were wrong the
|
* types (open, WPA, 802.1x, etc) if the secrets/certs were wrong the
|
||||||
* connection would have failed before IP configuration.
|
* connection would have failed before IP configuration.
|
||||||
*/
|
*
|
||||||
if (!may_fail && is_static_wep (connection)) {
|
* Activation failed, we must have bad encryption key */
|
||||||
/* Activation failed, we must have bad encryption key */
|
_LOGW (LOGD_DEVICE | LOGD_WIFI,
|
||||||
_LOGW (LOGD_DEVICE | LOGD_WIFI,
|
"Activation: (wifi) could not get IP configuration for connection '%s'.",
|
||||||
"Activation: (wifi) could not get IP configuration for connection '%s'.",
|
nm_connection_get_id (connection));
|
||||||
nm_connection_get_id (connection));
|
|
||||||
|
|
||||||
if (handle_auth_or_fail (self, NULL, TRUE)) {
|
if (!handle_auth_or_fail (self, NULL, TRUE)) {
|
||||||
_LOGI (LOGD_DEVICE | LOGD_WIFI,
|
NM_SET_OUT (out_failure_reason, NM_DEVICE_STATE_REASON_NO_SECRETS);
|
||||||
"Activation: (wifi) asking for new secrets");
|
return NM_ACT_STAGE_RETURN_FAILURE;
|
||||||
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;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/* Not static WEP or failure allowed; let superclass handle it */
|
|
||||||
*chain_up = TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
_LOGI (LOGD_DEVICE | LOGD_WIFI,
|
||||||
}
|
"Activation: (wifi) asking for new secrets");
|
||||||
|
return NM_ACT_STAGE_RETURN_POSTPONE;
|
||||||
|
|
||||||
static NMActStageReturn
|
call_parent:
|
||||||
act_stage4_ip4_config_timeout (NMDevice *device, NMDeviceStateReason *out_failure_reason)
|
return NM_DEVICE_CLASS (nm_device_wifi_parent_class)->act_stage4_ip_config_timeout (device, addr_family, out_failure_reason);
|
||||||
{
|
|
||||||
NMConnection *connection;
|
|
||||||
NMSettingIPConfig *s_ip4;
|
|
||||||
gboolean may_fail = FALSE, chain_up = FALSE;
|
|
||||||
NMActStageReturn ret;
|
|
||||||
|
|
||||||
connection = nm_device_get_applied_connection (device);
|
|
||||||
|
|
||||||
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, out_failure_reason);
|
|
||||||
if (chain_up)
|
|
||||||
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 *out_failure_reason)
|
|
||||||
{
|
|
||||||
NMConnection *connection;
|
|
||||||
NMSettingIPConfig *s_ip6;
|
|
||||||
gboolean may_fail = FALSE, chain_up = FALSE;
|
|
||||||
NMActStageReturn ret;
|
|
||||||
|
|
||||||
connection = nm_device_get_applied_connection (device);
|
|
||||||
|
|
||||||
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, out_failure_reason);
|
|
||||||
if (chain_up)
|
|
||||||
ret = NM_DEVICE_CLASS (nm_device_wifi_parent_class)->act_stage4_ip6_config_timeout (device, out_failure_reason);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -3447,10 +3384,8 @@ nm_device_wifi_class_init (NMDeviceWifiClass *klass)
|
||||||
device_class->act_stage1_prepare = act_stage1_prepare;
|
device_class->act_stage1_prepare = act_stage1_prepare;
|
||||||
device_class->act_stage2_config = act_stage2_config;
|
device_class->act_stage2_config = act_stage2_config;
|
||||||
device_class->get_configured_mtu = get_configured_mtu;
|
device_class->get_configured_mtu = get_configured_mtu;
|
||||||
device_class->act_stage3_ip4_config_start = act_stage3_ip4_config_start;
|
device_class->act_stage3_ip_config_start = act_stage3_ip_config_start;
|
||||||
device_class->act_stage3_ip6_config_start = act_stage3_ip6_config_start;
|
device_class->act_stage4_ip_config_timeout = act_stage4_ip_config_timeout;
|
||||||
device_class->act_stage4_ip4_config_timeout = act_stage4_ip4_config_timeout;
|
|
||||||
device_class->act_stage4_ip6_config_timeout = act_stage4_ip6_config_timeout;
|
|
||||||
device_class->deactivate = deactivate;
|
device_class->deactivate = deactivate;
|
||||||
device_class->deactivate_reset_hw_addr = deactivate_reset_hw_addr;
|
device_class->deactivate_reset_hw_addr = deactivate_reset_hw_addr;
|
||||||
device_class->unmanaged_on_quit = unmanaged_on_quit;
|
device_class->unmanaged_on_quit = unmanaged_on_quit;
|
||||||
|
|
|
||||||
|
|
@ -228,7 +228,7 @@ modem_ip6_config_result (NMModem *modem,
|
||||||
NMDevice *device = NM_DEVICE (self);
|
NMDevice *device = NM_DEVICE (self);
|
||||||
NMActStageReturn ret;
|
NMActStageReturn ret;
|
||||||
NMDeviceStateReason failure_reason = NM_DEVICE_STATE_REASON_NONE;
|
NMDeviceStateReason failure_reason = NM_DEVICE_STATE_REASON_NONE;
|
||||||
NMIP6Config *ignored = NULL;
|
gs_unref_object NMIP6Config *ignored = NULL;
|
||||||
gboolean got_config = !!config;
|
gboolean got_config = !!config;
|
||||||
|
|
||||||
g_return_if_fail (nm_device_activate_ip6_state_in_conf (device) == TRUE);
|
g_return_if_fail (nm_device_activate_ip6_state_in_conf (device) == TRUE);
|
||||||
|
|
@ -261,8 +261,10 @@ modem_ip6_config_result (NMModem *modem,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Start SLAAC now that we have a link-local address from the 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, &failure_reason);
|
ret = NM_DEVICE_CLASS (nm_device_modem_parent_class)->act_stage3_ip_config_start (device, AF_INET6, (gpointer *) &ignored, &failure_reason);
|
||||||
g_assert (ignored == NULL);
|
|
||||||
|
nm_assert (ignored == NULL);
|
||||||
|
|
||||||
switch (ret) {
|
switch (ret) {
|
||||||
case NM_ACT_STAGE_RETURN_FAILURE:
|
case NM_ACT_STAGE_RETURN_FAILURE:
|
||||||
nm_device_ip_method_failed (device, AF_INET6, failure_reason);
|
nm_device_ip_method_failed (device, AF_INET6, failure_reason);
|
||||||
|
|
@ -278,7 +280,7 @@ modem_ip6_config_result (NMModem *modem,
|
||||||
/* Should never get here since we've assured that the IPv6 method
|
/* Should never get here since we've assured that the IPv6 method
|
||||||
* will either be "auto" or "ignored" when starting IPv6 configuration.
|
* will either be "auto" or "ignored" when starting IPv6 configuration.
|
||||||
*/
|
*/
|
||||||
g_assert_not_reached ();
|
nm_assert_not_reached ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -569,14 +571,25 @@ act_stage2_config (NMDevice *device, NMDeviceStateReason *out_failure_reason)
|
||||||
}
|
}
|
||||||
|
|
||||||
static NMActStageReturn
|
static NMActStageReturn
|
||||||
act_stage3_ip4_config_start (NMDevice *device,
|
act_stage3_ip_config_start (NMDevice *device,
|
||||||
NMIP4Config **out_config,
|
int addr_family,
|
||||||
NMDeviceStateReason *out_failure_reason)
|
gpointer *out_config,
|
||||||
|
NMDeviceStateReason *out_failure_reason)
|
||||||
{
|
{
|
||||||
return nm_modem_stage3_ip4_config_start (NM_DEVICE_MODEM_GET_PRIVATE ((NMDeviceModem *) device)->modem,
|
NMDeviceModemPrivate *priv = NM_DEVICE_MODEM_GET_PRIVATE (device);
|
||||||
device,
|
|
||||||
NM_DEVICE_CLASS (nm_device_modem_parent_class),
|
nm_assert_addr_family (addr_family);
|
||||||
out_failure_reason);
|
|
||||||
|
if (addr_family == AF_INET) {
|
||||||
|
return nm_modem_stage3_ip4_config_start (priv->modem,
|
||||||
|
device,
|
||||||
|
NM_DEVICE_CLASS (nm_device_modem_parent_class),
|
||||||
|
out_failure_reason);
|
||||||
|
} else {
|
||||||
|
return nm_modem_stage3_ip6_config_start (priv->modem,
|
||||||
|
device,
|
||||||
|
out_failure_reason);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -585,16 +598,6 @@ ip4_config_pre_commit (NMDevice *device, NMIP4Config *config)
|
||||||
nm_modem_ip4_pre_commit (NM_DEVICE_MODEM_GET_PRIVATE ((NMDeviceModem *) device)->modem, device, config);
|
nm_modem_ip4_pre_commit (NM_DEVICE_MODEM_GET_PRIVATE ((NMDeviceModem *) device)->modem, device, config);
|
||||||
}
|
}
|
||||||
|
|
||||||
static NMActStageReturn
|
|
||||||
act_stage3_ip6_config_start (NMDevice *device,
|
|
||||||
NMIP6Config **out_config,
|
|
||||||
NMDeviceStateReason *out_failure_reason)
|
|
||||||
{
|
|
||||||
return nm_modem_stage3_ip6_config_start (NM_DEVICE_MODEM_GET_PRIVATE ((NMDeviceModem *) device)->modem,
|
|
||||||
device,
|
|
||||||
out_failure_reason);
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
get_ip_iface_identifier (NMDevice *device, NMUtilsIPv6IfaceId *out_iid)
|
get_ip_iface_identifier (NMDevice *device, NMUtilsIPv6IfaceId *out_iid)
|
||||||
{
|
{
|
||||||
|
|
@ -824,8 +827,7 @@ nm_device_modem_class_init (NMDeviceModemClass *klass)
|
||||||
device_class->deactivate = deactivate;
|
device_class->deactivate = deactivate;
|
||||||
device_class->act_stage1_prepare = act_stage1_prepare;
|
device_class->act_stage1_prepare = act_stage1_prepare;
|
||||||
device_class->act_stage2_config = act_stage2_config;
|
device_class->act_stage2_config = act_stage2_config;
|
||||||
device_class->act_stage3_ip4_config_start = act_stage3_ip4_config_start;
|
device_class->act_stage3_ip_config_start = act_stage3_ip_config_start;
|
||||||
device_class->act_stage3_ip6_config_start = act_stage3_ip6_config_start;
|
|
||||||
device_class->ip4_config_pre_commit = ip4_config_pre_commit;
|
device_class->ip4_config_pre_commit = ip4_config_pre_commit;
|
||||||
device_class->get_enabled = get_enabled;
|
device_class->get_enabled = get_enabled;
|
||||||
device_class->set_enabled = set_enabled;
|
device_class->set_enabled = set_enabled;
|
||||||
|
|
|
||||||
|
|
@ -728,7 +728,7 @@ nm_modem_stage3_ip4_config_start (NMModem *self,
|
||||||
break;
|
break;
|
||||||
case NM_MODEM_IP_METHOD_AUTO:
|
case NM_MODEM_IP_METHOD_AUTO:
|
||||||
_LOGD ("MODEM_IP_METHOD_AUTO");
|
_LOGD ("MODEM_IP_METHOD_AUTO");
|
||||||
ret = device_class->act_stage3_ip4_config_start (device, NULL, out_failure_reason);
|
ret = device_class->act_stage3_ip_config_start (device, AF_INET, NULL, out_failure_reason);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
_LOGI ("IPv4 configuration disabled");
|
_LOGI ("IPv4 configuration disabled");
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue