mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-06 17:50:16 +01:00
device/wwan: don't pass device class to nm_modem_stage3_ip4_config_start()
The idea, that callers to nm_modem_stage3_ip4_config_start() pass a NMDeviceClass, which then might invoke a virtual function on the class is really bad. nm_modem_stage3_ip4_config_start() should indicate what the caller should do. The main problem is, that act_stage3_ip_config_start() is not supposed to be called by anybody except NMDevice. It's an internal hook, not for NMModem's concern.
This commit is contained in:
parent
31b74aab34
commit
798e56ac44
4 changed files with 29 additions and 26 deletions
|
|
@ -1004,21 +1004,21 @@ act_stage3_ip_config_start(NMDevice * device,
|
|||
gpointer * out_config,
|
||||
NMDeviceStateReason *out_failure_reason)
|
||||
{
|
||||
NMDeviceBtPrivate *priv = NM_DEVICE_BT_GET_PRIVATE(device);
|
||||
NMDeviceBtPrivate *priv = NM_DEVICE_BT_GET_PRIVATE(device);
|
||||
gboolean autoip4 = FALSE;
|
||||
NMActStageReturn ret;
|
||||
|
||||
nm_assert_addr_family(addr_family);
|
||||
if (priv->connect_bt_type != NM_BT_CAPABILITY_DUN)
|
||||
goto out_chain_up;
|
||||
|
||||
if (priv->connect_bt_type == NM_BT_CAPABILITY_DUN) {
|
||||
if (addr_family == AF_INET) {
|
||||
return nm_modem_stage3_ip4_config_start(priv->modem,
|
||||
device,
|
||||
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);
|
||||
}
|
||||
}
|
||||
if (!NM_IS_IPv4(addr_family))
|
||||
return nm_modem_stage3_ip6_config_start(priv->modem, device, out_failure_reason);
|
||||
|
||||
ret = nm_modem_stage3_ip4_config_start(priv->modem, device, &autoip4, out_failure_reason);
|
||||
if (ret != NM_ACT_STAGE_RETURN_SUCCESS || !autoip4)
|
||||
return ret;
|
||||
|
||||
out_chain_up:
|
||||
return NM_DEVICE_CLASS(nm_device_bt_parent_class)
|
||||
->act_stage3_ip_config_start(device, addr_family, out_config, out_failure_reason);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -616,18 +616,20 @@ act_stage3_ip_config_start(NMDevice * device,
|
|||
gpointer * out_config,
|
||||
NMDeviceStateReason *out_failure_reason)
|
||||
{
|
||||
NMDeviceModemPrivate *priv = NM_DEVICE_MODEM_GET_PRIVATE(device);
|
||||
NMDeviceModemPrivate *priv = NM_DEVICE_MODEM_GET_PRIVATE(device);
|
||||
gboolean autoip4 = FALSE;
|
||||
NMActStageReturn ret;
|
||||
|
||||
nm_assert_addr_family(addr_family);
|
||||
|
||||
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 {
|
||||
if (!NM_IS_IPv4(addr_family))
|
||||
return nm_modem_stage3_ip6_config_start(priv->modem, device, out_failure_reason);
|
||||
}
|
||||
|
||||
ret = nm_modem_stage3_ip4_config_start(priv->modem, device, &autoip4, out_failure_reason);
|
||||
|
||||
if (ret != NM_ACT_STAGE_RETURN_SUCCESS || !autoip4)
|
||||
return ret;
|
||||
|
||||
return NM_DEVICE_CLASS(nm_device_modem_parent_class)
|
||||
->act_stage3_ip_config_start(device, addr_family, out_config, out_failure_reason);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -727,7 +727,7 @@ ppp_stage3_ip_config_start(NMModem * self,
|
|||
NMActStageReturn
|
||||
nm_modem_stage3_ip4_config_start(NMModem * self,
|
||||
NMDevice * device,
|
||||
NMDeviceClass * device_class,
|
||||
gboolean * out_autoip4,
|
||||
NMDeviceStateReason *out_failure_reason)
|
||||
{
|
||||
NMModemPrivate * priv;
|
||||
|
|
@ -740,7 +740,7 @@ 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);
|
||||
nm_assert(out_autoip4 && !*out_autoip4);
|
||||
|
||||
req = nm_device_get_act_request(device);
|
||||
g_return_val_if_fail(req, NM_ACT_STAGE_RETURN_FAILURE);
|
||||
|
|
@ -774,7 +774,8 @@ nm_modem_stage3_ip4_config_start(NMModem * self,
|
|||
break;
|
||||
case NM_MODEM_IP_METHOD_AUTO:
|
||||
_LOGD("MODEM_IP_METHOD_AUTO");
|
||||
ret = device_class->act_stage3_ip_config_start(device, AF_INET, NULL, out_failure_reason);
|
||||
*out_autoip4 = TRUE;
|
||||
ret = NM_ACT_STAGE_RETURN_SUCCESS;
|
||||
break;
|
||||
default:
|
||||
_LOGI("IPv4 configuration disabled");
|
||||
|
|
|
|||
|
|
@ -210,7 +210,7 @@ void nm_modem_act_stage2_config(NMModem *modem);
|
|||
|
||||
NMActStageReturn nm_modem_stage3_ip4_config_start(NMModem * modem,
|
||||
NMDevice * device,
|
||||
NMDeviceClass * device_class,
|
||||
gboolean * out_autoip4,
|
||||
NMDeviceStateReason *out_failure_reason);
|
||||
|
||||
NMActStageReturn nm_modem_stage3_ip6_config_start(NMModem * modem,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue