1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-23 17:34:00 +03:00

network: dhcp: make IPServiceType= accept "none" to disable tos in the outgoing packet

Fixes #9874.
This commit is contained in:
Yu Watanabe 2021-12-09 20:25:12 +09:00 committed by Zbigniew Jędrzejewski-Szmek
parent 93485626a1
commit b55093ce88
2 changed files with 16 additions and 6 deletions

View File

@ -1550,8 +1550,11 @@ Table=1234</programlisting></para>
<varlistentry>
<term><varname>IPServiceType=</varname></term>
<listitem>
<para>Takes string; <literal>CS6</literal> or <literal>CS4</literal>. Used to set IP
service type to CS6 (network control) or CS4 (Realtime). Defaults to CS6.</para>
<para>Takes one of the special values <literal>none</literal>, <literal>CS6</literal>, or
<literal>CS4</literal>. When <literal>none</literal> no IP sevice type is set to the packet
sent from the DHCPv4 client. When <literal>CS6</literal> (network control) or
<literal>CS4</literal> (realtime), the corresponding service type will be set. Defaults to
<literal>CS6</literal>.</para>
</listitem>
</varlistentry>
<varlistentry>

View File

@ -1704,17 +1704,24 @@ int config_parse_dhcp_ip_service_type(
void *data,
void *userdata) {
int *tos = data;
assert(filename);
assert(lvalue);
assert(rvalue);
assert(data);
if (streq(rvalue, "CS4"))
*((int *)data) = IPTOS_CLASS_CS4;
if (isempty(rvalue))
*tos = -1; /* use sd_dhcp_client's default (currently, CS6). */
else if (streq(rvalue, "none"))
*tos = 0;
else if (streq(rvalue, "CS4"))
*tos = IPTOS_CLASS_CS4;
else if (streq(rvalue, "CS6"))
*((int *)data) = IPTOS_CLASS_CS6;
*tos = IPTOS_CLASS_CS6;
else
log_syntax(unit, LOG_WARNING, filename, line, 0,
"Failed to parse IPServiceType type '%s', ignoring.", rvalue);
"Failed to parse %s=, ignoring assignment: %s", lvalue, rvalue);
return 0;
}