dhcp/nettools: don't clear effective client-id on restart

When ip4_start() is called after a restart (priv->client already exists),
nettools_create() is skipped so effective_client_id stays NULL. The
unconditional nm_dhcp_client_set_effective_client_id() call then clears
the client-id that was properly set during the initial start.

Only update the effective client-id when it was actually obtained from
nettools_create().

Fixes: 1db882ca63 ('dhcp: allow the plugin to be restarted')
This commit is contained in:
Beniamino Galvani 2026-05-30 22:07:45 +02:00
parent b0bdaa29c9
commit 348af3aa30

View file

@ -1525,7 +1525,8 @@ ip4_start(NMDhcpClient *client, GError **error)
_LOGT("dhcp-client4: start " NM_HASH_OBFUSCATE_PTR_FMT, NM_HASH_OBFUSCATE_PTR(priv->client));
nm_dhcp_client_set_effective_client_id(client, effective_client_id);
if (effective_client_id)
nm_dhcp_client_set_effective_client_id(client, effective_client_id);
return TRUE;
}