networkd: Honor configured DHCP ClientIdentifier on link_update (#6622)
We have an embedded board with a couple of ethernet ports. From the kernel log, I can see that the ethernet drivers are obtaining their correct MAC address, but for some reason, at first systemd-networkd doesn't see the mac address for the ethernet port at the time that it looks at dhcp_client_identifier configuration (it has 00:00:00:00:00:00 for mac). Later on, systemd-networkd gets a link_update() call, and at this time, it has the correct mac address for the ethernet port. However, in link_update() the dhcp_client_identifier configuration is not being considered, and a call to sd_dhcp_client_set_iaid_duid() is being done always
This commit is contained in:
parent
30495cb0a7
commit
e4f05508ad
|
@ -3186,8 +3186,6 @@ int link_update(Link *link, sd_netlink_message *m) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (link->dhcp_client) {
|
if (link->dhcp_client) {
|
||||||
const DUID *duid = link_duid(link);
|
|
||||||
|
|
||||||
r = sd_dhcp_client_set_mac(link->dhcp_client,
|
r = sd_dhcp_client_set_mac(link->dhcp_client,
|
||||||
(const uint8_t *) &link->mac,
|
(const uint8_t *) &link->mac,
|
||||||
sizeof (link->mac),
|
sizeof (link->mac),
|
||||||
|
@ -3195,13 +3193,30 @@ int link_update(Link *link, sd_netlink_message *m) {
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_link_warning_errno(link, r, "Could not update MAC address in DHCP client: %m");
|
return log_link_warning_errno(link, r, "Could not update MAC address in DHCP client: %m");
|
||||||
|
|
||||||
r = sd_dhcp_client_set_iaid_duid(link->dhcp_client,
|
switch (link->network->dhcp_client_identifier) {
|
||||||
link->network->iaid,
|
case DHCP_CLIENT_ID_DUID: {
|
||||||
duid->type,
|
const DUID *duid = link_duid(link);
|
||||||
duid->raw_data_len > 0 ? duid->raw_data : NULL,
|
|
||||||
duid->raw_data_len);
|
r = sd_dhcp_client_set_iaid_duid(link->dhcp_client,
|
||||||
if (r < 0)
|
link->network->iaid,
|
||||||
return log_link_warning_errno(link, r, "Could not update DUID/IAID in DHCP client: %m");
|
duid->type,
|
||||||
|
duid->raw_data_len > 0 ? duid->raw_data : NULL,
|
||||||
|
duid->raw_data_len);
|
||||||
|
if (r < 0)
|
||||||
|
return log_link_warning_errno(link, r, "Could not update DUID/IAID in DHCP client: %m");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case DHCP_CLIENT_ID_MAC:
|
||||||
|
r = sd_dhcp_client_set_client_id(link->dhcp_client,
|
||||||
|
ARPHRD_ETHER,
|
||||||
|
(const uint8_t *)&link->mac,
|
||||||
|
sizeof(link->mac));
|
||||||
|
if(r < 0)
|
||||||
|
return log_link_warning_errno(link, r, "Could not update MAC client id in DHCP client: %m");
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
assert_not_reached("Unknown client identifier type.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (link->dhcp6_client) {
|
if (link->dhcp6_client) {
|
||||||
|
|
Loading…
Reference in New Issue