diff options
| author | Michael Biebl <biebl@debian.org> | 2022-08-26 20:36:29 +0200 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2022-08-26 20:36:29 +0200 |
| commit | ab0efddcdb48d800e2f938da54cfe3074640792e (patch) | |
| tree | 88b67be9bb4a4ecc2b6e4d1766dc11bb43a13601 /src/core/devices | |
| parent | 0018d1f3cf71d680d7b6bceda55a5717244d8b26 (diff) | |
New upstream version 1.40.0 upstream/1.40.0
Diffstat (limited to 'src/core/devices')
| -rw-r--r-- | src/core/devices/nm-device-bond.c | 2 | ||||
| -rw-r--r-- | src/core/devices/nm-device-ethernet.c | 2 | ||||
| -rw-r--r-- | src/core/devices/nm-device.c | 80 | ||||
| -rw-r--r-- | src/core/devices/nm-device.h | 2 | ||||
| -rw-r--r-- | src/core/devices/wifi/nm-device-wifi.c | 4 |
5 files changed, 52 insertions, 38 deletions
diff --git a/src/core/devices/nm-device-bond.c b/src/core/devices/nm-device-bond.c index 41473abe..44bb316d 100644 --- a/src/core/devices/nm-device-bond.c +++ b/src/core/devices/nm-device-bond.c @@ -461,7 +461,7 @@ _platform_lnk_bond_init_from_setting(NMSettingBond *s_bond, NMPlatformLnkBond *p props->peer_notif_delay_has = (props->miimon || props->arp_interval) && props->peer_notif_delay; props->arp_all_targets_has = props->arp_interval && props->arp_all_targets; props->resend_igmp_has = props->resend_igmp != 1; - props->lp_interval = props->lp_interval != 1; + props->lp_interval_has = props->lp_interval != 1; props->tlb_dynamic_lb_has = NM_IN_SET(props->mode, NM_BOND_MODE_TLB, NM_BOND_MODE_ALB); } diff --git a/src/core/devices/nm-device-ethernet.c b/src/core/devices/nm-device-ethernet.c index 32f2fbf9..40c6d208 100644 --- a/src/core/devices/nm-device-ethernet.c +++ b/src/core/devices/nm-device-ethernet.c @@ -451,7 +451,7 @@ supplicant_auth_state_changed(NMSupplicantInterface *iface, if (state == NM_SUPPLICANT_AUTH_STATE_SUCCESS) { nm_clear_g_signal_handler(priv->supplicant.iface, &priv->supplicant.iface_state_id); - nm_device_update_dynamic_ip_setup(NM_DEVICE(self)); + nm_device_update_dynamic_ip_setup(NM_DEVICE(self), "supplicant auth state changed"); } } diff --git a/src/core/devices/nm-device.c b/src/core/devices/nm-device.c index c51da9ac..d63b902b 100644 --- a/src/core/devices/nm-device.c +++ b/src/core/devices/nm-device.c @@ -1410,8 +1410,6 @@ _prop_get_connection_mptcp_flags(NMDevice *self) if (connection) { mptcp_flags = nm_setting_connection_get_mptcp_flags(nm_connection_get_setting_connection(connection)); - if (mptcp_flags != NM_MPTCP_FLAGS_NONE) - mptcp_flags = nm_mptcp_flags_normalize(mptcp_flags); } if (mptcp_flags == NM_MPTCP_FLAGS_NONE) { @@ -1423,28 +1421,39 @@ _prop_get_connection_mptcp_flags(NMDevice *self) 0, G_MAXINT64, NM_MPTCP_FLAGS_NONE); - /* We filter out all invalid settings and accept it. Somewhat intentionally, we don't do a - * strict parsing of the value to support forward compatibility. */ - if (v != NM_MPTCP_FLAGS_NONE) - mptcp_flags = nm_mptcp_flags_normalize(v); + if (v != NM_MPTCP_FLAGS_NONE) { + /* We silently ignore all invalid flags (and will normalize them away below). */ + mptcp_flags = (NMMptcpFlags) v; + if (mptcp_flags == NM_MPTCP_FLAGS_NONE) + mptcp_flags = NM_MPTCP_FLAGS_ENABLED; + } } - if (mptcp_flags == NM_MPTCP_FLAGS_NONE) { - gint32 v; - - v = nm_platform_sysctl_get_int32(nm_device_get_platform(self), - NMP_SYSCTL_PATHID_ABSOLUTE("/proc/sys/net/mptcp/enabled"), - -1); - if (v > 0) { - /* if MPTCP is enabled via the sysctl, we use the default. */ - mptcp_flags = _NM_MPTCP_FLAGS_DEFAULT; + if (mptcp_flags == NM_MPTCP_FLAGS_NONE) + mptcp_flags = _NM_MPTCP_FLAGS_DEFAULT; + + mptcp_flags = nm_mptcp_flags_normalize(mptcp_flags); + + if (!NM_FLAGS_HAS(mptcp_flags, NM_MPTCP_FLAGS_DISABLED)) { + if (!NM_FLAGS_HAS(mptcp_flags, NM_MPTCP_FLAGS_ALSO_WITHOUT_SYSCTL)) { + guint32 v; + + /* If enabled, but without "also-without-sysctl", then MPTCP is still + * disabled, if the sysctl says so... + * + * We evaluate this here. The point is that the decision is then cached + * until deactivation/reapply. The user can toggle the sysctl any time, + * but we only pick it up at certain moments (now). */ + v = nm_platform_sysctl_get_int32( + nm_device_get_platform(self), + NMP_SYSCTL_PATHID_ABSOLUTE("/proc/sys/net/mptcp/enabled"), + -1); + if (v <= 0) + mptcp_flags = NM_MPTCP_FLAGS_DISABLED; } else - mptcp_flags = NM_MPTCP_FLAGS_DISABLED; + mptcp_flags = NM_FLAGS_UNSET(mptcp_flags, NM_MPTCP_FLAGS_ALSO_WITHOUT_SYSCTL); } - nm_assert(mptcp_flags != NM_MPTCP_FLAGS_NONE - && mptcp_flags == nm_mptcp_flags_normalize(mptcp_flags)); - return mptcp_flags; } @@ -6323,7 +6332,7 @@ _dev_unmanaged_check_external_down(NMDevice *self, gboolean only_if_unmanaged, g } void -nm_device_update_dynamic_ip_setup(NMDevice *self) +nm_device_update_dynamic_ip_setup(NMDevice *self, const char *reason) { NMDevicePrivate *priv; @@ -6334,6 +6343,8 @@ nm_device_update_dynamic_ip_setup(NMDevice *self) if (priv->state < NM_DEVICE_STATE_IP_CONFIG || priv->state > NM_DEVICE_STATE_ACTIVATED) return; + _LOGD(LOGD_DEVICE, "restarting dynamic IP configuration (%s)", reason); + g_hash_table_remove_all(priv->ip6_saved_properties); if (priv->ipdhcp_data_4.state != NM_DEVICE_IP_STATE_NONE) @@ -6635,6 +6646,7 @@ device_link_changed(gpointer user_data) NMDeviceClass *klass = NM_DEVICE_GET_CLASS(self); NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE(self); gboolean ip_ifname_changed = FALSE; + gboolean hw_addr_changed; nm_auto_nmpobj const NMPObject *pllink_keep_alive = NULL; const NMPlatformLink *pllink; const char *str; @@ -6681,9 +6693,9 @@ device_link_changed(gpointer user_data) if (ifindex == nm_device_get_ip_ifindex(self)) _stats_update_counters_from_pllink(self, pllink); - had_hw_addr = (priv->hw_addr != NULL); - nm_device_update_hw_address(self); - got_hw_addr = (!had_hw_addr && priv->hw_addr); + had_hw_addr = (priv->hw_addr != NULL); + hw_addr_changed = nm_device_update_hw_address(self); + got_hw_addr = (!had_hw_addr && priv->hw_addr); nm_device_update_permanent_hw_address(self, FALSE); if (pllink->name[0] && !nm_streq(priv->iface, pllink->name)) { @@ -6733,7 +6745,9 @@ device_link_changed(gpointer user_data) /* Update DHCP, etc, if needed */ if (ip_ifname_changed) - nm_device_update_dynamic_ip_setup(self); + nm_device_update_dynamic_ip_setup(self, "IP interface changed"); + else if (hw_addr_changed) + nm_device_update_dynamic_ip_setup(self, "hw-address changed"); was_up = priv->up; priv->up = NM_FLAGS_HAS(pllink->n_ifi_flags, IFF_UP); @@ -6793,7 +6807,7 @@ device_link_changed(gpointer user_data) * renew DHCP leases and such. */ if (priv->state == NM_DEVICE_STATE_ACTIVATED) { - nm_device_update_dynamic_ip_setup(self); + nm_device_update_dynamic_ip_setup(self, "interface got carrier"); } } @@ -6855,7 +6869,7 @@ device_ip_link_changed(gpointer user_data) priv->ip_iface_ = g_strdup(ip_iface); update_prop_ip_iface(self); - nm_device_update_dynamic_ip_setup(self); + nm_device_update_dynamic_ip_setup(self, "interface renamed"); } return G_SOURCE_REMOVE; @@ -15778,6 +15792,13 @@ _set_state_full(NMDevice *self, NMDeviceState state, NMDeviceStateReason reason, if (priv->sys_iface_state == NM_DEVICE_SYS_IFACE_STATE_MANAGED) ip6_managed_setup(self); device_init_static_sriov_num_vfs(self); + + /* We didn't bring the device up and we have little idea + * when was it brought up. Play it safe and assume it could + * have been brought up very recently and it might one of + * those who take time to detect carrier. + */ + carrier_detect_wait(self); } if (priv->sys_iface_state == NM_DEVICE_SYS_IFACE_STATE_MANAGED) { @@ -15785,13 +15806,6 @@ _set_state_full(NMDevice *self, NMDeviceState state, NMDeviceStateReason reason, if (!nm_device_bring_up(self, TRUE, &no_firmware) && no_firmware) _LOGW(LOGD_PLATFORM, "firmware may be missing."); nm_device_set_firmware_missing(self, no_firmware ? TRUE : FALSE); - } else { - /* We didn't bring the device up and we have little idea - * when was it brought up. Play it safe and assume it could - * have been brought up very recently and it might one of - * those who take time to detect carrier. - */ - carrier_detect_wait(self); } /* Ensure the device gets deactivated in response to stuff like diff --git a/src/core/devices/nm-device.h b/src/core/devices/nm-device.h index 382c8660..de850e68 100644 --- a/src/core/devices/nm-device.h +++ b/src/core/devices/nm-device.h @@ -764,7 +764,7 @@ void nm_device_update_metered(NMDevice *self); gboolean nm_device_update_hw_address(NMDevice *self); void nm_device_update_initial_hw_address(NMDevice *self); void nm_device_update_permanent_hw_address(NMDevice *self, gboolean force_freeze); -void nm_device_update_dynamic_ip_setup(NMDevice *self); +void nm_device_update_dynamic_ip_setup(NMDevice *self, const char *reason); guint nm_device_get_supplicant_timeout(NMDevice *self); gboolean nm_device_auth_retries_try_next(NMDevice *self); diff --git a/src/core/devices/wifi/nm-device-wifi.c b/src/core/devices/wifi/nm-device-wifi.c index 39c68d77..43798b85 100644 --- a/src/core/devices/wifi/nm-device-wifi.c +++ b/src/core/devices/wifi/nm-device-wifi.c @@ -2520,7 +2520,7 @@ supplicant_iface_state(NMDeviceWifi *self, _LOGD(LOGD_WIFI, "supplicant state settled after roaming, renew dynamic IP configuration"); nm_clear_g_source_inst(&priv->roam_supplicant_wait_source); - nm_device_update_dynamic_ip_setup(device); + nm_device_update_dynamic_ip_setup(device, "roamed to a different AP"); } } break; @@ -2663,7 +2663,7 @@ supplicant_iface_notify_current_bss(NMSupplicantInterface *iface, if (nm_supplicant_interface_get_state(priv->sup_iface) == NM_SUPPLICANT_INTERFACE_STATE_COMPLETED) { - nm_device_update_dynamic_ip_setup(NM_DEVICE(self)); + nm_device_update_dynamic_ip_setup(NM_DEVICE(self), "roamed to a different AP"); } else { /* Wait that the authentication to new the AP completes before * trying to renew, otherwise the DHCP REQUEST could be lost |