diff options
author | Denis Kenzior <denkenz@gmail.com> | 2023-11-24 10:14:05 -0600 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2023-11-24 12:39:53 -0600 |
commit | 3344aacf69fbe6e766ce0a0a35fa51975c1f52e5 (patch) | |
tree | c1c8a8d116ef5944567b7efc52bcdd1c10584650 | |
parent | 78d68d7dc34c6fd387703d7d20d3cf0e0db0a7ce (diff) |
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.
-rw-r--r-- | ell/netconfig.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/ell/netconfig.c b/ell/netconfig.c index 9b01581f..dc6cb0f6 100644 --- a/ell/netconfig.c +++ b/ell/netconfig.c @@ -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); |