mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-12-22 13:33:56 +03:00
network: configure DHCP clients after MAC address is assigned
Prompted by #20090.
This commit is contained in:
parent
bbe5371345
commit
f42d41cc5f
@ -61,6 +61,13 @@ bool link_dhcp_enabled(Link *link, int family) {
|
||||
if (link->iftype == ARPHRD_CAN)
|
||||
return false;
|
||||
|
||||
if (!IN_SET(link->hw_addr.length, ETH_ALEN, INFINIBAND_ALEN) &&
|
||||
!streq_ptr(link->kind, "wwan"))
|
||||
/* Currently, only interfaces whose MAC address length is ETH_ALEN or INFINIBAND_ALEN
|
||||
* are supported. Note, wwan interfaces may be assigned MAC address slightly later.
|
||||
* Hence, let's wait for a while.*/
|
||||
return false;
|
||||
|
||||
if (!link->network)
|
||||
return false;
|
||||
|
||||
|
@ -1607,6 +1607,11 @@ int request_process_dhcp4_client(Request *req) {
|
||||
if (!IN_SET(link->state, LINK_STATE_CONFIGURING, LINK_STATE_CONFIGURED))
|
||||
return 0;
|
||||
|
||||
if (!IN_SET(link->hw_addr.length, ETH_ALEN, INFINIBAND_ALEN) ||
|
||||
hw_addr_is_null(&link->hw_addr))
|
||||
/* No MAC address is assigned to the hardware, or non-supported MAC address length. */
|
||||
return 0;
|
||||
|
||||
r = dhcp4_configure_duid(link);
|
||||
if (r <= 0)
|
||||
return r;
|
||||
|
@ -711,6 +711,11 @@ int request_process_dhcp6_client(Request *req) {
|
||||
if (!IN_SET(link->state, LINK_STATE_CONFIGURING, LINK_STATE_CONFIGURED))
|
||||
return 0;
|
||||
|
||||
if (!IN_SET(link->hw_addr.length, ETH_ALEN, INFINIBAND_ALEN) ||
|
||||
hw_addr_is_null(&link->hw_addr))
|
||||
/* No MAC address is assigned to the hardware, or non-supported MAC address length. */
|
||||
return 0;
|
||||
|
||||
r = dhcp_configure_duid(link, link_get_dhcp6_duid(link));
|
||||
if (r <= 0)
|
||||
return r;
|
||||
|
Loading…
Reference in New Issue
Block a user