diff options
| author | Michael Biebl <biebl@debian.org> | 2022-08-13 16:40:06 +0200 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2022-08-13 16:40:06 +0200 |
| commit | 38ca7ae9c3556e9a5b50ee15015ea194e6ca8da1 (patch) | |
| tree | 99f19f118f550362c3288e7b82a7aab3a75c8d64 /src/core/devices/nm-device.c | |
| parent | c2473cb3f165975f2899ccef11f036c9762a8aa3 (diff) | |
| parent | 49ac65f875a36d7ebcbc8270cf0fc60acbb2e052 (diff) | |
Merge tag 'debian/1.38.4-1' into debian/bullseye-backports
network-manager Debian release 1.38.4-1
Diffstat (limited to 'src/core/devices/nm-device.c')
| -rw-r--r-- | src/core/devices/nm-device.c | 78 |
1 files changed, 45 insertions, 33 deletions
diff --git a/src/core/devices/nm-device.c b/src/core/devices/nm-device.c index 70b52b1a..6b854517 100644 --- a/src/core/devices/nm-device.c +++ b/src/core/devices/nm-device.c @@ -1286,7 +1286,7 @@ out_fail: duid, duid_error); - nm_utils_random_bytes(&uuid, sizeof(uuid)); + nm_random_get_bytes(&uuid, sizeof(uuid)); duid_out = nm_utils_generate_duid_uuid(&uuid); } @@ -2022,7 +2022,7 @@ out_fail: fail_reason); client_id_buf = g_malloc(1 + 15); client_id_buf[0] = 0; - nm_utils_random_bytes(&client_id_buf[1], 15); + nm_random_get_bytes(&client_id_buf[1], 15); result = g_bytes_new_take(client_id_buf, 1 + 15); out_good: @@ -4026,7 +4026,6 @@ _set_ifindex(NMDevice *self, int ifindex, gboolean is_ip_ifindex) NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE(self); gs_unref_object NML3Cfg *l3cfg_old = NULL; NML3CfgCommitTypeHandle *l3cfg_commit_type_old = NULL; - gboolean l3_changed; int ip_ifindex_new; int *p_ifindex; gboolean l3cfg_was_reset = FALSE; @@ -4067,6 +4066,10 @@ _set_ifindex(NMDevice *self, int ifindex, gboolean is_ip_ifindex) l3cfg_was_reset = TRUE; } } + + if (!priv->l3cfg && l3cfg_old) + _dev_l3_register_l3cds(self, l3cfg_old, FALSE, FALSE); + if (!priv->l3cfg && ip_ifindex_new > 0) { priv->l3cfg_ = nm_netns_l3cfg_acquire(priv->netns, ip_ifindex_new); @@ -4078,6 +4081,7 @@ _set_ifindex(NMDevice *self, int ifindex, gboolean is_ip_ifindex) _dev_l3_cfg_commit_type_reset(self); l3cfg_was_reset = TRUE; } + if (!priv->l3cfg) { _cleanup_ip_pre(self, AF_INET, CLEANUP_TYPE_KEEP, FALSE); _cleanup_ip_pre(self, AF_INET6, CLEANUP_TYPE_KEEP, FALSE); @@ -4118,11 +4122,7 @@ _set_ifindex(NMDevice *self, int ifindex, gboolean is_ip_ifindex) _notify(self, PROP_IP6_CONFIG); } - if (l3cfg_old != priv->l3cfg) { - l3_changed = FALSE; - if (_dev_l3_register_l3cds(self, l3cfg_old, FALSE, FALSE)) - l3_changed = TRUE; - + if (priv->l3cfg && l3cfg_old != priv->l3cfg) { /* Now it gets ugly. We changed the ip-ifindex, which determines the NML3Cfg instance. * But all the NML3ConfigData we currently track are still for the old ifindex. We * need to update them. @@ -4131,12 +4131,10 @@ _set_ifindex(NMDevice *self, int ifindex, gboolean is_ip_ifindex) * associated with one ifindex (and not the ifindex/ip-ifindex split). Or it * is not at all associated with an ifindex, but only a controlling device for * a real NMDevice (that has the ifindex). */ + _dev_l3_update_l3cds_ifindex(self); if (_dev_l3_register_l3cds(self, priv->l3cfg, TRUE, FALSE)) - l3_changed = TRUE; - - if (l3_changed) _dev_l3_cfg_commit(self, TRUE); } @@ -6164,10 +6162,6 @@ carrier_changed(NMDevice *self, gboolean carrier) if (nm_device_is_master(self)) { if (carrier) { - /* Force master to retry getting ip addresses when carrier - * is restored. */ - if (priv->state == NM_DEVICE_STATE_ACTIVATED) - nm_device_update_dynamic_ip_setup(self); /* If needed, also resume IP configuration that is * waiting for carrier. */ if (priv->state == NM_DEVICE_STATE_IP_CONFIG) @@ -6195,12 +6189,6 @@ carrier_changed(NMDevice *self, gboolean carrier) * the device. */ nm_device_emit_recheck_auto_activate(self); - } else if (priv->state == NM_DEVICE_STATE_ACTIVATED) { - /* If the device is active without a carrier (probably because it is - * tagged for carrier ignore) ensure that when the carrier appears we - * renew DHCP leases and such. - */ - nm_device_update_dynamic_ip_setup(self); } } else { if (priv->state == NM_DEVICE_STATE_UNAVAILABLE) { @@ -6588,6 +6576,14 @@ device_link_changed(gpointer user_data) if (priv->state >= NM_DEVICE_STATE_IP_CONFIG && priv->state <= NM_DEVICE_STATE_ACTIVATED && !nm_device_sys_iface_state_is_external(self)) nm_device_l3cfg_commit(self, NM_L3_CFG_COMMIT_TYPE_REAPPLY, FALSE); + + /* If the device is active without a carrier (probably because it is + * tagged for carrier ignore) ensure that when the carrier appears we + * renew DHCP leases and such. + */ + if (priv->state == NM_DEVICE_STATE_ACTIVATED) { + nm_device_update_dynamic_ip_setup(self); + } } if (update_unmanaged_specs) @@ -7861,7 +7857,8 @@ nm_device_slave_notify_release(NMDevice *self, NMDeviceStateReason reason) void nm_device_removed(NMDevice *self, gboolean unconfigure_ip_config) { - NMDevicePrivate *priv; + NMDevicePrivate *priv; + const NML3ConfigData *l3cd_old; g_return_if_fail(NM_IS_DEVICE(self)); @@ -7879,6 +7876,18 @@ nm_device_removed(NMDevice *self, gboolean unconfigure_ip_config) } _dev_l3_register_l3cds(self, priv->l3cfg, FALSE, unconfigure_ip_config); + + /* _dev_l3_register_l3cds() schedules a commit, but if the device has + * commit type NONE, that doesn't emit a l3cd-changed. Do it manually, + * to ensure that entries are removed from the DNS manager. */ + if (priv->l3cfg + && NM_IN_SET(priv->sys_iface_state, + NM_DEVICE_SYS_IFACE_STATE_REMOVED, + NM_DEVICE_SYS_IFACE_STATE_EXTERNAL)) { + l3cd_old = nm_l3cfg_get_combined_l3cd(priv->l3cfg, TRUE); + if (l3cd_old) + g_signal_emit(self, signals[L3CD_CHANGED], 0, l3cd_old, NULL); + } } static gboolean @@ -10117,13 +10126,6 @@ _dev_ipdhcpx_start(NMDevice *self, int addr_family) hwaddr = nmp_link_address_get_as_bytes(&pllink->l_address); - if (!IS_IPv4) { - if (!hwaddr) { - fail_reason = "interface has no MAC address to start DHCPv6"; - goto out_fail; - } - } - request_broadcast = FALSE; if (pllink) { str = nmp_object_link_udev_device_get_property_value(NMP_OBJECT_UP_CAST(pllink), @@ -11393,8 +11395,8 @@ _dev_ipac6_start(NMDevice *self) if (node_type == NM_NDISC_NODE_TYPE_ROUTER) _dev_ipac6_set_state(self, NM_DEVICE_IP_STATE_READY); - else - _dev_ipac6_grace_period_start(self, ra_timeout, TRUE); + + _dev_ipac6_grace_period_start(self, ra_timeout, TRUE); nm_ndisc_start(priv->ipac6_data.ndisc); } @@ -11634,7 +11636,7 @@ activate_stage3_ip_config_for_addr_family(NMDevice *self, int addr_family, const priv->ip_data_x[IS_IPv4].wait_for_ports = FALSE; } - if (klass->ready_for_ip_config && !klass->ready_for_ip_config(self)) + if (klass->ready_for_ip_config && !klass->ready_for_ip_config(self, FALSE)) goto out_devip; if (IS_IPv4) { @@ -11898,7 +11900,7 @@ activate_stage3_ip_config(NMDevice *self) } if (!nm_device_sys_iface_state_is_external(self) - && (!klass->ready_for_ip_config || klass->ready_for_ip_config(self))) { + && (!klass->ready_for_ip_config || klass->ready_for_ip_config(self, TRUE))) { if (priv->ipmanual_data.state_6 == NM_DEVICE_IP_STATE_NONE && !NM_IN_STRSET(ipv6_method, NM_SETTING_IP6_CONFIG_METHOD_DISABLED, @@ -12693,6 +12695,16 @@ check_and_reapply_connection(NMDevice *self, if (nm_g_hash_table_lookup(diffs, NM_SETTING_IP6_CONFIG_SETTING_NAME)) priv->ip_data_6.do_reapply = TRUE; + if (nm_g_hash_table_contains_any( + nm_g_hash_table_lookup(diffs, NM_SETTING_CONNECTION_SETTING_NAME), + NM_SETTING_CONNECTION_LLDP, + NM_SETTING_CONNECTION_MDNS, + NM_SETTING_CONNECTION_LLMNR, + NM_SETTING_CONNECTION_DNS_OVER_TLS)) { + priv->ip_data_4.do_reapply = TRUE; + priv->ip_data_6.do_reapply = TRUE; + } + nm_device_activate_schedule_stage3_ip_config(self, FALSE); _routing_rules_sync(self, NM_TERNARY_TRUE); |