diff --git a/man/networkd.conf.xml b/man/networkd.conf.xml index bf597cac2ec..f25083cc69c 100644 --- a/man/networkd.conf.xml +++ b/man/networkd.conf.xml @@ -127,7 +127,7 @@ RFC 3315 for a description of all the options. - The following values are understood: + This takes an integer in the range 0…65535, or one of the following string values: diff --git a/src/libsystemd-network/dhcp-identifier.h b/src/libsystemd-network/dhcp-identifier.h index efb266ef804..7b36f92e7fa 100644 --- a/src/libsystemd-network/dhcp-identifier.h +++ b/src/libsystemd-network/dhcp-identifier.h @@ -19,6 +19,7 @@ typedef enum DUIDType { DUID_TYPE_UUID = 4, _DUID_TYPE_MAX, _DUID_TYPE_INVALID = -EINVAL, + _DUID_TYPE_FORCE_U16 = UINT16_MAX, } DUIDType; /* RFC 3315 section 9.1: diff --git a/src/network/networkd-dhcp-common.c b/src/network/networkd-dhcp-common.c index 8bd20ea21cb..5b5b251e61e 100644 --- a/src/network/networkd-dhcp-common.c +++ b/src/network/networkd-dhcp-common.c @@ -1154,9 +1154,17 @@ int config_parse_duid_type( type = duid_type_from_string(type_string); if (type < 0) { - log_syntax(unit, LOG_WARNING, filename, line, type, - "Failed to parse DUID type '%s', ignoring.", type_string); - return 0; + uint16_t t; + + r = safe_atou16(type_string, &t); + if (r < 0) { + log_syntax(unit, LOG_WARNING, filename, line, r, + "Failed to parse DUID type '%s', ignoring.", type_string); + return 0; + } + + type = t; + assert(type == t); /* Check if type can store uint16_t. */ } if (!isempty(p)) {