diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2022-10-26 06:56:25 +0900 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2022-10-27 09:12:47 +0900 |
commit | 14805b1468dc73bc10d90b69975a5c8914609bb7 (patch) | |
tree | 2a25704e5d27f1db1aa397f0ec6685e6ccdb6fb2 /src/libsystemd-network/dhcp-identifier.h | |
parent | 3b1dbdf0c260cafaf83bfa6ddabaa163c017f5cf (diff) | |
download | systemd-14805b1468dc73bc10d90b69975a5c8914609bb7.tar.gz |
dhcp: use the attached sd_device object when generating IAID
Note, previously `use_mac` set with `test_mode`. As `dev`, which is set with
`client->dev`, is not set when running test or fuzzer. Hence, the condition
```
if (udev_available() && !use_mac)
```
is effectively equivalent to
```
if (dev)
```
So, this commit mostly does not change behavior. Except for the following
corner case.
The sd_device object assigned from networkd (that is, Link.dev) never
has ID_RENAMING udev property, as sd_device objects which has the property
are filtered out at `link_check_initialized()` or `manager_udev_process_link()`
in networkd-link.c.
However, sd_device object created in `dhcp_identifier_set_iaid()` in the
previous code may have it. Such situation may (at least, theoretically)
happen when the network interface is renamed after initialized, e.g. by
creating the following spurious .link file:
```
[Match]
OriginalName=eno1
[Link]
Name=lan
```
and then trigger uevent for the network interface while systemd-networkd
calling `dhcp_identifier_set_iaid()`.
Diffstat (limited to 'src/libsystemd-network/dhcp-identifier.h')
-rw-r--r-- | src/libsystemd-network/dhcp-identifier.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libsystemd-network/dhcp-identifier.h b/src/libsystemd-network/dhcp-identifier.h index 8acb8c3210..523dfc4a71 100644 --- a/src/libsystemd-network/dhcp-identifier.h +++ b/src/libsystemd-network/dhcp-identifier.h @@ -1,6 +1,7 @@ /* SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once +#include "sd-device.h" #include "sd-id128.h" #include "ether-addr-util.h" @@ -66,10 +67,9 @@ int dhcp_identifier_set_duid( struct duid *ret_duid, size_t *ret_len); int dhcp_identifier_set_iaid( - int ifindex, + sd_device *dev, const struct hw_addr_data *hw_addr, bool legacy_unstable_byteorder, - bool use_mac, void *ret); const char *duid_type_to_string(DUIDType t) _const_; |