diff options
| author | Jeremy Bicha <jeremy.bicha@canonical.com> | 2022-02-22 16:55:11 -0500 |
|---|---|---|
| committer | Jeremy Bicha <jeremy.bicha@canonical.com> | 2022-02-22 17:04:04 -0500 |
| commit | 9bb70a1702d95481541916bd29903a8d75251831 (patch) | |
| tree | 5af847e78e5836ffd841714b541636729675d6a6 /src/core | |
| parent | 2ddef01c8fe66feabcd5a33b904ff3a5deb89652 (diff) | |
| parent | 6dff5938b0e45d461d0351da304a68916f2e9a2b (diff) | |
Merge tag 'debian/1.35.92-1' into ubuntu/master
network-manager Debian release 1.35.92-1
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/devices/nm-device.c | 29 | ||||
| -rw-r--r-- | src/core/nm-l3cfg.c | 84 | ||||
| -rw-r--r-- | src/core/nm-l3cfg.h | 2 | ||||
| -rw-r--r-- | src/core/nm-policy.c | 6 | ||||
| -rw-r--r-- | src/core/ppp/nm-ppp-manager.c | 2 |
5 files changed, 47 insertions, 76 deletions
diff --git a/src/core/devices/nm-device.c b/src/core/devices/nm-device.c index 696c0df8..aed580ab 100644 --- a/src/core/devices/nm-device.c +++ b/src/core/devices/nm-device.c @@ -3057,6 +3057,7 @@ _dev_ip_state_check(NMDevice *self, int addr_family) gboolean s_is_started = FALSE; gboolean s_is_failed = FALSE; gboolean s_is_pending = FALSE; + gboolean has_tna = FALSE; gboolean v_bool; NMDeviceIPState ip_state; NMDeviceIPState ip_state_other; @@ -3188,6 +3189,10 @@ _dev_ip_state_check(NMDevice *self, int addr_family) &s_is_pending, &s_is_failed); + has_tna = priv->l3cfg && nm_l3cfg_has_temp_not_available_obj(priv->l3cfg, addr_family); + if (has_tna) + s_is_pending = TRUE; + if (s_is_failed) ip_state = NM_DEVICE_IP_STATE_FAILED; else if (s_is_pending) @@ -3215,7 +3220,7 @@ got_ip_state: nm_assert(!priv->ip_data_4.is_ignore); _LOGT_ip(addr_family, - "check-state: state %s => %s, is_failed=%d, is_pending=%d, is_started=%d, " + "check-state: state %s => %s, is_failed=%d, is_pending=%d, is_started=%d temp_na=%d, " "may-fail-4=%d, may-fail-6=%d;" "%s;%s%s%s%s%s%s;%s%s%s%s%s%s%s%s", nm_device_ip_state_to_string(priv->ip_data_x[IS_IPv4].state), @@ -3223,6 +3228,7 @@ got_ip_state: s_is_failed, s_is_pending, s_is_started, + has_tna, _prop_get_ipvx_may_fail_cached(self, AF_INET, IS_IPv4 ? &may_fail : &may_fail_other), _prop_get_ipvx_may_fail_cached(self, AF_INET6, !IS_IPv4 ? &may_fail : &may_fail_other), priv->ip_data_4.is_disabled ? " disabled4" : "", @@ -3932,6 +3938,9 @@ _dev_l3_cfg_notify_cb(NML3Cfg *l3cfg, const NML3ConfigNotifyData *notify_data, N AF_INET6, NM_L3CFG_CHECK_READY_FLAGS_IP6_DAD_READY, NULL)) { + if (nm_l3cfg_has_temp_not_available_obj(priv->l3cfg, AF_INET6)) + _dev_l3_cfg_commit(self, FALSE); + nm_clear_l3cd(&priv->ipac6_data.l3cd); _dev_ipac6_set_state(self, NM_DEVICE_IP_STATE_READY); _dev_ip_state_check_async(self, AF_INET6); @@ -9821,6 +9830,14 @@ _dev_ipmanual_check_ready(NMDevice *self) _dev_ipmanual_set_state(self, addr_family, NM_DEVICE_IP_STATE_FAILED); _dev_ip_state_check_async(self, AF_UNSPEC); } else if (ready) { + if (priv->ipmanual_data.state_x[IS_IPv4] != NM_DEVICE_IP_STATE_READY + && nm_l3cfg_has_temp_not_available_obj(priv->l3cfg, addr_family)) { + /* Addresses with pending ACD/DAD are a possible cause for the + * presence of temporarily-not-available objects. Once all addresses + * are ready, retry to commit those unavailable objects. */ + _dev_l3_cfg_commit(self, FALSE); + } + _dev_ipmanual_set_state(self, addr_family, NM_DEVICE_IP_STATE_READY); _dev_ip_state_check_async(self, AF_UNSPEC); } @@ -10455,14 +10472,14 @@ nm_device_copy_ip6_dns_config(NMDevice *self, NMDevice *from_device) l3cd_src = priv_src->l3cds[L3_CONFIG_DATA_TYPE_AC_6].d; } if (l3cd_src) { - const char *const *strvarr; - const struct in6_addr *const *addrs; - guint n; - guint i; + const char *const *strvarr; + const struct in6_addr *addrs; + guint n; + guint i; addrs = nm_l3_config_data_get_nameservers(l3cd_src, AF_INET6, &n); for (i = 0; i < n; i++) - nm_l3_config_data_add_nameserver(l3cd, AF_INET6, addrs[i]); + nm_l3_config_data_add_nameserver(l3cd, AF_INET6, &addrs[i]); strvarr = nm_l3_config_data_get_searches(l3cd_src, AF_INET6, &n); for (i = 0; i < n; i++) diff --git a/src/core/nm-l3cfg.c b/src/core/nm-l3cfg.c index bcbe140c..7d00264b 100644 --- a/src/core/nm-l3cfg.c +++ b/src/core/nm-l3cfg.c @@ -499,73 +499,6 @@ nm_l3cfg_ipconfig_acquire(NML3Cfg *self, int addr_family) /*****************************************************************************/ -NMIPConfig * -nm_l3cfg_ipconfig_get(NML3Cfg *self, int addr_family) -{ - g_return_val_if_fail(NM_IS_L3CFG(self), NULL); - nm_assert_addr_family(addr_family); - - return self->priv.p->ipconfig_x[NM_IS_IPv4(addr_family)]; -} - -static void -_ipconfig_toggle_notify(gpointer data, GObject *object, gboolean is_last_ref) -{ - NML3Cfg *self = NM_L3CFG(data); - NMIPConfig *ipconfig = NM_IP_CONFIG(object); - - if (!is_last_ref) { - /* This happens while we take another ref below. Ignore the signal. */ - nm_assert(!NM_IN_SET(ipconfig, self->priv.p->ipconfig_4, self->priv.p->ipconfig_6)); - return; - } - - if (ipconfig == self->priv.p->ipconfig_4) - self->priv.p->ipconfig_4 = NULL; - else { - nm_assert(ipconfig == self->priv.p->ipconfig_6); - self->priv.p->ipconfig_6 = NULL; - } - - /* We take a second reference to keep the instance alive, while also removing the - * toggle ref. This will notify the function again, but we will ignore that. */ - g_object_ref(ipconfig); - - g_object_remove_toggle_ref(G_OBJECT(ipconfig), _ipconfig_toggle_notify, self); - - /* pass on the reference, and unexport on idle. */ - nm_ip_config_take_and_unexport_on_idle(g_steal_pointer(&ipconfig)); -} - -NMIPConfig * -nm_l3cfg_ipconfig_acquire(NML3Cfg *self, int addr_family) -{ - NMIPConfig *ipconfig; - - g_return_val_if_fail(NM_IS_L3CFG(self), NULL); - nm_assert_addr_family(addr_family); - - ipconfig = self->priv.p->ipconfig_x[NM_IS_IPv4(addr_family)]; - - if (ipconfig) - return g_object_ref(ipconfig); - - ipconfig = nm_ip_config_new(addr_family, self); - - self->priv.p->ipconfig_x[NM_IS_IPv4(addr_family)] = ipconfig; - - /* The ipconfig keeps self alive. We use a toggle reference - * to avoid a cycle. But we anyway wouldn't want a strong reference, - * because the user releases the instance by unrefing it, and we - * notice that via the weak reference. */ - g_object_add_toggle_ref(G_OBJECT(ipconfig), _ipconfig_toggle_notify, self); - - /* We keep the toggle reference, and return the other reference to the caller. */ - return g_steal_pointer(&ipconfig); -} - -/*****************************************************************************/ - gboolean nm_l3cfg_is_vrf(const NML3Cfg *self) { @@ -3015,6 +2948,23 @@ nm_l3cfg_get_acd_addr_info(NML3Cfg *self, in_addr_t addr) /*****************************************************************************/ gboolean +nm_l3cfg_has_temp_not_available_obj(NML3Cfg *self, int addr_family) +{ + ObjStateData *obj_state; + + nm_assert(NM_IS_L3CFG(self)); + nm_assert_addr_family(addr_family); + + c_list_for_each_entry (obj_state, + &self->priv.p->obj_state_temporary_not_available_lst_head, + os_temporary_not_available_lst) { + if (NMP_OBJECT_GET_ADDR_FAMILY(obj_state->obj) == addr_family) + return TRUE; + } + return FALSE; +} + +gboolean nm_l3cfg_check_ready(NML3Cfg *self, const NML3ConfigData *l3cd, int addr_family, diff --git a/src/core/nm-l3cfg.h b/src/core/nm-l3cfg.h index 7dc9facc..0ea68646 100644 --- a/src/core/nm-l3cfg.h +++ b/src/core/nm-l3cfg.h @@ -410,6 +410,8 @@ gboolean nm_l3cfg_check_ready(NML3Cfg *self, NML3CfgCheckReadyFlags flags, gboolean *acd_used); +gboolean nm_l3cfg_has_temp_not_available_obj(NML3Cfg *self, int addr_family); + /*****************************************************************************/ NML3CfgCommitType nm_l3cfg_commit_type_get(NML3Cfg *self); diff --git a/src/core/nm-policy.c b/src/core/nm-policy.c index cb5b543e..d77fc0a0 100644 --- a/src/core/nm-policy.c +++ b/src/core/nm-policy.c @@ -2005,7 +2005,8 @@ device_state_changed(NMDevice *device, AF_UNSPEC, device, nm_device_get_l3cd(device, TRUE), - NM_DNS_IP_CONFIG_TYPE_DEFAULT, + nm_device_is_vpn(device) ? NM_DNS_IP_CONFIG_TYPE_VPN + : NM_DNS_IP_CONFIG_TYPE_DEFAULT, TRUE); } update_ip_dns(self, AF_INET, device); @@ -2147,7 +2148,8 @@ device_l3cd_changed(NMDevice *device, AF_UNSPEC, device, l3cd_new, - NM_DNS_IP_CONFIG_TYPE_DEFAULT, + nm_device_is_vpn(device) ? NM_DNS_IP_CONFIG_TYPE_VPN + : NM_DNS_IP_CONFIG_TYPE_DEFAULT, TRUE); update_ip_dns(self, AF_INET, device); update_ip_dns(self, AF_INET6, device); diff --git a/src/core/ppp/nm-ppp-manager.c b/src/core/ppp/nm-ppp-manager.c index f1f10305..dd6b1bc7 100644 --- a/src/core/ppp/nm-ppp-manager.c +++ b/src/core/ppp/nm-ppp-manager.c @@ -1246,7 +1246,7 @@ _ppp_manager_stop(NMPPPManager *self, SIGTERM, LOGD_PPP, "pppd", - NM_SHUTDOWN_TIMEOUT_MS, + 5000, _stop_child_cb, handle); |