1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-22 17:35:35 +03:00

network/dhcp: make DUIDType= take an arbitrary integer

Closes #26745.
This commit is contained in:
Yu Watanabe 2023-08-22 14:32:07 +09:00
parent 2da796cabb
commit 80500bb5d4
3 changed files with 13 additions and 4 deletions

View File

@ -127,7 +127,7 @@
<ulink url="https://tools.ietf.org/html/rfc3315#section-9">RFC 3315</ulink>
for a description of all the options.</para>
<para>The following values are understood:
<para>This takes an integer in the range 0…65535, or one of the following string values:
<variablelist>
<varlistentry>
<term><option>vendor</option></term>

View File

@ -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:

View File

@ -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)) {