netconfig: Always set DHCP MAC address on start
PATCH 1/1 netconfig: Always set DHCP MAC address on start
l_netconfig_stop() calls l_dhcp_client_stop which does not reset the client MAC address being used. Since the underlying MAC might have changed (for example, due to per-network MAC address generation in iwd), make sure that any subsequent l_netconfig_start() invocations will update the DHCP client MAC. This already happens for DHCPv6, but somehow did not happen for DHCPv4.
--- ell/netconfig.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
ell/netconfig.c +6 -3
@@ -1970,6 +1970,9 @@ LIB_EXPORT bool l_netconfig_start(struct l_netconfig *netconfig)if (!netconfig_check_config (netconfig))return false; +if (!l_net_get_mac_address (netconfig->ifindex, netconfig->mac)) +return false; +if (!netconfig->v4_enabled) goto configure_ipv6;
@@ -1984,6 +1987,9 @@ LIB_EXPORT bool l_netconfig_start(struct l_netconfig *netconfig) goto configure_ipv6; } +l_dhcp_client_set_address (netconfig->dhcp_client,ARPHRD_ETHER , + netconfig->mac,ETH_ALEN ); +if (!l_dhcp_client_start (netconfig->dhcp_client))return false;
@@ -2064,9 +2070,6 @@ configure_ipv6:l_queue_push_tail (addr_wait_list, netconfig); netconfig->have_lla = false; -if (!l_net_get_mac_address (netconfig->ifindex, netconfig->mac)) - goto unregister; -l_dhcp6_client_set_address (netconfig->dhcp6_client,ARPHRD_ETHER , netconfig->mac,ETH_ALEN );l_icmp6_client_set_address (netconfig->icmp6_client, netconfig->mac);
Signature · 1 line
2.42.0
Denis Kenzior
AppliedQuoted 10 lines · Denis Kenzior
l_netconfig_stop()callsl_dhcp_client_stopwhich does not reset the client MAC address being used. Since the underlying MAC might have changed (for example, due to per-network MAC address generation in iwd), make sure that any subsequentl_netconfig_start()invocations will update the DHCP client MAC. This already happens for DHCPv6, but somehow did not happen for DHCPv4.--- ell/netconfig.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
Applied.