device: set ip_state to PENDING when cleaning up from reapply
When doing a reapply the ip_state must be set as PENDING, if not the ipdhcp_state won't be extended to ip_state. In addition, if one of the IP configuration is ready and the other may fail, then we should consider it ready. The other ip state does not matter at all, it can be none too. Fixes-test: @nmcli_device_reapply_routes
This commit is contained in:

committed by
Beniamino Galvani

parent
6ac95047ca
commit
b85a9cd9df
@@ -833,7 +833,8 @@ static void _dev_ipshared4_spawn_dnsmasq(NMDevice *self);
|
|||||||
|
|
||||||
static void _dev_ipshared6_start(NMDevice *self);
|
static void _dev_ipshared6_start(NMDevice *self);
|
||||||
|
|
||||||
static void _cleanup_ip_pre(NMDevice *self, int addr_family, CleanupType cleanup_type);
|
static void
|
||||||
|
_cleanup_ip_pre(NMDevice *self, int addr_family, CleanupType cleanup_type, gboolean from_reapply);
|
||||||
|
|
||||||
static void concheck_update_state(NMDevice * self,
|
static void concheck_update_state(NMDevice * self,
|
||||||
int addr_family,
|
int addr_family,
|
||||||
@@ -3246,10 +3247,6 @@ got_ip_state:
|
|||||||
&may_fail_other)))
|
&may_fail_other)))
|
||||||
combinedip_state = NM_DEVICE_IP_STATE_PENDING;
|
combinedip_state = NM_DEVICE_IP_STATE_PENDING;
|
||||||
else if (ip_state == NM_DEVICE_IP_STATE_READY
|
else if (ip_state == NM_DEVICE_IP_STATE_READY
|
||||||
&& NM_IN_SET(ip_state_other,
|
|
||||||
NM_DEVICE_IP_STATE_PENDING,
|
|
||||||
NM_DEVICE_IP_STATE_READY,
|
|
||||||
NM_DEVICE_IP_STATE_FAILED)
|
|
||||||
&& _prop_get_ipvx_may_fail_cached(self,
|
&& _prop_get_ipvx_may_fail_cached(self,
|
||||||
nm_utils_addr_family_other(addr_family),
|
nm_utils_addr_family_other(addr_family),
|
||||||
&may_fail_other))
|
&may_fail_other))
|
||||||
@@ -3350,13 +3347,16 @@ _dev_ip_state_check_async(NMDevice *self, int addr_family)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_dev_ip_state_cleanup(NMDevice *self, int addr_family)
|
_dev_ip_state_cleanup(NMDevice *self, int addr_family, gboolean from_reapply)
|
||||||
{
|
{
|
||||||
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE(self);
|
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE(self);
|
||||||
int IS_IPv4;
|
int IS_IPv4;
|
||||||
|
|
||||||
if (addr_family == AF_UNSPEC) {
|
if (addr_family == AF_UNSPEC) {
|
||||||
_dev_ip_state_set_state(self, addr_family, NM_DEVICE_IP_STATE_NONE, "ip-state-clear");
|
_dev_ip_state_set_state(self,
|
||||||
|
addr_family,
|
||||||
|
from_reapply ? NM_DEVICE_IP_STATE_PENDING : NM_DEVICE_IP_STATE_NONE,
|
||||||
|
"ip-state-clear");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3364,7 +3364,10 @@ _dev_ip_state_cleanup(NMDevice *self, int addr_family)
|
|||||||
|
|
||||||
nm_clear_g_source_inst(&priv->ip_data_x[IS_IPv4].check_async_source);
|
nm_clear_g_source_inst(&priv->ip_data_x[IS_IPv4].check_async_source);
|
||||||
nm_clear_g_source_inst(&priv->ip_data_x[IS_IPv4].req_timeout_source);
|
nm_clear_g_source_inst(&priv->ip_data_x[IS_IPv4].req_timeout_source);
|
||||||
_dev_ip_state_set_state(self, addr_family, NM_DEVICE_IP_STATE_NONE, "ip-state-clear");
|
_dev_ip_state_set_state(self,
|
||||||
|
addr_family,
|
||||||
|
from_reapply ? NM_DEVICE_IP_STATE_PENDING : NM_DEVICE_IP_STATE_NONE,
|
||||||
|
"ip-state-clear");
|
||||||
priv->ip_data_x[IS_IPv4].wait_for_carrier = FALSE;
|
priv->ip_data_x[IS_IPv4].wait_for_carrier = FALSE;
|
||||||
priv->ip_data_x[IS_IPv4].wait_for_ports = FALSE;
|
priv->ip_data_x[IS_IPv4].wait_for_ports = FALSE;
|
||||||
priv->ip_data_x[IS_IPv4].is_disabled = FALSE;
|
priv->ip_data_x[IS_IPv4].is_disabled = FALSE;
|
||||||
@@ -11744,11 +11747,11 @@ activate_stage3_ip_config(NMDevice *self)
|
|||||||
|
|
||||||
if (priv->ip_data_4.do_reapply) {
|
if (priv->ip_data_4.do_reapply) {
|
||||||
_LOGD_ip(AF_INET, "reapply...");
|
_LOGD_ip(AF_INET, "reapply...");
|
||||||
_cleanup_ip_pre(self, AF_INET, CLEANUP_TYPE_DECONFIGURE);
|
_cleanup_ip_pre(self, AF_INET, CLEANUP_TYPE_DECONFIGURE, TRUE);
|
||||||
}
|
}
|
||||||
if (priv->ip_data_6.do_reapply) {
|
if (priv->ip_data_6.do_reapply) {
|
||||||
_LOGD_ip(AF_INET6, "reapply...");
|
_LOGD_ip(AF_INET6, "reapply...");
|
||||||
_cleanup_ip_pre(self, AF_INET6, CLEANUP_TYPE_DECONFIGURE);
|
_cleanup_ip_pre(self, AF_INET6, CLEANUP_TYPE_DECONFIGURE, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add the interface to the specified firewall zone */
|
/* Add the interface to the specified firewall zone */
|
||||||
@@ -12247,7 +12250,7 @@ delete_on_deactivate_check_and_schedule(NMDevice *self)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cleanup_ip_pre(NMDevice *self, int addr_family, CleanupType cleanup_type)
|
_cleanup_ip_pre(NMDevice *self, int addr_family, CleanupType cleanup_type, gboolean from_reapply)
|
||||||
{
|
{
|
||||||
const int IS_IPv4 = NM_IS_IPv4(addr_family);
|
const int IS_IPv4 = NM_IS_IPv4(addr_family);
|
||||||
|
|
||||||
@@ -12265,8 +12268,8 @@ _cleanup_ip_pre(NMDevice *self, int addr_family, CleanupType cleanup_type)
|
|||||||
|
|
||||||
_dev_ipmanual_cleanup(self);
|
_dev_ipmanual_cleanup(self);
|
||||||
|
|
||||||
_dev_ip_state_cleanup(self, AF_UNSPEC);
|
_dev_ip_state_cleanup(self, AF_UNSPEC, from_reapply);
|
||||||
_dev_ip_state_cleanup(self, addr_family);
|
_dev_ip_state_cleanup(self, addr_family, from_reapply);
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
@@ -14923,8 +14926,8 @@ _cleanup_generic_pre(NMDevice *self, CleanupType cleanup_type)
|
|||||||
for (i = 0; i < 2; i++)
|
for (i = 0; i < 2; i++)
|
||||||
nm_clear_pointer(&priv->hostname_resolver_x[i], _hostname_resolver_free);
|
nm_clear_pointer(&priv->hostname_resolver_x[i], _hostname_resolver_free);
|
||||||
|
|
||||||
_cleanup_ip_pre(self, AF_INET, cleanup_type);
|
_cleanup_ip_pre(self, AF_INET, cleanup_type, FALSE);
|
||||||
_cleanup_ip_pre(self, AF_INET6, cleanup_type);
|
_cleanup_ip_pre(self, AF_INET6, cleanup_type, FALSE);
|
||||||
|
|
||||||
_dev_ip_state_req_timeout_cancel(self, AF_UNSPEC);
|
_dev_ip_state_req_timeout_cancel(self, AF_UNSPEC);
|
||||||
}
|
}
|
||||||
@@ -15424,8 +15427,8 @@ _set_state_full(NMDevice *self, NMDeviceState state, NMDeviceStateReason reason,
|
|||||||
/* Clean up any half-done IP operations if the device's layer2
|
/* Clean up any half-done IP operations if the device's layer2
|
||||||
* finds out it needs authentication during IP config.
|
* finds out it needs authentication during IP config.
|
||||||
*/
|
*/
|
||||||
_cleanup_ip_pre(self, AF_INET, CLEANUP_TYPE_DECONFIGURE);
|
_cleanup_ip_pre(self, AF_INET, CLEANUP_TYPE_DECONFIGURE, FALSE);
|
||||||
_cleanup_ip_pre(self, AF_INET6, CLEANUP_TYPE_DECONFIGURE);
|
_cleanup_ip_pre(self, AF_INET6, CLEANUP_TYPE_DECONFIGURE, FALSE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
Reference in New Issue
Block a user