device: turn nm_d_ip_config_should_fail to get_ip_config_may_fail
Has a cleaner semantics and will be useful later on. Also, make it static -- it's not used outside nm-device.c.
This commit is contained in:
@@ -56,8 +56,6 @@ void nm_device_take_down (NMDevice *self, gboolean block);
|
||||
gboolean nm_device_set_hw_addr (NMDevice *device, const char *addr,
|
||||
const char *detail, guint64 hw_log_domain);
|
||||
|
||||
gboolean nm_device_ip_config_should_fail (NMDevice *self, gboolean ip6);
|
||||
|
||||
void nm_device_set_firmware_missing (NMDevice *self, gboolean missing);
|
||||
|
||||
void nm_device_activate_schedule_stage1_device_prepare (NMDevice *device);
|
||||
|
@@ -2215,11 +2215,11 @@ activation_source_schedule (NMDevice *self, GSourceFunc func, int family)
|
||||
}
|
||||
}
|
||||
|
||||
gboolean
|
||||
nm_device_ip_config_should_fail (NMDevice *self, gboolean ip6)
|
||||
static gboolean
|
||||
get_ip_config_may_fail (NMDevice *self, int family)
|
||||
{
|
||||
NMConnection *connection;
|
||||
NMSettingIPConfig *s_ip4, *s_ip6;
|
||||
NMSettingIPConfig *s_ip = NULL;
|
||||
|
||||
g_return_val_if_fail (self != NULL, TRUE);
|
||||
|
||||
@@ -2227,17 +2227,18 @@ nm_device_ip_config_should_fail (NMDevice *self, gboolean ip6)
|
||||
g_assert (connection);
|
||||
|
||||
/* Fail the connection if the failed IP method is required to complete */
|
||||
if (ip6) {
|
||||
s_ip6 = nm_connection_get_setting_ip6_config (connection);
|
||||
if (!nm_setting_ip_config_get_may_fail (s_ip6))
|
||||
return TRUE;
|
||||
} else {
|
||||
s_ip4 = nm_connection_get_setting_ip4_config (connection);
|
||||
if (!nm_setting_ip_config_get_may_fail (s_ip4))
|
||||
return TRUE;
|
||||
switch (family) {
|
||||
case AF_INET:
|
||||
s_ip = nm_connection_get_setting_ip4_config (connection);
|
||||
break;
|
||||
case AF_INET6:
|
||||
s_ip = nm_connection_get_setting_ip6_config (connection);
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
return nm_setting_ip_config_get_may_fail (s_ip);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -4668,7 +4669,7 @@ nm_device_activate_schedule_stage3_ip_config_start (NMDevice *self)
|
||||
static NMActStageReturn
|
||||
act_stage4_ip4_config_timeout (NMDevice *self, NMDeviceStateReason *reason)
|
||||
{
|
||||
if (nm_device_ip_config_should_fail (self, FALSE)) {
|
||||
if (!get_ip_config_may_fail (self, AF_INET)) {
|
||||
*reason = NM_DEVICE_STATE_REASON_IP_CONFIG_UNAVAILABLE;
|
||||
return NM_ACT_STAGE_RETURN_FAILURE;
|
||||
}
|
||||
@@ -4746,7 +4747,7 @@ nm_device_activate_schedule_ip4_config_timeout (NMDevice *self)
|
||||
static NMActStageReturn
|
||||
act_stage4_ip6_config_timeout (NMDevice *self, NMDeviceStateReason *reason)
|
||||
{
|
||||
if (nm_device_ip_config_should_fail (self, TRUE)) {
|
||||
if (!get_ip_config_may_fail (self, AF_INET6)) {
|
||||
*reason = NM_DEVICE_STATE_REASON_IP_CONFIG_UNAVAILABLE;
|
||||
return NM_ACT_STAGE_RETURN_FAILURE;
|
||||
}
|
||||
|
Reference in New Issue
Block a user