mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-25 17:40:08 +01:00
dhcp: always explicitly set IAID of internal DHCPv6 client
During start, sd_dhcp6_client would call client_ensure_iaid(), to initialize the IAID. First of all, the IAID is important to us, we should not leave the used IAID up to an implementation detail. In the future, we possibly want to make this configurable. The problem is that client_ensure_iaid() calls dhcp_identifier_set_iaid() which looks up the interface name via if_indextoname() (in our fork). The problem is that dhcp_identifier_set_iaid() looks up information by quering the system, which makes it hard for testing and also makes it unpredictable. It's better to use our implementation nm_utils_create_dhcp_iaid(), which is solely based on the interface-name, which is given as a well defined parameter to the DHCP client instance.
This commit is contained in:
parent
0ae18f0680
commit
f2f44a7aca
2 changed files with 12 additions and 2 deletions
|
|
@ -894,6 +894,7 @@ ip6_start (NMDhcpClient *client,
|
|||
nm_auto (sd_dhcp6_client_unrefp) sd_dhcp6_client *sd_client = NULL;
|
||||
GBytes *hwaddr;
|
||||
const char *hostname;
|
||||
const char *iface;
|
||||
int r, i;
|
||||
const guint8 *duid_arr;
|
||||
gsize duid_len;
|
||||
|
|
@ -928,6 +929,17 @@ ip6_start (NMDhcpClient *client,
|
|||
if (nm_dhcp_client_get_info_only (client))
|
||||
sd_dhcp6_client_set_information_request (sd_client, 1);
|
||||
|
||||
iface = nm_dhcp_client_get_iface (client);
|
||||
|
||||
r = sd_dhcp6_client_set_iaid (sd_client,
|
||||
nm_utils_create_dhcp_iaid (TRUE,
|
||||
(const guint8 *) iface,
|
||||
strlen (iface)));
|
||||
if (r < 0) {
|
||||
nm_utils_error_set_errno (error, r, "failed to set IAID: %s");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
r = sd_dhcp6_client_set_duid (sd_client,
|
||||
unaligned_read_be16 (&duid_arr[0]),
|
||||
&duid_arr[2],
|
||||
|
|
|
|||
|
|
@ -262,7 +262,6 @@ int sd_dhcp6_client_set_duid(
|
|||
return dhcp6_client_set_duid_internal(client, duid_type, duid, duid_len, 0);
|
||||
}
|
||||
|
||||
#if 0 /* NM_IGNORED */
|
||||
int sd_dhcp6_client_set_duid_llt(
|
||||
sd_dhcp6_client *client,
|
||||
usec_t llt_time) {
|
||||
|
|
@ -279,7 +278,6 @@ int sd_dhcp6_client_set_iaid(sd_dhcp6_client *client, uint32_t iaid) {
|
|||
|
||||
return 0;
|
||||
}
|
||||
#endif /* NM_IGNORED */
|
||||
|
||||
int sd_dhcp6_client_set_fqdn(
|
||||
sd_dhcp6_client *client,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue