From 8c72f5c0772af5d5b946764ffb286d2d3a80d613 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Wed, 21 Apr 2021 13:21:02 +0900 Subject: [PATCH] network: dhcp: introduce duid_needs_product_uuid() helper function --- src/network/networkd-dhcp-common.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/network/networkd-dhcp-common.c b/src/network/networkd-dhcp-common.c index b311dce4909..dd4956bd5f5 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) { -- 2.47.3