summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2021-04-21 13:21:02 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2021-04-21 21:00:45 +0900
commit8c72f5c0772af5d5b946764ffb286d2d3a80d613 (patch)
tree0652f46b89e8b8f67ab2d2332cd4d996117f94c0
parent294f129b0d82aed9bb3dc8de0da06b72416fea72 (diff)
downloadsystemd-8c72f5c0772af5d5b946764ffb286d2d3a80d613.tar.gz
network: dhcp: introduce duid_needs_product_uuid() helper function
-rw-r--r--src/network/networkd-dhcp-common.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/network/networkd-dhcp-common.c b/src/network/networkd-dhcp-common.c
index b311dce490..dd4956bd5f 100644
--- a/src/network/networkd-dhcp-common.c
+++ b/src/network/networkd-dhcp-common.c
@@ -63,6 +63,12 @@ void network_adjust_dhcp(Network *network) {
network_adjust_dhcp4(network);
}
+static bool duid_needs_product_uuid(const DUID *duid) {
+ assert(duid);
+
+ return duid->type == DUID_TYPE_UUID && duid->raw_data_len == 0;
+}
+
static struct DUID fallback_duid = { .type = DUID_TYPE_EN };
DUID* link_get_duid(Link *link, int family) {
@@ -218,7 +224,7 @@ int dhcp_configure_duid(Link *link, DUID *duid) {
m = link->manager;
- if (duid->type != DUID_TYPE_UUID || duid->raw_data_len != 0)
+ if (!duid_needs_product_uuid(duid))
return 1;
if (m->has_product_uuid) {