mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-10 04:40:20 +01:00
ppp: start PPP at activation stage3 instead of stage2
With the addition of IPv6, both v4 and v6 configuration are run in parallel, and when both have finished, then activation can proceed. Unfortunately, two of the 3 users of PPP (PPPoE and 3G) ran PPP at stage2, and when the PPP IPv4 config was received, jumped directly to activation stage4. That caused the IPv6 code never to run, and thus we hung at stage4 waiting for it to complete when nothing had started it in the first place. Instead, move PPP to stage3 so that nm_device_activate_stage3_ip_config_start() can kick off both v4 and v6 IP code and we can successfully complete IP configuration in all cases. PPP previously being in stage2 was an artifact of the more simplistic pre-IPv6 configuration code where it didn't matter if you skipped stage3.
This commit is contained in:
parent
377b116651
commit
3e221833da
2 changed files with 32 additions and 43 deletions
|
|
@ -152,7 +152,7 @@ ppp_stats (NMPPPManager *ppp_manager,
|
|||
}
|
||||
|
||||
static NMActStageReturn
|
||||
ppp_stage2_config (NMDevice *device, NMDeviceStateReason *reason)
|
||||
ppp_stage3_ip4_config_start (NMDevice *device, NMDeviceStateReason *reason)
|
||||
{
|
||||
NMModemPrivate *priv = NM_MODEM_GET_PRIVATE (device);
|
||||
NMActRequest *req;
|
||||
|
|
@ -246,7 +246,7 @@ static_stage3_done (DBusGProxy *proxy, DBusGProxyCall *call_id, gpointer user_da
|
|||
}
|
||||
|
||||
static NMActStageReturn
|
||||
static_stage3_config (NMDevice *device, NMDeviceStateReason *reason)
|
||||
static_stage3_ip4_config_start (NMDevice *device, NMDeviceStateReason *reason)
|
||||
{
|
||||
dbus_g_proxy_begin_call (nm_modem_get_proxy (NM_MODEM (device), MM_DBUS_INTERFACE_MODEM),
|
||||
"GetIP4Config", static_stage3_done,
|
||||
|
|
@ -278,30 +278,6 @@ static_stage4 (NMDevice *device, NMIP4Config **config, NMDeviceStateReason *reas
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
static NMActStageReturn
|
||||
real_act_stage2_config (NMDevice *device, NMDeviceStateReason *reason)
|
||||
{
|
||||
NMActStageReturn ret;
|
||||
|
||||
switch (NM_MODEM_GET_PRIVATE (device)->ip_method) {
|
||||
case MM_MODEM_IP_METHOD_PPP:
|
||||
ret = ppp_stage2_config (device, reason);
|
||||
break;
|
||||
case MM_MODEM_IP_METHOD_STATIC:
|
||||
ret = NM_ACT_STAGE_RETURN_SUCCESS;
|
||||
break;
|
||||
case MM_MODEM_IP_METHOD_DHCP:
|
||||
ret = NM_ACT_STAGE_RETURN_SUCCESS;
|
||||
break;
|
||||
default:
|
||||
g_warning ("Invalid IP method");
|
||||
ret = NM_ACT_STAGE_RETURN_FAILURE;
|
||||
break;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static NMActStageReturn
|
||||
real_act_stage3_ip4_config_start (NMDevice *device, NMDeviceStateReason *reason)
|
||||
{
|
||||
|
|
@ -309,10 +285,10 @@ real_act_stage3_ip4_config_start (NMDevice *device, NMDeviceStateReason *reason)
|
|||
|
||||
switch (NM_MODEM_GET_PRIVATE (device)->ip_method) {
|
||||
case MM_MODEM_IP_METHOD_PPP:
|
||||
ret = NM_ACT_STAGE_RETURN_SUCCESS;
|
||||
ret = ppp_stage3_ip4_config_start (device, reason);
|
||||
break;
|
||||
case MM_MODEM_IP_METHOD_STATIC:
|
||||
ret = static_stage3_config (device, reason);
|
||||
ret = static_stage3_ip4_config_start (device, reason);
|
||||
break;
|
||||
case MM_MODEM_IP_METHOD_DHCP:
|
||||
ret = NM_DEVICE_CLASS (nm_modem_parent_class)->act_stage3_ip4_config_start (device, reason);
|
||||
|
|
@ -610,7 +586,6 @@ nm_modem_class_init (NMModemClass *klass)
|
|||
object_class->finalize = finalize;
|
||||
|
||||
device_class->get_generic_capabilities = real_get_generic_capabilities;
|
||||
device_class->act_stage2_config = real_act_stage2_config;
|
||||
device_class->act_stage3_ip4_config_start = real_act_stage3_ip4_config_start;
|
||||
device_class->act_stage4_get_ip4_config = real_act_stage4_get_ip4_config;
|
||||
device_class->deactivate_quickly = real_deactivate_quickly;
|
||||
|
|
|
|||
|
|
@ -1260,7 +1260,7 @@ ppp_ip4_config (NMPPPManager *ppp_manager,
|
|||
}
|
||||
|
||||
static NMActStageReturn
|
||||
pppoe_stage2_config (NMDeviceEthernet *self, NMDeviceStateReason *reason)
|
||||
pppoe_stage3_ip4_config_start (NMDeviceEthernet *self, NMDeviceStateReason *reason)
|
||||
{
|
||||
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (self);
|
||||
NMConnection *connection;
|
||||
|
|
@ -1304,35 +1304,48 @@ pppoe_stage2_config (NMDeviceEthernet *self, NMDeviceStateReason *reason)
|
|||
static NMActStageReturn
|
||||
real_act_stage2_config (NMDevice *device, NMDeviceStateReason *reason)
|
||||
{
|
||||
NMSettingConnection *s_connection;
|
||||
NMSettingConnection *s_con;
|
||||
const char *connection_type;
|
||||
NMActStageReturn ret;
|
||||
NMActStageReturn ret = NM_ACT_STAGE_RETURN_SUCCESS;
|
||||
|
||||
g_return_val_if_fail (reason != NULL, NM_ACT_STAGE_RETURN_FAILURE);
|
||||
|
||||
s_connection = NM_SETTING_CONNECTION (device_get_setting (device, NM_TYPE_SETTING_CONNECTION));
|
||||
g_assert (s_connection);
|
||||
s_con = NM_SETTING_CONNECTION (device_get_setting (device, NM_TYPE_SETTING_CONNECTION));
|
||||
g_assert (s_con);
|
||||
|
||||
connection_type = nm_setting_connection_get_connection_type (s_connection);
|
||||
/* 802.1x has to run before any IP configuration since the 802.1x auth
|
||||
* process opens the port up for normal traffic.
|
||||
*/
|
||||
connection_type = nm_setting_connection_get_connection_type (s_con);
|
||||
if (!strcmp (connection_type, NM_SETTING_WIRED_SETTING_NAME)) {
|
||||
NMSetting8021x *security;
|
||||
|
||||
security = (NMSetting8021x *) device_get_setting (device, NM_TYPE_SETTING_802_1X);
|
||||
if (security)
|
||||
ret = nm_8021x_stage2_config (NM_DEVICE_ETHERNET (device), reason);
|
||||
else
|
||||
ret = NM_ACT_STAGE_RETURN_SUCCESS;
|
||||
} else if (!strcmp (connection_type, NM_SETTING_PPPOE_SETTING_NAME))
|
||||
ret = pppoe_stage2_config (NM_DEVICE_ETHERNET (device), reason);
|
||||
else {
|
||||
nm_warning ("Invalid connection type '%s' for ethernet device", connection_type);
|
||||
*reason = NM_DEVICE_STATE_REASON_CONFIG_FAILED;
|
||||
ret = NM_ACT_STAGE_RETURN_FAILURE;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static NMActStageReturn
|
||||
real_act_stage3_ip4_config_start (NMDevice *device, NMDeviceStateReason *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 (device_get_setting (device, NM_TYPE_SETTING_CONNECTION));
|
||||
g_assert (s_con);
|
||||
|
||||
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 NM_DEVICE_CLASS (nm_device_ethernet_parent_class)->act_stage3_ip4_config_start (device, reason);
|
||||
}
|
||||
|
||||
static NMActStageReturn
|
||||
real_act_stage4_get_ip4_config (NMDevice *device,
|
||||
NMIP4Config **config,
|
||||
|
|
@ -1775,6 +1788,7 @@ nm_device_ethernet_class_init (NMDeviceEthernetClass *klass)
|
|||
parent_class->check_connection_compatible = real_check_connection_compatible;
|
||||
|
||||
parent_class->act_stage2_config = real_act_stage2_config;
|
||||
parent_class->act_stage3_ip4_config_start = real_act_stage3_ip4_config_start;
|
||||
parent_class->act_stage4_get_ip4_config = real_act_stage4_get_ip4_config;
|
||||
parent_class->deactivate_quickly = real_deactivate_quickly;
|
||||
parent_class->spec_match_list = spec_match_list;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue