Compare commits
No commits in common. "bba1f90ff598ffa638a9066f0a7934a8f08c41ab" and "57680ddd403530b88c0150642962e222a70e1b2b" have entirely different histories.
bba1f90ff5
...
57680ddd40
|
@ -267,14 +267,6 @@ s - Service VLAN, m - Two-port MAC Relay (TPMR)
|
||||||
Takes interface name or index number.</para></listitem>
|
Takes interface name or index number.</para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term>
|
|
||||||
<command>forcerenew</command>
|
|
||||||
</term>
|
|
||||||
<listitem><para>Send a FORCERENEW message to all connected clients, triggering DHCP reconfiguration.
|
|
||||||
Takes interface name or index number.</para></listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term>
|
<term>
|
||||||
<command>reconfigure</command>
|
<command>reconfigure</command>
|
||||||
|
|
|
@ -61,15 +61,6 @@
|
||||||
<listitem><para>Specifies the time interval to calculate the traffic speed of each interface.
|
<listitem><para>Specifies the time interval to calculate the traffic speed of each interface.
|
||||||
If <varname>SpeedMeter=no</varname>, the value is ignored. Defaults to 10sec.</para></listitem>
|
If <varname>SpeedMeter=no</varname>, the value is ignored. Defaults to 10sec.</para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><varname>ManageForeignRoutes=</varname></term>
|
|
||||||
<listitem><para>A boolean. When true, <command>systemd-networkd</command> will store any routes
|
|
||||||
configured by other tools in its memory. When false, <command>systemd-networkd</command> will
|
|
||||||
not manage the foreign routes, thus they are kept even if <varname>KeepConfiguration=</varname>
|
|
||||||
is false. Defaults to yes.</para></listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
</variablelist>
|
</variablelist>
|
||||||
</refsect1>
|
</refsect1>
|
||||||
|
|
||||||
|
|
|
@ -193,17 +193,11 @@
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><varname>DNSOverTLS=</varname></term>
|
<term><varname>DNSOverTLS=</varname></term>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>Takes a boolean argument or <literal>opportunistic</literal>. If
|
<para>Takes a boolean argument or <literal>opportunistic</literal>.
|
||||||
true all connections to the server will be encrypted. Note that this
|
If true all connections to the server will be encrypted. Note that
|
||||||
mode requires a DNS server that supports DNS-over-TLS and has a valid
|
this mode requires a DNS server that supports DNS-over-TLS and has
|
||||||
certificate. If the hostname was specified in <varname>DNS=</varname>
|
a valid certificate for it's IP. If the DNS server does not support
|
||||||
by using the format format <literal>address#server_name</literal> it
|
DNS-over-TLS all DNS requests will fail. When set to <literal>opportunistic</literal>
|
||||||
is used to validate its certificate and also to enable Server Name
|
|
||||||
Indication (SNI) when opening a TLS connection. Otherwise
|
|
||||||
the certificate is checked against the server's IP.
|
|
||||||
If the DNS server does not support DNS-over-TLS all DNS requests will fail.</para>
|
|
||||||
|
|
||||||
<para>When set to <literal>opportunistic</literal>
|
|
||||||
DNS request are attempted to send encrypted with DNS-over-TLS.
|
DNS request are attempted to send encrypted with DNS-over-TLS.
|
||||||
If the DNS server does not support TLS, DNS-over-TLS is disabled.
|
If the DNS server does not support TLS, DNS-over-TLS is disabled.
|
||||||
Note that this mode makes DNS-over-TLS vulnerable to "downgrade"
|
Note that this mode makes DNS-over-TLS vulnerable to "downgrade"
|
||||||
|
@ -220,6 +214,9 @@
|
||||||
resolver is not capable of authenticating the server, so it is
|
resolver is not capable of authenticating the server, so it is
|
||||||
vulnerable to "man-in-the-middle" attacks.</para>
|
vulnerable to "man-in-the-middle" attacks.</para>
|
||||||
|
|
||||||
|
<para>Server Name Indication (SNI) can be used when opening a TLS connection.
|
||||||
|
Entries in <varname>DNS=</varname> should be in format <literal>address#server_name</literal>.</para>
|
||||||
|
|
||||||
<para>In addition to this global DNSOverTLS setting
|
<para>In addition to this global DNSOverTLS setting
|
||||||
<citerefentry><refentrytitle>systemd-networkd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
|
<citerefentry><refentrytitle>systemd-networkd.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
|
||||||
also maintains per-link DNSOverTLS settings. For system DNS
|
also maintains per-link DNSOverTLS settings. For system DNS
|
||||||
|
|
|
@ -700,30 +700,6 @@
|
||||||
<para>Takes a integer. Specifies the NIC transmit ring buffer size. When unset, the kernel's default will be used.</para>
|
<para>Takes a integer. Specifies the NIC transmit ring buffer size. When unset, the kernel's default will be used.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
<varlistentry>
|
|
||||||
<term><varname>RxFlowControl=</varname></term>
|
|
||||||
<listitem>
|
|
||||||
<para>Takes a boolean. When set, enables the receive flow control, also known as the ethernet
|
|
||||||
receive PAUSE message (generate and send ethernet PAUSE frames). When unset, the kernel's
|
|
||||||
default will be used.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
<varlistentry>
|
|
||||||
<term><varname>TxFlowControl=</varname></term>
|
|
||||||
<listitem>
|
|
||||||
<para>Takes a boolean. When set, enables the transmit flow control, also known as the ethernet
|
|
||||||
transmit PAUSE message (respond to received ethernet PAUSE frames). When unset, the kernel's
|
|
||||||
default will be used.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
<varlistentry>
|
|
||||||
<term><varname>AutoNegotiationFlowControl=</varname></term>
|
|
||||||
<listitem>
|
|
||||||
<para>Takes a boolean. When set, the auto negotiation enables the interface to exchange state
|
|
||||||
advertisements with the connected peer so that the two devices can agree on the ethernet
|
|
||||||
PAUSE configuration. When unset, the kernel's default will be used.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
</variablelist>
|
</variablelist>
|
||||||
</refsect1>
|
</refsect1>
|
||||||
|
|
|
@ -1694,14 +1694,6 @@
|
||||||
a prefix-hint in the DHCPv6 solicitation. Prefix ranges 1-128. Defaults to unset.</para>
|
a prefix-hint in the DHCPv6 solicitation. Prefix ranges 1-128. Defaults to unset.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><varname>WithoutRA=</varname></term>
|
|
||||||
<listitem>
|
|
||||||
<para>When true, DHCPv6 client starts without router advertisements's managed or other address configuration flag.
|
|
||||||
Defaults to false.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
</variablelist>
|
</variablelist>
|
||||||
</refsect1>
|
</refsect1>
|
||||||
|
|
||||||
|
@ -1776,14 +1768,6 @@
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><varname>DHCPv6Client=</varname></term>
|
|
||||||
<listitem>
|
|
||||||
<para>Takes a boolean. When true (the default), the DHCPv6 client will be started when the
|
|
||||||
RA has the managed or other information flag.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
</variablelist>
|
</variablelist>
|
||||||
</refsect1>
|
</refsect1>
|
||||||
|
|
||||||
|
@ -2054,11 +2038,6 @@
|
||||||
to 2592000 seconds (30 days).</para></listitem>
|
to 2592000 seconds (30 days).</para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><varname>Assign=</varname></term>
|
|
||||||
<listitem><para>Takes a boolean. When true, adds an address from the prefix. Default to false.
|
|
||||||
</para></listitem>
|
|
||||||
</varlistentry>
|
|
||||||
</variablelist>
|
</variablelist>
|
||||||
</refsect1>
|
</refsect1>
|
||||||
|
|
||||||
|
@ -2348,9 +2327,7 @@
|
||||||
<term><varname>Parent=</varname></term>
|
<term><varname>Parent=</varname></term>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>Specifies the parent Queueing Discipline (qdisc). Takes one of <literal>root</literal>,
|
<para>Specifies the parent Queueing Discipline (qdisc). Takes one of <literal>root</literal>,
|
||||||
<literal>clsact</literal>, <literal>ingress</literal> or a class id. The class id takes the
|
<literal>clsact</literal> or <literal>ingress</literal>. Defaults to <literal>root</literal>.</para>
|
||||||
major and minor number in hexadecimal ranges 1 to ffff separated with a colon
|
|
||||||
(<literal>major:minor</literal>). Defaults to <literal>root</literal>.</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
@ -2414,9 +2391,7 @@
|
||||||
<term><varname>Parent=</varname></term>
|
<term><varname>Parent=</varname></term>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>Specifies the parent Queueing Discipline (qdisc). Takes one of <literal>root</literal>,
|
<para>Specifies the parent Queueing Discipline (qdisc). Takes one of <literal>root</literal>,
|
||||||
<literal>clsact</literal>, <literal>ingress</literal> or a class id. The class id takes the
|
<literal>clsact</literal> or <literal>ingress</literal>. Defaults to <literal>root</literal>.</para>
|
||||||
major and minor number in hexadecimal ranges 1 to ffff separated with a colon
|
|
||||||
(<literal>major:minor</literal>). Defaults to <literal>root</literal>.</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
@ -2493,38 +2468,6 @@
|
||||||
</variablelist>
|
</variablelist>
|
||||||
</refsect1>
|
</refsect1>
|
||||||
|
|
||||||
<refsect1>
|
|
||||||
<title>[StochasticFairBlue] Section Options</title>
|
|
||||||
<para>The <literal>[StochasticFairBlue]</literal> section manages the queueing discipline
|
|
||||||
(qdisc) of stochastic fair blue (sfb).</para>
|
|
||||||
|
|
||||||
<variablelist class='network-directives'>
|
|
||||||
<varlistentry>
|
|
||||||
<term><varname>Parent=</varname></term>
|
|
||||||
<listitem>
|
|
||||||
<para>Specifies the parent Queueing Discipline (qdisc). Takes one of <literal>root</literal>,
|
|
||||||
<literal>clsact</literal> or <literal>ingress</literal>. Defaults to <literal>root</literal>.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><varname>Handle=</varname></term>
|
|
||||||
<listitem>
|
|
||||||
<para>Specifies the major number of unique identifier of the qdisc, known as the handle.
|
|
||||||
Takes a number in hexadecimal ranges 1 to ffff. Defaults to unset.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><varname>PacketLimit=</varname></term>
|
|
||||||
<listitem>
|
|
||||||
<para>Specifies the hard limit on the queue size in number of packets. When this limit is reached, incoming packets are
|
|
||||||
dropped. An unsigned integer ranges 0 to 4294967294. Defaults to unset and kernel's default is used.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
</variablelist>
|
|
||||||
</refsect1>
|
|
||||||
|
|
||||||
<refsect1>
|
<refsect1>
|
||||||
<title>[StochasticFairnessQueueing] Section Options</title>
|
<title>[StochasticFairnessQueueing] Section Options</title>
|
||||||
<para>The <literal>[StochasticFairnessQueueing]</literal> section manages the queueing discipline
|
<para>The <literal>[StochasticFairnessQueueing]</literal> section manages the queueing discipline
|
||||||
|
@ -2535,9 +2478,7 @@
|
||||||
<term><varname>Parent=</varname></term>
|
<term><varname>Parent=</varname></term>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>Specifies the parent Queueing Discipline (qdisc). Takes one of <literal>root</literal>,
|
<para>Specifies the parent Queueing Discipline (qdisc). Takes one of <literal>root</literal>,
|
||||||
<literal>clsact</literal>, <literal>ingress</literal> or a class id. The class id takes the
|
<literal>clsact</literal> or <literal>ingress</literal>. Defaults to <literal>root</literal>.</para>
|
||||||
major and minor number in hexadecimal ranges 1 to ffff separated with a colon
|
|
||||||
(<literal>major:minor</literal>). Defaults to <literal>root</literal>.</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
@ -2558,82 +2499,6 @@
|
||||||
</variablelist>
|
</variablelist>
|
||||||
</refsect1>
|
</refsect1>
|
||||||
|
|
||||||
<refsect1>
|
|
||||||
<title>[PFIFO] Section Options</title>
|
|
||||||
<para>The <literal>[PFIFO]</literal> section manages the queueing discipline (qdisc) of
|
|
||||||
Packet First In First Out (pfifo).</para>
|
|
||||||
|
|
||||||
<variablelist class='network-directives'>
|
|
||||||
<varlistentry>
|
|
||||||
<term><varname>Parent=</varname></term>
|
|
||||||
<listitem>
|
|
||||||
<para>Specifies the parent Queueing Discipline (qdisc). Takes one of <literal>root</literal>,
|
|
||||||
<literal>clsact</literal> or <literal>ingress</literal>. Defaults to <literal>root</literal>.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><varname>Handle=</varname></term>
|
|
||||||
<listitem>
|
|
||||||
<para>Specifies the major number of unique identifier of the qdisc, known as the handle.
|
|
||||||
Takes a number in hexadecimal ranges 1 to ffff. Defaults to unset.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><varname>PacketLimit=</varname></term>
|
|
||||||
<listitem>
|
|
||||||
<para>Specifies the hard limit on the FIFO size in number of packets. The size limit (a buffer size) to prevent it
|
|
||||||
from overflowing in case it is unable to dequeue packets as quickly as it receives them. When this limit is reached,
|
|
||||||
incoming packets are dropped. An unsigned integer ranges 0 to 4294967294. Defaults to unset and kernel's default is used.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
</variablelist>
|
|
||||||
</refsect1>
|
|
||||||
|
|
||||||
<refsect1>
|
|
||||||
<title>[CAKE] Section Options</title>
|
|
||||||
<para>The <literal>[CAKE]</literal> section manages the queueing discipline (qdisc) of
|
|
||||||
Common Applications Kept Enhanced (CAKE).</para>
|
|
||||||
|
|
||||||
<variablelist class='network-directives'>
|
|
||||||
<varlistentry>
|
|
||||||
<term><varname>Parent=</varname></term>
|
|
||||||
<listitem>
|
|
||||||
<para>Specifies the parent Queueing Discipline (qdisc). Takes one of <literal>root</literal>,
|
|
||||||
<literal>clsact</literal>, <literal>ingress</literal> or a class id. The class id takes the
|
|
||||||
major and minor number in hexadecimal ranges 1 to ffff separated with a colon
|
|
||||||
(<literal>major:minor</literal>). Defaults to <literal>root</literal>.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><varname>Handle=</varname></term>
|
|
||||||
<listitem>
|
|
||||||
<para>Specifies the major number of unique identifier of the qdisc, known as the handle.
|
|
||||||
Takes a number in hexadecimal ranges 1 to ffff. Defaults to unset.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><varname>Overhead=</varname></term>
|
|
||||||
<listitem>
|
|
||||||
<para>Specifies that bytes to be addeded to the size of each packet. Bytes may be negative.
|
|
||||||
Takes an integer ranges -64 to 256. Defaults to unset and kernel's default is used.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><varname>Bandwidth=</varname></term>
|
|
||||||
<listitem>
|
|
||||||
<para>Specifies the shaper bandwidth. When suffixed with K, M, or G, the specified size is
|
|
||||||
parsed as Kilobits, Megabits, or Gigabits, respectively, to the base of 1000. Defaults to
|
|
||||||
unset and kernel's default is used.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
</variablelist>
|
|
||||||
</refsect1>
|
|
||||||
|
|
||||||
<refsect1>
|
<refsect1>
|
||||||
<title>[ControlledDelay] Section Options</title>
|
<title>[ControlledDelay] Section Options</title>
|
||||||
<para>The <literal>[ControlledDelay]</literal> section manages the queueing discipline (qdisc) of
|
<para>The <literal>[ControlledDelay]</literal> section manages the queueing discipline (qdisc) of
|
||||||
|
@ -2644,9 +2509,7 @@
|
||||||
<term><varname>Parent=</varname></term>
|
<term><varname>Parent=</varname></term>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>Specifies the parent Queueing Discipline (qdisc). Takes one of <literal>root</literal>,
|
<para>Specifies the parent Queueing Discipline (qdisc). Takes one of <literal>root</literal>,
|
||||||
<literal>clsact</literal>, <literal>ingress</literal> or a class id. The class id takes the
|
<literal>clsact</literal> or <literal>ingress</literal>. Defaults to <literal>root</literal>.</para>
|
||||||
major and minor number in hexadecimal ranges 1 to ffff separated with a colon
|
|
||||||
(<literal>major:minor</literal>). Defaults to <literal>root</literal>.</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
@ -2700,53 +2563,6 @@
|
||||||
</variablelist>
|
</variablelist>
|
||||||
</refsect1>
|
</refsect1>
|
||||||
|
|
||||||
<refsect1>
|
|
||||||
<title>[GenericRandomEarlyDetection] Section Options</title>
|
|
||||||
<para>The <literal>[GenericRandomEarlyDetection]</literal> section manages the queueing discipline
|
|
||||||
(qdisc) of Generic Random Early Detection (GRED).</para>
|
|
||||||
|
|
||||||
<variablelist class='network-directives'>
|
|
||||||
<varlistentry>
|
|
||||||
<term><varname>Parent=</varname></term>
|
|
||||||
<listitem>
|
|
||||||
<para>Specifies the parent Queueing Discipline (qdisc). Takes one of <literal>root</literal>,
|
|
||||||
<literal>clsact</literal> or <literal>ingress</literal>. Defaults to <literal>root</literal>.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><varname>Handle=</varname></term>
|
|
||||||
<listitem>
|
|
||||||
<para>Specifies the major number of unique identifier of the qdisc, known as the handle.
|
|
||||||
Takes a number in hexadecimal ranges 1 to ffff. Defaults to unset.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><varname>VirtualQueues=</varname></term>
|
|
||||||
<listitem>
|
|
||||||
<para>Specifies the number of virtual queues. Takes a integer in the range 1-16. Defaults to unset and kernel's default is used.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><varname>DefaultVirtualQueue=</varname></term>
|
|
||||||
<listitem>
|
|
||||||
<para>Specifies the number of default virtual queue. This must be less than <varname>VirtualQueue=</varname>.
|
|
||||||
Defaults to unset and kernel's default is used.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><varname>GenericRIO=</varname></term>
|
|
||||||
<listitem>
|
|
||||||
<para>Takes a boolean. It turns on the RIO-like buffering scheme. Defaults to
|
|
||||||
unset and kernel's default is used.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
</variablelist>
|
|
||||||
</refsect1>
|
|
||||||
|
|
||||||
<refsect1>
|
<refsect1>
|
||||||
<title>[FairQueueingControlledDelay] Section Options</title>
|
<title>[FairQueueingControlledDelay] Section Options</title>
|
||||||
<para>The <literal>[FairQueueingControlledDelay]</literal> section manages the queueing discipline
|
<para>The <literal>[FairQueueingControlledDelay]</literal> section manages the queueing discipline
|
||||||
|
@ -2757,9 +2573,7 @@
|
||||||
<term><varname>Parent=</varname></term>
|
<term><varname>Parent=</varname></term>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>Specifies the parent Queueing Discipline (qdisc). Takes one of <literal>root</literal>,
|
<para>Specifies the parent Queueing Discipline (qdisc). Takes one of <literal>root</literal>,
|
||||||
<literal>clsact</literal>, <literal>ingress</literal> or a class id. The class id takes the
|
<literal>clsact</literal> or <literal>ingress</literal>. Defaults to <literal>root</literal>.</para>
|
||||||
major and minor number in hexadecimal ranges 1 to ffff separated with a colon
|
|
||||||
(<literal>major:minor</literal>). Defaults to <literal>root</literal>.</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
@ -2849,9 +2663,7 @@
|
||||||
<term><varname>Parent=</varname></term>
|
<term><varname>Parent=</varname></term>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>Specifies the parent Queueing Discipline (qdisc). Takes one of <literal>root</literal>,
|
<para>Specifies the parent Queueing Discipline (qdisc). Takes one of <literal>root</literal>,
|
||||||
<literal>clsact</literal>, <literal>ingress</literal> or a class id. The class id takes the
|
<literal>clsact</literal> or <literal>ingress</literal>. Defaults to <literal>root</literal>.</para>
|
||||||
major and minor number in hexadecimal ranges 1 to ffff separated with a colon
|
|
||||||
(<literal>major:minor</literal>). Defaults to <literal>root</literal>.</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
@ -2953,9 +2765,7 @@
|
||||||
<term><varname>Parent=</varname></term>
|
<term><varname>Parent=</varname></term>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>Specifies the parent Queueing Discipline (qdisc). Takes one of <literal>root</literal>,
|
<para>Specifies the parent Queueing Discipline (qdisc). Takes one of <literal>root</literal>,
|
||||||
<literal>clsact</literal>, <literal>ingress</literal> or a class id. The class id takes the
|
<literal>clsact</literal> or <literal>ingress</literal>. Defaults to <literal>root</literal>.</para>
|
||||||
major and minor number in hexadecimal ranges 1 to ffff separated with a colon
|
|
||||||
(<literal>major:minor</literal>). Defaults to <literal>root</literal>.</para>
|
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
@ -2979,94 +2789,6 @@
|
||||||
</variablelist>
|
</variablelist>
|
||||||
</refsect1>
|
</refsect1>
|
||||||
|
|
||||||
<refsect1>
|
|
||||||
<title>[HierarchyTokenBucket] Section Options</title>
|
|
||||||
<para>The <literal>[HierarchyTokenBucket]</literal> section manages the queueing discipline (qdisc) of
|
|
||||||
hierarchy token bucket (htb).</para>
|
|
||||||
|
|
||||||
<variablelist class='network-directives'>
|
|
||||||
<varlistentry>
|
|
||||||
<term><varname>Parent=</varname></term>
|
|
||||||
<listitem>
|
|
||||||
<para>Specifies the parent Queueing Discipline (qdisc). Takes one of <literal>root</literal>,
|
|
||||||
<literal>clsact</literal>, <literal>ingress</literal> or a class id. The class id takes the
|
|
||||||
major and minor number in hexadecimal ranges 1 to ffff separated with a colon
|
|
||||||
(<literal>major:minor</literal>). Defaults to <literal>root</literal>.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><varname>Handle=</varname></term>
|
|
||||||
<listitem>
|
|
||||||
<para>Specifies the major number of unique identifier of the qdisc, known as the handle.
|
|
||||||
Takes a number in hexadecimal ranges 1 to ffff. Defaults to unset.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><varname>DefaultClass=</varname></term>
|
|
||||||
<listitem>
|
|
||||||
<para>Takes the minor id in hexadecimal of the default class. Unclassified traffic gets sent
|
|
||||||
to the class. Defaults to unset.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
</variablelist>
|
|
||||||
</refsect1>
|
|
||||||
|
|
||||||
<refsect1>
|
|
||||||
<title>[HierarchyTokenBucketClass] Section Options</title>
|
|
||||||
<para>The <literal>[HierarchyTokenBucketClass]</literal> section manages the traffic control class of
|
|
||||||
hierarchy token bucket (htb).</para>
|
|
||||||
|
|
||||||
<variablelist class='network-directives'>
|
|
||||||
<varlistentry>
|
|
||||||
<term><varname>Parent=</varname></term>
|
|
||||||
<listitem>
|
|
||||||
<para>Specifies the parent Queueing Discipline (qdisc). Takes one of <literal>root</literal>,
|
|
||||||
or a qdisc id. The qdisc id takes the major and minor number in hexadecimal ranges 1 to ffff
|
|
||||||
separated with a colon (<literal>major:minor</literal>). Defaults to <literal>root</literal>.
|
|
||||||
</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><varname>ClassId=</varname></term>
|
|
||||||
<listitem>
|
|
||||||
<para>Specifies the major and minur number of unique identifier of the class, known as the
|
|
||||||
class ID. Each number is in hexadecimal ranges 1 to ffff. Defaults to unset.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><varname>Priority=</varname></term>
|
|
||||||
<listitem>
|
|
||||||
<para>Specifies the priority of the class. In the round-robin process, classes with the lowest
|
|
||||||
priority field are tried for packets first. This setting is mandatory.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><varname>Rate=</varname></term>
|
|
||||||
<listitem>
|
|
||||||
<para>Specifies the maximum rate this class and all its children are guaranteed. When suffixed
|
|
||||||
with K, M, or G, the specified size is parsed as Kilobits, Megabits, or Gigabits, respectively,
|
|
||||||
to the base of 1000. This setting is mandatory.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><varname>CeilRate=</varname></term>
|
|
||||||
<listitem>
|
|
||||||
<para>Specifies the maximum rate at which a class can send, if its parent has bandwidth to spare.
|
|
||||||
When suffixed with K, M, or G, the specified size is parsed as Kilobits, Megabits, or Gigabits,
|
|
||||||
respectively, to the base of 1000. When unset, the value specified with <varname>Rate=</varname>
|
|
||||||
is used.</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
</variablelist>
|
|
||||||
</refsect1>
|
|
||||||
|
|
||||||
<refsect1>
|
<refsect1>
|
||||||
<title>[BridgeVLAN] Section Options</title>
|
<title>[BridgeVLAN] Section Options</title>
|
||||||
<para>The <literal>[BridgeVLAN]</literal> section manages the VLAN ID configuration of a bridge port and accepts
|
<para>The <literal>[BridgeVLAN]</literal> section manages the VLAN ID configuration of a bridge port and accepts
|
||||||
|
|
|
@ -649,17 +649,9 @@
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><varname>$SYSTEMD_UNIT_PATH</varname></term>
|
<term><varname>$SYSTEMD_UNIT_PATH</varname></term>
|
||||||
<term><varname>$SYSTEMD_GENERATOR_PATH</varname></term>
|
|
||||||
<term><varname>$SYSTEMD_ENVIRONMENT_GENERATOR_PATH</varname></term>
|
|
||||||
|
|
||||||
<listitem><para>Controls where systemd looks for unit files and
|
<listitem><para>Controls where systemd looks for unit
|
||||||
generators.</para>
|
files.</para></listitem>
|
||||||
<para>These variables may contain a list of paths, separated by colons
|
|
||||||
(<literal>:</literal>). When set, if the list ends with an empty
|
|
||||||
component (<literal>...:</literal>), this list is prepended to the
|
|
||||||
usual set of of paths. Otherwise, the specified list replaces the usual
|
|
||||||
set of paths.
|
|
||||||
</para></listitem>
|
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
|
|
|
@ -45,13 +45,9 @@ static inline int safe_atoux16(const char *s, uint16_t *ret) {
|
||||||
|
|
||||||
int safe_atoi16(const char *s, int16_t *ret);
|
int safe_atoi16(const char *s, int16_t *ret);
|
||||||
|
|
||||||
static inline int safe_atou32_full(const char *s, unsigned base, uint32_t *ret_u) {
|
|
||||||
assert_cc(sizeof(uint32_t) == sizeof(unsigned));
|
|
||||||
return safe_atou_full(s, base, (unsigned*) ret_u);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int safe_atou32(const char *s, uint32_t *ret_u) {
|
static inline int safe_atou32(const char *s, uint32_t *ret_u) {
|
||||||
return safe_atou32_full(s, 0, (unsigned*) ret_u);
|
assert_cc(sizeof(uint32_t) == sizeof(unsigned));
|
||||||
|
return safe_atou(s, (unsigned*) ret_u);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int safe_atoi32(const char *s, int32_t *ret_i) {
|
static inline int safe_atoi32(const char *s, int32_t *ret_i) {
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
#include <syslog.h>
|
#include <syslog.h>
|
||||||
|
|
||||||
#if HAVE_SELINUX
|
#if HAVE_SELINUX
|
||||||
#include <selinux/avc.h>
|
|
||||||
#include <selinux/context.h>
|
#include <selinux/context.h>
|
||||||
#include <selinux/label.h>
|
#include <selinux/label.h>
|
||||||
#include <selinux/selinux.h>
|
#include <selinux/selinux.h>
|
||||||
|
@ -32,14 +31,11 @@
|
||||||
DEFINE_TRIVIAL_CLEANUP_FUNC(context_t, context_free);
|
DEFINE_TRIVIAL_CLEANUP_FUNC(context_t, context_free);
|
||||||
#define _cleanup_context_free_ _cleanup_(context_freep)
|
#define _cleanup_context_free_ _cleanup_(context_freep)
|
||||||
|
|
||||||
static int mac_selinux_reload(int seqno);
|
|
||||||
|
|
||||||
static int cached_use = -1;
|
static int cached_use = -1;
|
||||||
static int cached_enforcing = -1;
|
|
||||||
static struct selabel_handle *label_hnd = NULL;
|
static struct selabel_handle *label_hnd = NULL;
|
||||||
|
|
||||||
#define log_enforcing(...) log_full(mac_selinux_enforcing() ? LOG_ERR : LOG_WARNING, __VA_ARGS__)
|
#define log_enforcing(...) log_full(security_getenforce() == 1 ? LOG_ERR : LOG_WARNING, __VA_ARGS__)
|
||||||
#define log_enforcing_errno(r, ...) log_full_errno(mac_selinux_enforcing() ? LOG_ERR : LOG_WARNING, r, __VA_ARGS__)
|
#define log_enforcing_errno(r, ...) log_full_errno(security_getenforce() == 1 ? LOG_ERR : LOG_WARNING, r, __VA_ARGS__)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool mac_selinux_use(void) {
|
bool mac_selinux_use(void) {
|
||||||
|
@ -53,37 +49,12 @@ bool mac_selinux_use(void) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool mac_selinux_enforcing(void) {
|
|
||||||
#if HAVE_SELINUX
|
|
||||||
if (cached_enforcing < 0) {
|
|
||||||
cached_enforcing = security_getenforce();
|
|
||||||
if (cached_enforcing == -1) {
|
|
||||||
log_error_errno(errno, "Failed to get SELinux enforced status: %m");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* treat failure as enforced mode */
|
|
||||||
return (cached_enforcing != 0);
|
|
||||||
#else
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void mac_selinux_retest(void) {
|
void mac_selinux_retest(void) {
|
||||||
#if HAVE_SELINUX
|
#if HAVE_SELINUX
|
||||||
cached_use = -1;
|
cached_use = -1;
|
||||||
cached_enforcing = -1;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HAVE_SELINUX
|
|
||||||
static int setenforce_callback(int enforcing) {
|
|
||||||
cached_enforcing = enforcing;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int mac_selinux_init(void) {
|
int mac_selinux_init(void) {
|
||||||
int r = 0;
|
int r = 0;
|
||||||
|
|
||||||
|
@ -91,9 +62,6 @@ int mac_selinux_init(void) {
|
||||||
usec_t before_timestamp, after_timestamp;
|
usec_t before_timestamp, after_timestamp;
|
||||||
struct mallinfo before_mallinfo, after_mallinfo;
|
struct mallinfo before_mallinfo, after_mallinfo;
|
||||||
|
|
||||||
selinux_set_callback(SELINUX_CB_POLICYLOAD, (union selinux_callback) mac_selinux_reload);
|
|
||||||
selinux_set_callback(SELINUX_CB_SETENFORCE, (union selinux_callback) setenforce_callback);
|
|
||||||
|
|
||||||
if (label_hnd)
|
if (label_hnd)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -106,7 +74,7 @@ int mac_selinux_init(void) {
|
||||||
label_hnd = selabel_open(SELABEL_CTX_FILE, NULL, 0);
|
label_hnd = selabel_open(SELABEL_CTX_FILE, NULL, 0);
|
||||||
if (!label_hnd) {
|
if (!label_hnd) {
|
||||||
log_enforcing_errno(errno, "Failed to initialize SELinux context: %m");
|
log_enforcing_errno(errno, "Failed to initialize SELinux context: %m");
|
||||||
r = mac_selinux_enforcing() ? -errno : 0;
|
r = security_getenforce() == 1 ? -errno : 0;
|
||||||
} else {
|
} else {
|
||||||
char timespan[FORMAT_TIMESPAN_MAX];
|
char timespan[FORMAT_TIMESPAN_MAX];
|
||||||
int l;
|
int l;
|
||||||
|
@ -136,12 +104,13 @@ void mac_selinux_finish(void) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void mac_selinux_reload(void) {
|
||||||
|
|
||||||
#if HAVE_SELINUX
|
#if HAVE_SELINUX
|
||||||
static int mac_selinux_reload(int seqno) {
|
|
||||||
struct selabel_handle *backup_label_hnd;
|
struct selabel_handle *backup_label_hnd;
|
||||||
|
|
||||||
if (!label_hnd)
|
if (!label_hnd)
|
||||||
return 0;
|
return;
|
||||||
|
|
||||||
backup_label_hnd = TAKE_PTR(label_hnd);
|
backup_label_hnd = TAKE_PTR(label_hnd);
|
||||||
|
|
||||||
|
@ -152,10 +121,8 @@ static int mac_selinux_reload(int seqno) {
|
||||||
selabel_close(backup_label_hnd);
|
selabel_close(backup_label_hnd);
|
||||||
else
|
else
|
||||||
label_hnd = backup_label_hnd;
|
label_hnd = backup_label_hnd;
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
int mac_selinux_fix(const char *path, LabelFixFlags flags) {
|
int mac_selinux_fix(const char *path, LabelFixFlags flags) {
|
||||||
|
|
||||||
|
@ -184,9 +151,6 @@ int mac_selinux_fix(const char *path, LabelFixFlags flags) {
|
||||||
if (fstat(fd, &st) < 0)
|
if (fstat(fd, &st) < 0)
|
||||||
return -errno;
|
return -errno;
|
||||||
|
|
||||||
/* Check for policy reload so 'label_hnd' is kept up-to-date by callbacks */
|
|
||||||
(void) avc_netlink_check_nb();
|
|
||||||
|
|
||||||
if (selabel_lookup_raw(label_hnd, &fcon, path, st.st_mode) < 0) {
|
if (selabel_lookup_raw(label_hnd, &fcon, path, st.st_mode) < 0) {
|
||||||
r = -errno;
|
r = -errno;
|
||||||
|
|
||||||
|
@ -222,7 +186,7 @@ int mac_selinux_fix(const char *path, LabelFixFlags flags) {
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
log_enforcing_errno(r, "Unable to fix SELinux security context of %s: %m", path);
|
log_enforcing_errno(r, "Unable to fix SELinux security context of %s: %m", path);
|
||||||
if (mac_selinux_enforcing())
|
if (security_getenforce() == 1)
|
||||||
return r;
|
return r;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -240,7 +204,7 @@ int mac_selinux_apply(const char *path, const char *label) {
|
||||||
|
|
||||||
if (setfilecon(path, label) < 0) {
|
if (setfilecon(path, label) < 0) {
|
||||||
log_enforcing_errno(errno, "Failed to set SELinux security context %s on path %s: %m", label, path);
|
log_enforcing_errno(errno, "Failed to set SELinux security context %s on path %s: %m", label, path);
|
||||||
if (mac_selinux_enforcing())
|
if (security_getenforce() > 0)
|
||||||
return -errno;
|
return -errno;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -385,9 +349,6 @@ static int selinux_create_file_prepare_abspath(const char *abspath, mode_t mode)
|
||||||
assert(abspath);
|
assert(abspath);
|
||||||
assert(path_is_absolute(abspath));
|
assert(path_is_absolute(abspath));
|
||||||
|
|
||||||
/* Check for policy reload so 'label_hnd' is kept up-to-date by callbacks */
|
|
||||||
(void) avc_netlink_check_nb();
|
|
||||||
|
|
||||||
r = selabel_lookup_raw(label_hnd, &filecon, abspath, mode);
|
r = selabel_lookup_raw(label_hnd, &filecon, abspath, mode);
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
/* No context specified by the policy? Proceed without setting it. */
|
/* No context specified by the policy? Proceed without setting it. */
|
||||||
|
@ -402,7 +363,7 @@ static int selinux_create_file_prepare_abspath(const char *abspath, mode_t mode)
|
||||||
log_enforcing_errno(errno, "Failed to set SELinux security context %s for %s: %m", filecon, abspath);
|
log_enforcing_errno(errno, "Failed to set SELinux security context %s for %s: %m", filecon, abspath);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mac_selinux_enforcing())
|
if (security_getenforce() > 0)
|
||||||
return -errno;
|
return -errno;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -483,7 +444,7 @@ int mac_selinux_create_socket_prepare(const char *label) {
|
||||||
if (setsockcreatecon(label) < 0) {
|
if (setsockcreatecon(label) < 0) {
|
||||||
log_enforcing_errno(errno, "Failed to set SELinux security context %s for sockets: %m", label);
|
log_enforcing_errno(errno, "Failed to set SELinux security context %s for sockets: %m", label);
|
||||||
|
|
||||||
if (mac_selinux_enforcing())
|
if (security_getenforce() == 1)
|
||||||
return -errno;
|
return -errno;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -536,9 +497,6 @@ int mac_selinux_bind(int fd, const struct sockaddr *addr, socklen_t addrlen) {
|
||||||
|
|
||||||
path = strndupa(un->sun_path, addrlen - offsetof(struct sockaddr_un, sun_path));
|
path = strndupa(un->sun_path, addrlen - offsetof(struct sockaddr_un, sun_path));
|
||||||
|
|
||||||
/* Check for policy reload so 'label_hnd' is kept up-to-date by callbacks */
|
|
||||||
(void) avc_netlink_check_nb();
|
|
||||||
|
|
||||||
if (path_is_absolute(path))
|
if (path_is_absolute(path))
|
||||||
r = selabel_lookup_raw(label_hnd, &fcon, path, S_IFSOCK);
|
r = selabel_lookup_raw(label_hnd, &fcon, path, S_IFSOCK);
|
||||||
else {
|
else {
|
||||||
|
@ -557,13 +515,13 @@ int mac_selinux_bind(int fd, const struct sockaddr *addr, socklen_t addrlen) {
|
||||||
goto skipped;
|
goto skipped;
|
||||||
|
|
||||||
log_enforcing_errno(errno, "Failed to determine SELinux security context for %s: %m", path);
|
log_enforcing_errno(errno, "Failed to determine SELinux security context for %s: %m", path);
|
||||||
if (mac_selinux_enforcing())
|
if (security_getenforce() > 0)
|
||||||
return -errno;
|
return -errno;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (setfscreatecon_raw(fcon) < 0) {
|
if (setfscreatecon_raw(fcon) < 0) {
|
||||||
log_enforcing_errno(errno, "Failed to set SELinux security context %s for %s: %m", fcon, path);
|
log_enforcing_errno(errno, "Failed to set SELinux security context %s for %s: %m", fcon, path);
|
||||||
if (mac_selinux_enforcing())
|
if (security_getenforce() > 0)
|
||||||
return -errno;
|
return -errno;
|
||||||
} else
|
} else
|
||||||
context_changed = true;
|
context_changed = true;
|
||||||
|
|
|
@ -16,11 +16,11 @@ DEFINE_TRIVIAL_CLEANUP_FUNC(char*, freecon);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool mac_selinux_use(void);
|
bool mac_selinux_use(void);
|
||||||
bool mac_selinux_enforcing(void);
|
|
||||||
void mac_selinux_retest(void);
|
void mac_selinux_retest(void);
|
||||||
|
|
||||||
int mac_selinux_init(void);
|
int mac_selinux_init(void);
|
||||||
void mac_selinux_finish(void);
|
void mac_selinux_finish(void);
|
||||||
|
void mac_selinux_reload(void);
|
||||||
|
|
||||||
int mac_selinux_fix(const char *path, LabelFixFlags flags);
|
int mac_selinux_fix(const char *path, LabelFixFlags flags);
|
||||||
int mac_selinux_apply(const char *path, const char *label);
|
int mac_selinux_apply(const char *path, const char *label);
|
||||||
|
|
|
@ -678,8 +678,8 @@ static int lookup_block_device(const char *p, dev_t *ret) {
|
||||||
return log_warning_errno(r, "Failed to determine block device backing btrfs file system '%s': %m", p);
|
return log_warning_errno(r, "Failed to determine block device backing btrfs file system '%s': %m", p);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If this is a LUKS/DM device, recursively try to get the originating block device */
|
/* If this is a LUKS device, try to get the originating block device */
|
||||||
while (block_get_originating(*ret, ret) > 0);
|
(void) block_get_originating(*ret, ret);
|
||||||
|
|
||||||
/* If this is a partition, try to get the originating block device */
|
/* If this is a partition, try to get the originating block device */
|
||||||
(void) block_get_whole_disk(*ret, ret);
|
(void) block_get_whole_disk(*ret, ret);
|
||||||
|
|
|
@ -1747,6 +1747,8 @@ static int invoke_main_loop(
|
||||||
saved_log_level = m->log_level_overridden ? log_get_max_level() : -1;
|
saved_log_level = m->log_level_overridden ? log_get_max_level() : -1;
|
||||||
saved_log_target = m->log_target_overridden ? log_get_target() : _LOG_TARGET_INVALID;
|
saved_log_target = m->log_target_overridden ? log_get_target() : _LOG_TARGET_INVALID;
|
||||||
|
|
||||||
|
mac_selinux_reload();
|
||||||
|
|
||||||
(void) parse_configuration(saved_rlimit_nofile, saved_rlimit_memlock);
|
(void) parse_configuration(saved_rlimit_nofile, saved_rlimit_memlock);
|
||||||
|
|
||||||
set_manager_defaults(m);
|
set_manager_defaults(m);
|
||||||
|
|
|
@ -3826,9 +3826,25 @@ static bool generator_path_any(const char* const* paths) {
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char *const system_env_generator_binary_paths[] = {
|
||||||
|
"/run/systemd/system-environment-generators",
|
||||||
|
"/etc/systemd/system-environment-generators",
|
||||||
|
"/usr/local/lib/systemd/system-environment-generators",
|
||||||
|
SYSTEM_ENV_GENERATOR_PATH,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
static const char *const user_env_generator_binary_paths[] = {
|
||||||
|
"/run/systemd/user-environment-generators",
|
||||||
|
"/etc/systemd/user-environment-generators",
|
||||||
|
"/usr/local/lib/systemd/user-environment-generators",
|
||||||
|
USER_ENV_GENERATOR_PATH,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
static int manager_run_environment_generators(Manager *m) {
|
static int manager_run_environment_generators(Manager *m) {
|
||||||
char **tmp = NULL; /* this is only used in the forked process, no cleanup here */
|
char **tmp = NULL; /* this is only used in the forked process, no cleanup here */
|
||||||
_cleanup_strv_free_ char **paths = NULL;
|
const char *const *paths;
|
||||||
void* args[] = {
|
void* args[] = {
|
||||||
[STDOUT_GENERATE] = &tmp,
|
[STDOUT_GENERATE] = &tmp,
|
||||||
[STDOUT_COLLECT] = &tmp,
|
[STDOUT_COLLECT] = &tmp,
|
||||||
|
@ -3839,15 +3855,13 @@ static int manager_run_environment_generators(Manager *m) {
|
||||||
if (MANAGER_IS_TEST_RUN(m) && !(m->test_run_flags & MANAGER_TEST_RUN_ENV_GENERATORS))
|
if (MANAGER_IS_TEST_RUN(m) && !(m->test_run_flags & MANAGER_TEST_RUN_ENV_GENERATORS))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
paths = env_generator_binary_paths(MANAGER_IS_SYSTEM(m));
|
paths = MANAGER_IS_SYSTEM(m) ? system_env_generator_binary_paths : user_env_generator_binary_paths;
|
||||||
if (!paths)
|
|
||||||
return log_oom();
|
|
||||||
|
|
||||||
if (!generator_path_any((const char* const*) paths))
|
if (!generator_path_any(paths))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
RUN_WITH_UMASK(0022)
|
RUN_WITH_UMASK(0022)
|
||||||
r = execute_directories((const char* const*) paths, DEFAULT_TIMEOUT_USEC, gather_environment,
|
r = execute_directories(paths, DEFAULT_TIMEOUT_USEC, gather_environment,
|
||||||
args, NULL, m->transient_environment, EXEC_DIR_PARALLEL | EXEC_DIR_IGNORE_ERRORS);
|
args, NULL, m->transient_environment, EXEC_DIR_PARALLEL | EXEC_DIR_IGNORE_ERRORS);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
|
@ -143,16 +143,16 @@ static int access_init(sd_bus_error *error) {
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
if (avc_open(NULL, 0) != 0) {
|
if (avc_open(NULL, 0) != 0) {
|
||||||
int saved_errno = errno;
|
int enforce, saved_errno = errno;
|
||||||
const bool enforce = mac_selinux_enforcing();
|
|
||||||
|
|
||||||
log_full_errno(enforce ? LOG_ERR : LOG_WARNING, saved_errno, "Failed to open the SELinux AVC: %m");
|
enforce = security_getenforce();
|
||||||
|
log_full_errno(enforce != 0 ? LOG_ERR : LOG_WARNING, saved_errno, "Failed to open the SELinux AVC: %m");
|
||||||
|
|
||||||
/* If enforcement isn't on, then let's suppress this
|
/* If enforcement isn't on, then let's suppress this
|
||||||
* error, and just don't do any AVC checks. The
|
* error, and just don't do any AVC checks. The
|
||||||
* warning we printed is hence all the admin will
|
* warning we printed is hence all the admin will
|
||||||
* see. */
|
* see. */
|
||||||
if (!enforce)
|
if (enforce == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Return an access denied error, if we couldn't load
|
/* Return an access denied error, if we couldn't load
|
||||||
|
@ -185,7 +185,7 @@ int mac_selinux_generic_access_check(
|
||||||
_cleanup_free_ char *cl = NULL;
|
_cleanup_free_ char *cl = NULL;
|
||||||
_cleanup_freecon_ char *fcon = NULL;
|
_cleanup_freecon_ char *fcon = NULL;
|
||||||
char **cmdline = NULL;
|
char **cmdline = NULL;
|
||||||
const bool enforce = mac_selinux_enforcing();
|
bool enforce = false; /* Will be set to the real value later if needed */
|
||||||
int r = 0;
|
int r = 0;
|
||||||
|
|
||||||
assert(message);
|
assert(message);
|
||||||
|
@ -223,6 +223,7 @@ int mac_selinux_generic_access_check(
|
||||||
|
|
||||||
if (getfilecon_raw(path, &fcon) < 0) {
|
if (getfilecon_raw(path, &fcon) < 0) {
|
||||||
r = -errno;
|
r = -errno;
|
||||||
|
enforce = security_getenforce() > 0;
|
||||||
|
|
||||||
log_warning_errno(r, "SELinux getfilecon_raw on '%s' failed%s (perm=%s): %m",
|
log_warning_errno(r, "SELinux getfilecon_raw on '%s' failed%s (perm=%s): %m",
|
||||||
path,
|
path,
|
||||||
|
@ -239,6 +240,7 @@ int mac_selinux_generic_access_check(
|
||||||
} else {
|
} else {
|
||||||
if (getcon_raw(&fcon) < 0) {
|
if (getcon_raw(&fcon) < 0) {
|
||||||
r = -errno;
|
r = -errno;
|
||||||
|
enforce = security_getenforce() > 0;
|
||||||
|
|
||||||
log_warning_errno(r, "SELinux getcon_raw failed%s (perm=%s): %m",
|
log_warning_errno(r, "SELinux getcon_raw failed%s (perm=%s): %m",
|
||||||
enforce ? "" : ", ignoring",
|
enforce ? "" : ", ignoring",
|
||||||
|
@ -264,6 +266,7 @@ int mac_selinux_generic_access_check(
|
||||||
r = selinux_check_access(scon, fcon, tclass, permission, &audit_info);
|
r = selinux_check_access(scon, fcon, tclass, permission, &audit_info);
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
r = errno_or_else(EPERM);
|
r = errno_or_else(EPERM);
|
||||||
|
enforce = security_getenforce() > 0;
|
||||||
|
|
||||||
if (enforce)
|
if (enforce)
|
||||||
sd_bus_error_setf(error, SD_BUS_ERROR_ACCESS_DENIED, "SELinux policy denies access.");
|
sd_bus_error_setf(error, SD_BUS_ERROR_ACCESS_DENIED, "SELinux policy denies access.");
|
||||||
|
|
|
@ -829,18 +829,6 @@ _public_ int sd_radv_prefix_set_prefix(sd_radv_prefix *p, const struct in6_addr
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
_public_ int sd_radv_prefix_get_prefix(sd_radv_prefix *p, struct in6_addr *ret_in6_addr,
|
|
||||||
unsigned char *ret_prefixlen) {
|
|
||||||
assert_return(p, -EINVAL);
|
|
||||||
assert_return(ret_in6_addr, -EINVAL);
|
|
||||||
assert_return(ret_prefixlen, -EINVAL);
|
|
||||||
|
|
||||||
*ret_in6_addr = p->opt.in6_addr;
|
|
||||||
*ret_prefixlen = p->opt.prefixlen;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
_public_ int sd_radv_prefix_set_onlink(sd_radv_prefix *p, int onlink) {
|
_public_ int sd_radv_prefix_set_onlink(sd_radv_prefix *p, int onlink) {
|
||||||
assert_return(p, -EINVAL);
|
assert_return(p, -EINVAL);
|
||||||
|
|
||||||
|
|
|
@ -343,74 +343,6 @@ int sd_netlink_message_append_u64(sd_netlink_message *m, unsigned short type, ui
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sd_netlink_message_append_s8(sd_netlink_message *m, unsigned short type, int8_t data) {
|
|
||||||
int r;
|
|
||||||
|
|
||||||
assert_return(m, -EINVAL);
|
|
||||||
assert_return(!m->sealed, -EPERM);
|
|
||||||
|
|
||||||
r = message_attribute_has_type(m, NULL, type, NETLINK_TYPE_S8);
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
|
|
||||||
r = add_rtattr(m, type, &data, sizeof(int8_t));
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int sd_netlink_message_append_s16(sd_netlink_message *m, unsigned short type, int16_t data) {
|
|
||||||
int r;
|
|
||||||
|
|
||||||
assert_return(m, -EINVAL);
|
|
||||||
assert_return(!m->sealed, -EPERM);
|
|
||||||
|
|
||||||
r = message_attribute_has_type(m, NULL, type, NETLINK_TYPE_S16);
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
|
|
||||||
r = add_rtattr(m, type, &data, sizeof(int16_t));
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int sd_netlink_message_append_s32(sd_netlink_message *m, unsigned short type, int32_t data) {
|
|
||||||
int r;
|
|
||||||
|
|
||||||
assert_return(m, -EINVAL);
|
|
||||||
assert_return(!m->sealed, -EPERM);
|
|
||||||
|
|
||||||
r = message_attribute_has_type(m, NULL, type, NETLINK_TYPE_S32);
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
|
|
||||||
r = add_rtattr(m, type, &data, sizeof(int32_t));
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int sd_netlink_message_append_s64(sd_netlink_message *m, unsigned short type, int64_t data) {
|
|
||||||
int r;
|
|
||||||
|
|
||||||
assert_return(m, -EINVAL);
|
|
||||||
assert_return(!m->sealed, -EPERM);
|
|
||||||
|
|
||||||
r = message_attribute_has_type(m, NULL, type, NETLINK_TYPE_S64);
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
|
|
||||||
r = add_rtattr(m, type, &data, sizeof(int64_t));
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int sd_netlink_message_append_data(sd_netlink_message *m, unsigned short type, const void *data, size_t len) {
|
int sd_netlink_message_append_data(sd_netlink_message *m, unsigned short type, const void *data, size_t len) {
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
|
|
|
@ -745,12 +745,6 @@ static const NLTypeSystem rtnl_nexthop_type_system = {
|
||||||
.types = rtnl_nexthop_types,
|
.types = rtnl_nexthop_types,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const NLType rtnl_tca_option_data_cake_types[] = {
|
|
||||||
[TCA_CAKE_BASE_RATE64] = { .type = NETLINK_TYPE_U64 },
|
|
||||||
[TCA_CAKE_OVERHEAD] = { .type = NETLINK_TYPE_S32 },
|
|
||||||
[TCA_CAKE_MPU] = { .type = NETLINK_TYPE_U32 },
|
|
||||||
};
|
|
||||||
|
|
||||||
static const NLType rtnl_tca_option_data_codel_types[] = {
|
static const NLType rtnl_tca_option_data_codel_types[] = {
|
||||||
[TCA_CODEL_TARGET] = { .type = NETLINK_TYPE_U32 },
|
[TCA_CODEL_TARGET] = { .type = NETLINK_TYPE_U32 },
|
||||||
[TCA_CODEL_LIMIT] = { .type = NETLINK_TYPE_U32 },
|
[TCA_CODEL_LIMIT] = { .type = NETLINK_TYPE_U32 },
|
||||||
|
@ -786,23 +780,6 @@ static const NLType rtnl_tca_option_data_fq_codel_types[] = {
|
||||||
[TCA_FQ_CODEL_MEMORY_LIMIT] = { .type = NETLINK_TYPE_U32 },
|
[TCA_FQ_CODEL_MEMORY_LIMIT] = { .type = NETLINK_TYPE_U32 },
|
||||||
};
|
};
|
||||||
|
|
||||||
static const NLType rtnl_tca_option_data_gred_types[] = {
|
|
||||||
[TCA_GRED_DPS] = { .size = sizeof(struct tc_gred_sopt) },
|
|
||||||
};
|
|
||||||
|
|
||||||
static const NLType rtnl_tca_option_data_htb_types[] = {
|
|
||||||
[TCA_HTB_PARMS] = { .size = sizeof(struct tc_htb_opt) },
|
|
||||||
[TCA_HTB_INIT] = { .size = sizeof(struct tc_htb_glob) },
|
|
||||||
[TCA_HTB_CTAB] = { .size = TC_RTAB_SIZE },
|
|
||||||
[TCA_HTB_RTAB] = { .size = TC_RTAB_SIZE },
|
|
||||||
[TCA_HTB_RATE64] = { .type = NETLINK_TYPE_U64 },
|
|
||||||
[TCA_HTB_CEIL64] = { .type = NETLINK_TYPE_U64 },
|
|
||||||
};
|
|
||||||
|
|
||||||
static const NLType rtnl_tca_option_data_sfb_types[] = {
|
|
||||||
[TCA_SFB_PARMS] = { .size = sizeof(struct tc_sfb_qopt) },
|
|
||||||
};
|
|
||||||
|
|
||||||
static const NLType rtnl_tca_option_data_tbf_types[] = {
|
static const NLType rtnl_tca_option_data_tbf_types[] = {
|
||||||
[TCA_TBF_PARMS] = { .size = sizeof(struct tc_tbf_qopt) },
|
[TCA_TBF_PARMS] = { .size = sizeof(struct tc_tbf_qopt) },
|
||||||
[TCA_TBF_RTAB] = { .size = TC_RTAB_SIZE },
|
[TCA_TBF_RTAB] = { .size = TC_RTAB_SIZE },
|
||||||
|
@ -814,33 +791,21 @@ static const NLType rtnl_tca_option_data_tbf_types[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char* const nl_union_tca_option_data_table[] = {
|
static const char* const nl_union_tca_option_data_table[] = {
|
||||||
[NL_UNION_TCA_OPTION_DATA_CAKE] = "cake",
|
|
||||||
[NL_UNION_TCA_OPTION_DATA_CODEL] = "codel",
|
[NL_UNION_TCA_OPTION_DATA_CODEL] = "codel",
|
||||||
[NL_UNION_TCA_OPTION_DATA_FQ] = "fq",
|
[NL_UNION_TCA_OPTION_DATA_FQ] = "fq",
|
||||||
[NL_UNION_TCA_OPTION_DATA_FQ_CODEL] = "fq_codel",
|
[NL_UNION_TCA_OPTION_DATA_FQ_CODEL] = "fq_codel",
|
||||||
[NL_UNION_TCA_OPTION_DATA_GRED] = "gred",
|
|
||||||
[NL_UNION_TCA_OPTION_DATA_HTB] = "htb",
|
|
||||||
[NL_UNION_TCA_OPTION_DATA_SFB] = "sfb",
|
|
||||||
[NL_UNION_TCA_OPTION_DATA_TBF] = "tbf",
|
[NL_UNION_TCA_OPTION_DATA_TBF] = "tbf",
|
||||||
};
|
};
|
||||||
|
|
||||||
DEFINE_STRING_TABLE_LOOKUP(nl_union_tca_option_data, NLUnionTCAOptionData);
|
DEFINE_STRING_TABLE_LOOKUP(nl_union_tca_option_data, NLUnionTCAOptionData);
|
||||||
|
|
||||||
static const NLTypeSystem rtnl_tca_option_data_type_systems[] = {
|
static const NLTypeSystem rtnl_tca_option_data_type_systems[] = {
|
||||||
[NL_UNION_TCA_OPTION_DATA_CAKE] = { .count = ELEMENTSOF(rtnl_tca_option_data_cake_types),
|
|
||||||
.types = rtnl_tca_option_data_cake_types },
|
|
||||||
[NL_UNION_TCA_OPTION_DATA_CODEL] = { .count = ELEMENTSOF(rtnl_tca_option_data_codel_types),
|
[NL_UNION_TCA_OPTION_DATA_CODEL] = { .count = ELEMENTSOF(rtnl_tca_option_data_codel_types),
|
||||||
.types = rtnl_tca_option_data_codel_types },
|
.types = rtnl_tca_option_data_codel_types },
|
||||||
[NL_UNION_TCA_OPTION_DATA_FQ] = { .count = ELEMENTSOF(rtnl_tca_option_data_fq_types),
|
[NL_UNION_TCA_OPTION_DATA_FQ] = { .count = ELEMENTSOF(rtnl_tca_option_data_fq_types),
|
||||||
.types = rtnl_tca_option_data_fq_types },
|
.types = rtnl_tca_option_data_fq_types },
|
||||||
[NL_UNION_TCA_OPTION_DATA_FQ_CODEL] = { .count = ELEMENTSOF(rtnl_tca_option_data_fq_codel_types),
|
[NL_UNION_TCA_OPTION_DATA_FQ_CODEL] = { .count = ELEMENTSOF(rtnl_tca_option_data_fq_codel_types),
|
||||||
.types = rtnl_tca_option_data_fq_codel_types },
|
.types = rtnl_tca_option_data_fq_codel_types },
|
||||||
[NL_UNION_TCA_OPTION_DATA_GRED] = { .count = ELEMENTSOF(rtnl_tca_option_data_gred_types),
|
|
||||||
.types = rtnl_tca_option_data_gred_types },
|
|
||||||
[NL_UNION_TCA_OPTION_DATA_HTB] = { .count = ELEMENTSOF(rtnl_tca_option_data_htb_types),
|
|
||||||
.types = rtnl_tca_option_data_htb_types },
|
|
||||||
[NL_UNION_TCA_OPTION_DATA_SFB] = { .count = ELEMENTSOF(rtnl_tca_option_data_sfb_types),
|
|
||||||
.types = rtnl_tca_option_data_sfb_types },
|
|
||||||
[NL_UNION_TCA_OPTION_DATA_TBF] = { .count = ELEMENTSOF(rtnl_tca_option_data_tbf_types),
|
[NL_UNION_TCA_OPTION_DATA_TBF] = { .count = ELEMENTSOF(rtnl_tca_option_data_tbf_types),
|
||||||
.types = rtnl_tca_option_data_tbf_types },
|
.types = rtnl_tca_option_data_tbf_types },
|
||||||
};
|
};
|
||||||
|
@ -853,16 +818,16 @@ static const NLTypeSystemUnion rtnl_tca_option_data_type_system_union = {
|
||||||
.match = TCA_KIND,
|
.match = TCA_KIND,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const NLType rtnl_tca_types[] = {
|
static const NLType rtnl_qdisc_types[] = {
|
||||||
[TCA_KIND] = { .type = NETLINK_TYPE_STRING },
|
[TCA_KIND] = { .type = NETLINK_TYPE_STRING },
|
||||||
[TCA_OPTIONS] = { .type = NETLINK_TYPE_UNION, .type_system_union = &rtnl_tca_option_data_type_system_union },
|
[TCA_OPTIONS] = { .type = NETLINK_TYPE_UNION, .type_system_union = &rtnl_tca_option_data_type_system_union },
|
||||||
[TCA_INGRESS_BLOCK] = { .type = NETLINK_TYPE_U32 },
|
[TCA_INGRESS_BLOCK] = { .type = NETLINK_TYPE_U32 },
|
||||||
[TCA_EGRESS_BLOCK] = { .type = NETLINK_TYPE_U32 },
|
[TCA_EGRESS_BLOCK] = { .type = NETLINK_TYPE_U32 },
|
||||||
};
|
};
|
||||||
|
|
||||||
static const NLTypeSystem rtnl_tca_type_system = {
|
static const NLTypeSystem rtnl_qdisc_type_system = {
|
||||||
.count = ELEMENTSOF(rtnl_tca_types),
|
.count = ELEMENTSOF(rtnl_qdisc_types),
|
||||||
.types = rtnl_tca_types,
|
.types = rtnl_qdisc_types,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const NLType error_types[] = {
|
static const NLType error_types[] = {
|
||||||
|
@ -903,12 +868,9 @@ static const NLType rtnl_types[] = {
|
||||||
[RTM_NEWNEXTHOP] = { .type = NETLINK_TYPE_NESTED, .type_system = &rtnl_nexthop_type_system, .size = sizeof(struct nhmsg) },
|
[RTM_NEWNEXTHOP] = { .type = NETLINK_TYPE_NESTED, .type_system = &rtnl_nexthop_type_system, .size = sizeof(struct nhmsg) },
|
||||||
[RTM_DELNEXTHOP] = { .type = NETLINK_TYPE_NESTED, .type_system = &rtnl_nexthop_type_system, .size = sizeof(struct nhmsg) },
|
[RTM_DELNEXTHOP] = { .type = NETLINK_TYPE_NESTED, .type_system = &rtnl_nexthop_type_system, .size = sizeof(struct nhmsg) },
|
||||||
[RTM_GETNEXTHOP] = { .type = NETLINK_TYPE_NESTED, .type_system = &rtnl_nexthop_type_system, .size = sizeof(struct nhmsg) },
|
[RTM_GETNEXTHOP] = { .type = NETLINK_TYPE_NESTED, .type_system = &rtnl_nexthop_type_system, .size = sizeof(struct nhmsg) },
|
||||||
[RTM_NEWQDISC] = { .type = NETLINK_TYPE_NESTED, .type_system = &rtnl_tca_type_system, .size = sizeof(struct tcmsg) },
|
[RTM_NEWQDISC] = { .type = NETLINK_TYPE_NESTED, .type_system = &rtnl_qdisc_type_system, .size = sizeof(struct tcmsg) },
|
||||||
[RTM_DELQDISC] = { .type = NETLINK_TYPE_NESTED, .type_system = &rtnl_tca_type_system, .size = sizeof(struct tcmsg) },
|
[RTM_DELQDISC] = { .type = NETLINK_TYPE_NESTED, .type_system = &rtnl_qdisc_type_system, .size = sizeof(struct tcmsg) },
|
||||||
[RTM_GETQDISC] = { .type = NETLINK_TYPE_NESTED, .type_system = &rtnl_tca_type_system, .size = sizeof(struct tcmsg) },
|
[RTM_GETQDISC] = { .type = NETLINK_TYPE_NESTED, .type_system = &rtnl_qdisc_type_system, .size = sizeof(struct tcmsg) },
|
||||||
[RTM_NEWTCLASS] = { .type = NETLINK_TYPE_NESTED, .type_system = &rtnl_tca_type_system, .size = sizeof(struct tcmsg) },
|
|
||||||
[RTM_DELTCLASS] = { .type = NETLINK_TYPE_NESTED, .type_system = &rtnl_tca_type_system, .size = sizeof(struct tcmsg) },
|
|
||||||
[RTM_GETTCLASS] = { .type = NETLINK_TYPE_NESTED, .type_system = &rtnl_tca_type_system, .size = sizeof(struct tcmsg) },
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const NLTypeSystem rtnl_type_system_root = {
|
const NLTypeSystem rtnl_type_system_root = {
|
||||||
|
|
|
@ -9,10 +9,6 @@ enum {
|
||||||
NETLINK_TYPE_U16, /* NLA_U16 */
|
NETLINK_TYPE_U16, /* NLA_U16 */
|
||||||
NETLINK_TYPE_U32, /* NLA_U32 */
|
NETLINK_TYPE_U32, /* NLA_U32 */
|
||||||
NETLINK_TYPE_U64, /* NLA_U64 */
|
NETLINK_TYPE_U64, /* NLA_U64 */
|
||||||
NETLINK_TYPE_S8, /* NLA_S8 */
|
|
||||||
NETLINK_TYPE_S16, /* NLA_S16 */
|
|
||||||
NETLINK_TYPE_S32, /* NLA_S32 */
|
|
||||||
NETLINK_TYPE_S64, /* NLA_S64 */
|
|
||||||
NETLINK_TYPE_STRING, /* NLA_STRING */
|
NETLINK_TYPE_STRING, /* NLA_STRING */
|
||||||
NETLINK_TYPE_FLAG, /* NLA_FLAG */
|
NETLINK_TYPE_FLAG, /* NLA_FLAG */
|
||||||
NETLINK_TYPE_IN_ADDR,
|
NETLINK_TYPE_IN_ADDR,
|
||||||
|
@ -96,13 +92,9 @@ const char *nl_union_link_info_data_to_string(NLUnionLinkInfoData p) _const_;
|
||||||
NLUnionLinkInfoData nl_union_link_info_data_from_string(const char *p) _pure_;
|
NLUnionLinkInfoData nl_union_link_info_data_from_string(const char *p) _pure_;
|
||||||
|
|
||||||
typedef enum NLUnionTCAOptionData {
|
typedef enum NLUnionTCAOptionData {
|
||||||
NL_UNION_TCA_OPTION_DATA_CAKE,
|
|
||||||
NL_UNION_TCA_OPTION_DATA_CODEL,
|
NL_UNION_TCA_OPTION_DATA_CODEL,
|
||||||
NL_UNION_TCA_OPTION_DATA_FQ,
|
NL_UNION_TCA_OPTION_DATA_FQ,
|
||||||
NL_UNION_TCA_OPTION_DATA_FQ_CODEL,
|
NL_UNION_TCA_OPTION_DATA_FQ_CODEL,
|
||||||
NL_UNION_TCA_OPTION_DATA_GRED,
|
|
||||||
NL_UNION_TCA_OPTION_DATA_HTB,
|
|
||||||
NL_UNION_TCA_OPTION_DATA_SFB,
|
|
||||||
NL_UNION_TCA_OPTION_DATA_TBF,
|
NL_UNION_TCA_OPTION_DATA_TBF,
|
||||||
_NL_UNION_TCA_OPTION_DATA_MAX,
|
_NL_UNION_TCA_OPTION_DATA_MAX,
|
||||||
_NL_UNION_TCA_OPTION_DATA_INVALID = -1,
|
_NL_UNION_TCA_OPTION_DATA_INVALID = -1,
|
||||||
|
|
|
@ -47,10 +47,6 @@ static inline bool rtnl_message_type_is_qdisc(uint16_t type) {
|
||||||
return IN_SET(type, RTM_NEWQDISC, RTM_DELQDISC, RTM_GETQDISC);
|
return IN_SET(type, RTM_NEWQDISC, RTM_DELQDISC, RTM_GETQDISC);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool rtnl_message_type_is_tclass(uint16_t type) {
|
|
||||||
return IN_SET(type, RTM_NEWTCLASS, RTM_DELTCLASS, RTM_GETTCLASS);
|
|
||||||
}
|
|
||||||
|
|
||||||
int rtnl_set_link_name(sd_netlink **rtnl, int ifindex, const char *name);
|
int rtnl_set_link_name(sd_netlink **rtnl, int ifindex, const char *name);
|
||||||
int rtnl_set_link_properties(sd_netlink **rtnl, int ifindex, const char *alias, const struct ether_addr *mac, uint32_t mtu);
|
int rtnl_set_link_properties(sd_netlink **rtnl, int ifindex, const char *alias, const struct ether_addr *mac, uint32_t mtu);
|
||||||
int rtnl_set_link_alternative_names(sd_netlink **rtnl, int ifindex, char * const *alternative_names);
|
int rtnl_set_link_alternative_names(sd_netlink **rtnl, int ifindex, char * const *alternative_names);
|
||||||
|
|
|
@ -1077,46 +1077,3 @@ int sd_rtnl_message_set_qdisc_handle(sd_netlink_message *m, uint32_t handle) {
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sd_rtnl_message_new_tclass(sd_netlink *rtnl, sd_netlink_message **ret, uint16_t nlmsg_type, int tcm_family, int tcm_ifindex) {
|
|
||||||
struct tcmsg *tcm;
|
|
||||||
int r;
|
|
||||||
|
|
||||||
assert_return(rtnl_message_type_is_tclass(nlmsg_type), -EINVAL);
|
|
||||||
assert_return(ret, -EINVAL);
|
|
||||||
|
|
||||||
r = message_new(rtnl, ret, nlmsg_type);
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
|
|
||||||
if (nlmsg_type == RTM_NEWTCLASS)
|
|
||||||
(*ret)->hdr->nlmsg_flags |= NLM_F_CREATE | NLM_F_EXCL;
|
|
||||||
|
|
||||||
tcm = NLMSG_DATA((*ret)->hdr);
|
|
||||||
tcm->tcm_family = tcm_family;
|
|
||||||
tcm->tcm_ifindex = tcm_ifindex;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int sd_rtnl_message_set_tclass_parent(sd_netlink_message *m, uint32_t parent) {
|
|
||||||
struct tcmsg *tcm;
|
|
||||||
|
|
||||||
assert_return(rtnl_message_type_is_tclass(m->hdr->nlmsg_type), -EINVAL);
|
|
||||||
|
|
||||||
tcm = NLMSG_DATA(m->hdr);
|
|
||||||
tcm->tcm_parent = parent;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int sd_rtnl_message_set_tclass_handle(sd_netlink_message *m, uint32_t handle) {
|
|
||||||
struct tcmsg *tcm;
|
|
||||||
|
|
||||||
assert_return(rtnl_message_type_is_tclass(m->hdr->nlmsg_type), -EINVAL);
|
|
||||||
|
|
||||||
tcm = NLMSG_DATA(m->hdr);
|
|
||||||
tcm->tcm_handle = handle;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
|
@ -107,36 +107,22 @@ sources = files('''
|
||||||
networkd-util.h
|
networkd-util.h
|
||||||
networkd-wifi.c
|
networkd-wifi.c
|
||||||
networkd-wifi.h
|
networkd-wifi.h
|
||||||
tc/cake.c
|
|
||||||
tc/cake.h
|
|
||||||
tc/codel.c
|
tc/codel.c
|
||||||
tc/codel.h
|
tc/codel.h
|
||||||
tc/fifo.c
|
|
||||||
tc/fifo.h
|
|
||||||
tc/fq.c
|
tc/fq.c
|
||||||
tc/fq.h
|
tc/fq.h
|
||||||
tc/fq-codel.c
|
tc/fq-codel.c
|
||||||
tc/fq-codel.h
|
tc/fq-codel.h
|
||||||
tc/gred.c
|
|
||||||
tc/gred.h
|
|
||||||
tc/htb.c
|
|
||||||
tc/htb.h
|
|
||||||
tc/netem.c
|
tc/netem.c
|
||||||
tc/netem.h
|
tc/netem.h
|
||||||
tc/qdisc.c
|
tc/qdisc.c
|
||||||
tc/qdisc.h
|
tc/qdisc.h
|
||||||
tc/sfb.c
|
|
||||||
tc/sfb.h
|
|
||||||
tc/sfq.c
|
tc/sfq.c
|
||||||
tc/sfq.h
|
tc/sfq.h
|
||||||
tc/tbf.c
|
tc/tbf.c
|
||||||
tc/tbf.h
|
tc/tbf.h
|
||||||
tc/tc-util.c
|
tc/tc-util.c
|
||||||
tc/tc-util.h
|
tc/tc-util.h
|
||||||
tc/tc.c
|
|
||||||
tc/tc.h
|
|
||||||
tc/tclass.c
|
|
||||||
tc/tclass.h
|
|
||||||
tc/teql.c
|
tc/teql.c
|
||||||
tc/teql.h
|
tc/teql.h
|
||||||
'''.split())
|
'''.split())
|
||||||
|
|
|
@ -1943,48 +1943,6 @@ static int link_renew(int argc, char *argv[], void *userdata) {
|
||||||
return k;
|
return k;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int link_force_renew_one(sd_bus *bus, int index, const char *name) {
|
|
||||||
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
|
|
||||||
int r;
|
|
||||||
|
|
||||||
r = sd_bus_call_method(
|
|
||||||
bus,
|
|
||||||
"org.freedesktop.network1",
|
|
||||||
"/org/freedesktop/network1",
|
|
||||||
"org.freedesktop.network1.Manager",
|
|
||||||
"ForceRenewLink",
|
|
||||||
&error,
|
|
||||||
NULL,
|
|
||||||
"i", index);
|
|
||||||
if (r < 0)
|
|
||||||
return log_error_errno(r, "Failed to force renew dynamic configuration of interface %s: %s",
|
|
||||||
name, bus_error_message(&error, r));
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int link_force_renew(int argc, char *argv[], void *userdata) {
|
|
||||||
_cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
|
|
||||||
_cleanup_(sd_netlink_unrefp) sd_netlink *rtnl = NULL;
|
|
||||||
int index, i, k = 0, r;
|
|
||||||
|
|
||||||
r = sd_bus_open_system(&bus);
|
|
||||||
if (r < 0)
|
|
||||||
return log_error_errno(r, "Failed to connect system bus: %m");
|
|
||||||
|
|
||||||
for (i = 1; i < argc; i++) {
|
|
||||||
index = resolve_interface_or_warn(&rtnl, argv[i]);
|
|
||||||
if (index < 0)
|
|
||||||
return index;
|
|
||||||
|
|
||||||
r = link_force_renew_one(bus, index, argv[i]);
|
|
||||||
if (r < 0 && k >= 0)
|
|
||||||
k = r;
|
|
||||||
}
|
|
||||||
|
|
||||||
return k;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int verb_reload(int argc, char *argv[], void *userdata) {
|
static int verb_reload(int argc, char *argv[], void *userdata) {
|
||||||
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
|
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
|
||||||
_cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
|
_cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL;
|
||||||
|
@ -2071,7 +2029,6 @@ static int help(void) {
|
||||||
" label Show current address label entries in the kernel\n"
|
" label Show current address label entries in the kernel\n"
|
||||||
" delete DEVICES... Delete virtual netdevs\n"
|
" delete DEVICES... Delete virtual netdevs\n"
|
||||||
" renew DEVICES... Renew dynamic configurations\n"
|
" renew DEVICES... Renew dynamic configurations\n"
|
||||||
" forcerenew DEVICES... Trigger DHCP reconfiguration of all connected clients\n"
|
|
||||||
" reconfigure DEVICES... Reconfigure interfaces\n"
|
" reconfigure DEVICES... Reconfigure interfaces\n"
|
||||||
" reload Reload .network and .netdev files\n"
|
" reload Reload .network and .netdev files\n"
|
||||||
"\nOptions:\n"
|
"\nOptions:\n"
|
||||||
|
@ -2173,7 +2130,6 @@ static int networkctl_main(int argc, char *argv[]) {
|
||||||
{ "label", VERB_ANY, VERB_ANY, 0, list_address_labels },
|
{ "label", VERB_ANY, VERB_ANY, 0, list_address_labels },
|
||||||
{ "delete", 2, VERB_ANY, 0, link_delete },
|
{ "delete", 2, VERB_ANY, 0, link_delete },
|
||||||
{ "renew", 2, VERB_ANY, 0, link_renew },
|
{ "renew", 2, VERB_ANY, 0, link_renew },
|
||||||
{ "forcerenew", 2, VERB_ANY, 0, link_force_renew },
|
|
||||||
{ "reconfigure", 2, VERB_ANY, 0, verb_reconfigure },
|
{ "reconfigure", 2, VERB_ANY, 0, verb_reconfigure },
|
||||||
{ "reload", 1, 1, 0, verb_reload },
|
{ "reload", 1, 1, 0, verb_reload },
|
||||||
{}
|
{}
|
||||||
|
|
|
@ -20,24 +20,6 @@
|
||||||
#define ADDRESSES_PER_LINK_MAX 2048U
|
#define ADDRESSES_PER_LINK_MAX 2048U
|
||||||
#define STATIC_ADDRESSES_PER_NETWORK_MAX 1024U
|
#define STATIC_ADDRESSES_PER_NETWORK_MAX 1024U
|
||||||
|
|
||||||
int generate_ipv6_eui_64_address(Link *link, struct in6_addr *ret) {
|
|
||||||
assert(link);
|
|
||||||
assert(ret);
|
|
||||||
|
|
||||||
/* see RFC4291 section 2.5.1 */
|
|
||||||
ret->s6_addr[8] = link->mac.ether_addr_octet[0];
|
|
||||||
ret->s6_addr[8] ^= 1 << 1;
|
|
||||||
ret->s6_addr[9] = link->mac.ether_addr_octet[1];
|
|
||||||
ret->s6_addr[10] = link->mac.ether_addr_octet[2];
|
|
||||||
ret->s6_addr[11] = 0xff;
|
|
||||||
ret->s6_addr[12] = 0xfe;
|
|
||||||
ret->s6_addr[13] = link->mac.ether_addr_octet[3];
|
|
||||||
ret->s6_addr[14] = link->mac.ether_addr_octet[4];
|
|
||||||
ret->s6_addr[15] = link->mac.ether_addr_octet[5];
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int address_new(Address **ret) {
|
int address_new(Address **ret) {
|
||||||
_cleanup_(address_freep) Address *address = NULL;
|
_cleanup_(address_freep) Address *address = NULL;
|
||||||
|
|
||||||
|
|
|
@ -66,8 +66,6 @@ bool address_is_ready(const Address *a);
|
||||||
int address_section_verify(Address *a);
|
int address_section_verify(Address *a);
|
||||||
int configure_ipv4_duplicate_address_detection(Link *link, Address *address);
|
int configure_ipv4_duplicate_address_detection(Link *link, Address *address);
|
||||||
|
|
||||||
int generate_ipv6_eui_64_address(Link *link, struct in6_addr *ret);
|
|
||||||
|
|
||||||
DEFINE_NETWORK_SECTION_FUNCTIONS(Address, address_free);
|
DEFINE_NETWORK_SECTION_FUNCTIONS(Address, address_free);
|
||||||
|
|
||||||
extern const struct hash_ops address_hash_ops;
|
extern const struct hash_ops address_hash_ops;
|
||||||
|
|
|
@ -20,6 +20,5 @@ struct ConfigPerfItem;
|
||||||
%%
|
%%
|
||||||
Network.SpeedMeter, config_parse_bool, 0, offsetof(Manager, use_speed_meter)
|
Network.SpeedMeter, config_parse_bool, 0, offsetof(Manager, use_speed_meter)
|
||||||
Network.SpeedMeterIntervalSec, config_parse_sec, 0, offsetof(Manager, speed_meter_interval_usec)
|
Network.SpeedMeterIntervalSec, config_parse_sec, 0, offsetof(Manager, speed_meter_interval_usec)
|
||||||
Network.ManageForeignRoutes, config_parse_bool, 0, offsetof(Manager, manage_foreign_routes)
|
|
||||||
DHCP.DUIDType, config_parse_duid_type, 0, offsetof(Manager, duid)
|
DHCP.DUIDType, config_parse_duid_type, 0, offsetof(Manager, duid)
|
||||||
DHCP.DUIDRawData, config_parse_duid_rawdata, 0, offsetof(Manager, duid)
|
DHCP.DUIDRawData, config_parse_duid_rawdata, 0, offsetof(Manager, duid)
|
||||||
|
|
|
@ -572,35 +572,6 @@ int bus_link_method_revert_dns(sd_bus_message *message, void *userdata, sd_bus_e
|
||||||
return sd_bus_reply_method_return(message, NULL);
|
return sd_bus_reply_method_return(message, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
int bus_link_method_force_renew(sd_bus_message *message, void *userdata, sd_bus_error *error) {
|
|
||||||
Link *l = userdata;
|
|
||||||
int r;
|
|
||||||
|
|
||||||
assert(l);
|
|
||||||
|
|
||||||
if (!l->network)
|
|
||||||
return sd_bus_error_setf(error, BUS_ERROR_UNMANAGED_INTERFACE,
|
|
||||||
"Interface %s is not managed by systemd-networkd",
|
|
||||||
l->ifname);
|
|
||||||
|
|
||||||
r = bus_verify_polkit_async(message, CAP_NET_ADMIN,
|
|
||||||
"org.freedesktop.network1.forcerenew",
|
|
||||||
NULL, true, UID_INVALID,
|
|
||||||
&l->manager->polkit_registry, error);
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
if (r == 0)
|
|
||||||
return 1; /* Polkit will call us back */
|
|
||||||
|
|
||||||
if (l->dhcp_server) {
|
|
||||||
r = sd_dhcp_server_forcerenew(l->dhcp_server);
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
return sd_bus_reply_method_return(message, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
int bus_link_method_renew(sd_bus_message *message, void *userdata, sd_bus_error *error) {
|
int bus_link_method_renew(sd_bus_message *message, void *userdata, sd_bus_error *error) {
|
||||||
Link *l = userdata;
|
Link *l = userdata;
|
||||||
int r;
|
int r;
|
||||||
|
@ -680,7 +651,6 @@ const sd_bus_vtable link_vtable[] = {
|
||||||
SD_BUS_METHOD("RevertNTP", NULL, NULL, bus_link_method_revert_ntp, SD_BUS_VTABLE_UNPRIVILEGED),
|
SD_BUS_METHOD("RevertNTP", NULL, NULL, bus_link_method_revert_ntp, SD_BUS_VTABLE_UNPRIVILEGED),
|
||||||
SD_BUS_METHOD("RevertDNS", NULL, NULL, bus_link_method_revert_dns, SD_BUS_VTABLE_UNPRIVILEGED),
|
SD_BUS_METHOD("RevertDNS", NULL, NULL, bus_link_method_revert_dns, SD_BUS_VTABLE_UNPRIVILEGED),
|
||||||
SD_BUS_METHOD("Renew", NULL, NULL, bus_link_method_renew, SD_BUS_VTABLE_UNPRIVILEGED),
|
SD_BUS_METHOD("Renew", NULL, NULL, bus_link_method_renew, SD_BUS_VTABLE_UNPRIVILEGED),
|
||||||
SD_BUS_METHOD("ForceRenew", NULL, NULL, bus_link_method_force_renew, SD_BUS_VTABLE_UNPRIVILEGED),
|
|
||||||
SD_BUS_METHOD("Reconfigure", NULL, NULL, bus_link_method_reconfigure, SD_BUS_VTABLE_UNPRIVILEGED),
|
SD_BUS_METHOD("Reconfigure", NULL, NULL, bus_link_method_reconfigure, SD_BUS_VTABLE_UNPRIVILEGED),
|
||||||
|
|
||||||
SD_BUS_VTABLE_END
|
SD_BUS_VTABLE_END
|
||||||
|
|
|
@ -31,5 +31,4 @@ int bus_link_method_set_dnssec_negative_trust_anchors(sd_bus_message *message, v
|
||||||
int bus_link_method_revert_ntp(sd_bus_message *message, void *userdata, sd_bus_error *error);
|
int bus_link_method_revert_ntp(sd_bus_message *message, void *userdata, sd_bus_error *error);
|
||||||
int bus_link_method_revert_dns(sd_bus_message *message, void *userdata, sd_bus_error *error);
|
int bus_link_method_revert_dns(sd_bus_message *message, void *userdata, sd_bus_error *error);
|
||||||
int bus_link_method_renew(sd_bus_message *message, void *userdata, sd_bus_error *error);
|
int bus_link_method_renew(sd_bus_message *message, void *userdata, sd_bus_error *error);
|
||||||
int bus_link_method_force_renew(sd_bus_message *message, void *userdata, sd_bus_error *error);
|
|
||||||
int bus_link_method_reconfigure(sd_bus_message *message, void *userdata, sd_bus_error *error);
|
int bus_link_method_reconfigure(sd_bus_message *message, void *userdata, sd_bus_error *error);
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
#include "networkd-radv.h"
|
#include "networkd-radv.h"
|
||||||
#include "networkd-routing-policy-rule.h"
|
#include "networkd-routing-policy-rule.h"
|
||||||
#include "networkd-wifi.h"
|
#include "networkd-wifi.h"
|
||||||
|
#include "qdisc.h"
|
||||||
#include "set.h"
|
#include "set.h"
|
||||||
#include "socket-util.h"
|
#include "socket-util.h"
|
||||||
#include "stat-util.h"
|
#include "stat-util.h"
|
||||||
|
@ -41,7 +42,6 @@
|
||||||
#include "string-table.h"
|
#include "string-table.h"
|
||||||
#include "strv.h"
|
#include "strv.h"
|
||||||
#include "sysctl-util.h"
|
#include "sysctl-util.h"
|
||||||
#include "tc.h"
|
|
||||||
#include "tmpfile-util.h"
|
#include "tmpfile-util.h"
|
||||||
#include "udev-util.h"
|
#include "udev-util.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
@ -1116,7 +1116,7 @@ void link_check_ready(Link *link) {
|
||||||
if (!link->routing_policy_rules_configured)
|
if (!link->routing_policy_rules_configured)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!link->tc_configured)
|
if (!link->qdiscs_configured)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (link_has_carrier(link) || !link->network->configure_without_carrier) {
|
if (link_has_carrier(link) || !link->network->configure_without_carrier) {
|
||||||
|
@ -1222,7 +1222,6 @@ static int link_set_bridge_fdb(Link *link) {
|
||||||
static int link_request_set_addresses(Link *link) {
|
static int link_request_set_addresses(Link *link) {
|
||||||
AddressLabel *label;
|
AddressLabel *label;
|
||||||
Address *ad;
|
Address *ad;
|
||||||
Prefix *p;
|
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
assert(link);
|
assert(link);
|
||||||
|
@ -1258,35 +1257,6 @@ static int link_request_set_addresses(Link *link) {
|
||||||
link->address_messages++;
|
link->address_messages++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IN_SET(link->network->router_prefix_delegation,
|
|
||||||
RADV_PREFIX_DELEGATION_STATIC,
|
|
||||||
RADV_PREFIX_DELEGATION_BOTH))
|
|
||||||
LIST_FOREACH(prefixes, p, link->network->static_prefixes) {
|
|
||||||
_cleanup_(address_freep) Address *address = NULL;
|
|
||||||
|
|
||||||
if (!p->assign)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
r = address_new(&address);
|
|
||||||
if (r < 0)
|
|
||||||
return log_link_error_errno(link, r, "Could not allocate address: %m");
|
|
||||||
|
|
||||||
r = sd_radv_prefix_get_prefix(p->radv_prefix, &address->in_addr.in6, &address->prefixlen);
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
|
|
||||||
r = generate_ipv6_eui_64_address(link, &address->in_addr.in6);
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
|
|
||||||
address->family = AF_INET6;
|
|
||||||
r = address_configure(address, link, address_handler, true);
|
|
||||||
if (r < 0)
|
|
||||||
return log_link_warning_errno(link, r, "Could not set addresses: %m");
|
|
||||||
if (r > 0)
|
|
||||||
link->address_messages++;
|
|
||||||
}
|
|
||||||
|
|
||||||
LIST_FOREACH(labels, label, link->network->address_labels) {
|
LIST_FOREACH(labels, label, link->network->address_labels) {
|
||||||
r = address_label_configure(label, link, NULL, false);
|
r = address_label_configure(label, link, NULL, false);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
|
@ -1553,17 +1523,6 @@ static int link_acquire_ipv6_conf(Link *link) {
|
||||||
return log_link_warning_errno(link, r, "Could not start IPv6 Router Advertisement: %m");
|
return log_link_warning_errno(link, r, "Could not start IPv6 Router Advertisement: %m");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (link_dhcp6_enabled(link) && link->network->dhcp6_without_ra) {
|
|
||||||
assert(link->dhcp6_client);
|
|
||||||
assert(in_addr_is_link_local(AF_INET6, (const union in_addr_union*)&link->ipv6ll_address) > 0);
|
|
||||||
|
|
||||||
r = dhcp6_request_address(link, true);
|
|
||||||
if (r < 0 && r != -EBUSY)
|
|
||||||
return log_link_warning_errno(link, r, "Could not acquire DHCPv6 lease: %m");
|
|
||||||
else
|
|
||||||
log_link_debug(link, "Acquiring DHCPv6 lease");
|
|
||||||
}
|
|
||||||
|
|
||||||
(void) dhcp6_request_prefix_delegation(link);
|
(void) dhcp6_request_prefix_delegation(link);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -2743,24 +2702,24 @@ static int link_configure_ipv4_dad(Link *link) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int link_configure_traffic_control(Link *link) {
|
static int link_configure_qdiscs(Link *link) {
|
||||||
TrafficControl *tc;
|
QDisc *qdisc;
|
||||||
Iterator i;
|
Iterator i;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
link->tc_configured = false;
|
link->qdiscs_configured = false;
|
||||||
link->tc_messages = 0;
|
link->qdisc_messages = 0;
|
||||||
|
|
||||||
ORDERED_HASHMAP_FOREACH(tc, link->network->tc_by_section, i) {
|
ORDERED_HASHMAP_FOREACH(qdisc, link->network->qdiscs_by_section, i) {
|
||||||
r = traffic_control_configure(link, tc);
|
r = qdisc_configure(link, qdisc);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (link->tc_messages == 0)
|
if (link->qdisc_messages == 0)
|
||||||
link->tc_configured = true;
|
link->qdiscs_configured = true;
|
||||||
else
|
else
|
||||||
log_link_debug(link, "Configuring traffic control");
|
log_link_debug(link, "Configuring queuing discipline (qdisc)");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -2772,7 +2731,7 @@ static int link_configure(Link *link) {
|
||||||
assert(link->network);
|
assert(link->network);
|
||||||
assert(link->state == LINK_STATE_INITIALIZED);
|
assert(link->state == LINK_STATE_INITIALIZED);
|
||||||
|
|
||||||
r = link_configure_traffic_control(link);
|
r = link_configure_qdiscs(link);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ typedef struct Link {
|
||||||
unsigned nexthop_messages;
|
unsigned nexthop_messages;
|
||||||
unsigned routing_policy_rule_messages;
|
unsigned routing_policy_rule_messages;
|
||||||
unsigned routing_policy_rule_remove_messages;
|
unsigned routing_policy_rule_remove_messages;
|
||||||
unsigned tc_messages;
|
unsigned qdisc_messages;
|
||||||
unsigned enslaving;
|
unsigned enslaving;
|
||||||
|
|
||||||
Set *addresses;
|
Set *addresses;
|
||||||
|
@ -116,7 +116,7 @@ typedef struct Link {
|
||||||
bool static_routes_ready:1;
|
bool static_routes_ready:1;
|
||||||
bool static_nexthops_configured:1;
|
bool static_nexthops_configured:1;
|
||||||
bool routing_policy_rules_configured:1;
|
bool routing_policy_rules_configured:1;
|
||||||
bool tc_configured:1;
|
bool qdiscs_configured:1;
|
||||||
bool setting_mtu:1;
|
bool setting_mtu:1;
|
||||||
bool setting_genmode:1;
|
bool setting_genmode:1;
|
||||||
bool ipv6_mtu_set:1;
|
bool ipv6_mtu_set:1;
|
||||||
|
|
|
@ -191,10 +191,6 @@ static int bus_method_renew_link(sd_bus_message *message, void *userdata, sd_bus
|
||||||
return call_link_method(userdata, message, bus_link_method_renew, error);
|
return call_link_method(userdata, message, bus_link_method_renew, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int bus_method_force_renew_link(sd_bus_message *message, void *userdata, sd_bus_error *error) {
|
|
||||||
return call_link_method(userdata, message, bus_link_method_force_renew, error);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int bus_method_reconfigure_link(sd_bus_message *message, void *userdata, sd_bus_error *error) {
|
static int bus_method_reconfigure_link(sd_bus_message *message, void *userdata, sd_bus_error *error) {
|
||||||
return call_link_method(userdata, message, bus_link_method_reconfigure, error);
|
return call_link_method(userdata, message, bus_link_method_reconfigure, error);
|
||||||
}
|
}
|
||||||
|
@ -253,7 +249,6 @@ const sd_bus_vtable manager_vtable[] = {
|
||||||
SD_BUS_METHOD("RevertLinkNTP", "i", NULL, bus_method_revert_link_ntp, SD_BUS_VTABLE_UNPRIVILEGED),
|
SD_BUS_METHOD("RevertLinkNTP", "i", NULL, bus_method_revert_link_ntp, SD_BUS_VTABLE_UNPRIVILEGED),
|
||||||
SD_BUS_METHOD("RevertLinkDNS", "i", NULL, bus_method_revert_link_dns, SD_BUS_VTABLE_UNPRIVILEGED),
|
SD_BUS_METHOD("RevertLinkDNS", "i", NULL, bus_method_revert_link_dns, SD_BUS_VTABLE_UNPRIVILEGED),
|
||||||
SD_BUS_METHOD("RenewLink", "i", NULL, bus_method_renew_link, SD_BUS_VTABLE_UNPRIVILEGED),
|
SD_BUS_METHOD("RenewLink", "i", NULL, bus_method_renew_link, SD_BUS_VTABLE_UNPRIVILEGED),
|
||||||
SD_BUS_METHOD("ForceRenewLink", "i", NULL, bus_method_force_renew_link, SD_BUS_VTABLE_UNPRIVILEGED),
|
|
||||||
SD_BUS_METHOD("ReconfigureLink", "i", NULL, bus_method_reconfigure_link, SD_BUS_VTABLE_UNPRIVILEGED),
|
SD_BUS_METHOD("ReconfigureLink", "i", NULL, bus_method_reconfigure_link, SD_BUS_VTABLE_UNPRIVILEGED),
|
||||||
SD_BUS_METHOD("Reload", NULL, NULL, bus_method_reload, SD_BUS_VTABLE_UNPRIVILEGED),
|
SD_BUS_METHOD("Reload", NULL, NULL, bus_method_reload, SD_BUS_VTABLE_UNPRIVILEGED),
|
||||||
|
|
||||||
|
|
|
@ -494,8 +494,7 @@ int manager_rtnl_process_route(sd_netlink *rtnl, sd_netlink_message *message, vo
|
||||||
|
|
||||||
log_link_debug(link,
|
log_link_debug(link,
|
||||||
"%s route: dst: %s%s, src: %s, gw: %s, prefsrc: %s, scope: %s, table: %s, proto: %s, type: %s",
|
"%s route: dst: %s%s, src: %s, gw: %s, prefsrc: %s, scope: %s, table: %s, proto: %s, type: %s",
|
||||||
(!route && !link->manager->manage_foreign_routes) || type == RTM_DELROUTE ? "Forgetting" :
|
type == RTM_DELROUTE ? "Forgetting" : route ? "Received remembered" : "Remembering",
|
||||||
route ? "Received remembered" : "Remembering",
|
|
||||||
strna(buf_dst), strempty(buf_dst_prefixlen),
|
strna(buf_dst), strempty(buf_dst_prefixlen),
|
||||||
strna(buf_src), strna(buf_gw), strna(buf_prefsrc),
|
strna(buf_src), strna(buf_gw), strna(buf_prefsrc),
|
||||||
format_route_scope(tmp->scope, buf_scope, sizeof buf_scope),
|
format_route_scope(tmp->scope, buf_scope, sizeof buf_scope),
|
||||||
|
@ -506,7 +505,7 @@ int manager_rtnl_process_route(sd_netlink *rtnl, sd_netlink_message *message, vo
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case RTM_NEWROUTE:
|
case RTM_NEWROUTE:
|
||||||
if (!route && link->manager->manage_foreign_routes) {
|
if (!route) {
|
||||||
/* A route appeared that we did not request */
|
/* A route appeared that we did not request */
|
||||||
r = route_add_foreign(link, tmp, &route);
|
r = route_add_foreign(link, tmp, &route);
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
|
@ -1748,7 +1747,6 @@ int manager_new(Manager **ret) {
|
||||||
|
|
||||||
*m = (Manager) {
|
*m = (Manager) {
|
||||||
.speed_meter_interval_usec = SPEED_METER_DEFAULT_TIME_INTERVAL,
|
.speed_meter_interval_usec = SPEED_METER_DEFAULT_TIME_INTERVAL,
|
||||||
.manage_foreign_routes = true,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
m->state_file = strdup("/run/systemd/netif/state");
|
m->state_file = strdup("/run/systemd/netif/state");
|
||||||
|
|
|
@ -30,7 +30,6 @@ struct Manager {
|
||||||
bool enumerating:1;
|
bool enumerating:1;
|
||||||
bool dirty:1;
|
bool dirty:1;
|
||||||
bool restarting:1;
|
bool restarting:1;
|
||||||
bool manage_foreign_routes;
|
|
||||||
|
|
||||||
Set *dirty_links;
|
Set *dirty_links;
|
||||||
|
|
||||||
|
|
|
@ -324,10 +324,16 @@ static int ndisc_router_generate_addresses(Link *link, unsigned prefixlen, uint3
|
||||||
|
|
||||||
*new_address = *address;
|
*new_address = *address;
|
||||||
|
|
||||||
r = generate_ipv6_eui_64_address(link, &new_address->in_addr.in6);
|
/* see RFC4291 section 2.5.1 */
|
||||||
if (r < 0)
|
new_address->in_addr.in6.s6_addr[8] = link->mac.ether_addr_octet[0];
|
||||||
return log_link_error_errno(link, r, "Failed to generate EUI64 address: %m");
|
new_address->in_addr.in6.s6_addr[8] ^= 1 << 1;
|
||||||
|
new_address->in_addr.in6.s6_addr[9] = link->mac.ether_addr_octet[1];
|
||||||
|
new_address->in_addr.in6.s6_addr[10] = link->mac.ether_addr_octet[2];
|
||||||
|
new_address->in_addr.in6.s6_addr[11] = 0xff;
|
||||||
|
new_address->in_addr.in6.s6_addr[12] = 0xfe;
|
||||||
|
new_address->in_addr.in6.s6_addr[13] = link->mac.ether_addr_octet[3];
|
||||||
|
new_address->in_addr.in6.s6_addr[14] = link->mac.ether_addr_octet[4];
|
||||||
|
new_address->in_addr.in6.s6_addr[15] = link->mac.ether_addr_octet[5];
|
||||||
new_address->prefixlen = prefixlen;
|
new_address->prefixlen = prefixlen;
|
||||||
new_address->flags = IFA_F_NOPREFIXROUTE|IFA_F_MANAGETEMPADDR;
|
new_address->flags = IFA_F_NOPREFIXROUTE|IFA_F_MANAGETEMPADDR;
|
||||||
new_address->cinfo.ifa_prefered = lifetime_preferred;
|
new_address->cinfo.ifa_prefered = lifetime_preferred;
|
||||||
|
@ -794,8 +800,7 @@ static int ndisc_router_handler(Link *link, sd_ndisc_router *rt) {
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_link_warning_errno(link, r, "Failed to get RA flags: %m");
|
return log_link_warning_errno(link, r, "Failed to get RA flags: %m");
|
||||||
|
|
||||||
if (flags & (ND_RA_FLAG_MANAGED | ND_RA_FLAG_OTHER) &&
|
if (flags & (ND_RA_FLAG_MANAGED | ND_RA_FLAG_OTHER)) {
|
||||||
link->network->ipv6_accept_ra_start_dhcp6_client) {
|
|
||||||
/* (re)start DHCPv6 client in stateful or stateless mode according to RA flags */
|
/* (re)start DHCPv6 client in stateful or stateless mode according to RA flags */
|
||||||
r = dhcp6_request_address(link, !(flags & ND_RA_FLAG_MANAGED));
|
r = dhcp6_request_address(link, !(flags & ND_RA_FLAG_MANAGED));
|
||||||
if (r < 0 && r != -EBUSY)
|
if (r < 0 && r != -EBUSY)
|
||||||
|
|
|
@ -14,7 +14,6 @@ _Pragma("GCC diagnostic ignored \"-Wimplicit-fallthrough\"")
|
||||||
#include "networkd-ndisc.h"
|
#include "networkd-ndisc.h"
|
||||||
#include "networkd-network.h"
|
#include "networkd-network.h"
|
||||||
#include "qdisc.h"
|
#include "qdisc.h"
|
||||||
#include "tclass.h"
|
|
||||||
#include "vlan-util.h"
|
#include "vlan-util.h"
|
||||||
%}
|
%}
|
||||||
struct ConfigPerfItem;
|
struct ConfigPerfItem;
|
||||||
|
@ -189,12 +188,10 @@ DHCPv6.UseNTP, config_parse_bool,
|
||||||
DHCPv6.RapidCommit, config_parse_bool, 0, offsetof(Network, rapid_commit)
|
DHCPv6.RapidCommit, config_parse_bool, 0, offsetof(Network, rapid_commit)
|
||||||
DHCPv6.ForceDHCPv6PDOtherInformation, config_parse_bool, 0, offsetof(Network, dhcp6_force_pd_other_information)
|
DHCPv6.ForceDHCPv6PDOtherInformation, config_parse_bool, 0, offsetof(Network, dhcp6_force_pd_other_information)
|
||||||
DHCPv6.PrefixDelegationHint, config_parse_dhcp6_pd_hint, 0, 0
|
DHCPv6.PrefixDelegationHint, config_parse_dhcp6_pd_hint, 0, 0
|
||||||
DHCPv6.WithoutRA, config_parse_bool, 0, offsetof(Network, dhcp6_without_ra)
|
|
||||||
IPv6AcceptRA.UseAutonomousPrefix, config_parse_bool, 0, offsetof(Network, ipv6_accept_ra_use_autonomous_prefix)
|
IPv6AcceptRA.UseAutonomousPrefix, config_parse_bool, 0, offsetof(Network, ipv6_accept_ra_use_autonomous_prefix)
|
||||||
IPv6AcceptRA.UseOnLinkPrefix, config_parse_bool, 0, offsetof(Network, ipv6_accept_ra_use_onlink_prefix)
|
IPv6AcceptRA.UseOnLinkPrefix, config_parse_bool, 0, offsetof(Network, ipv6_accept_ra_use_onlink_prefix)
|
||||||
IPv6AcceptRA.UseDNS, config_parse_bool, 0, offsetof(Network, ipv6_accept_ra_use_dns)
|
IPv6AcceptRA.UseDNS, config_parse_bool, 0, offsetof(Network, ipv6_accept_ra_use_dns)
|
||||||
IPv6AcceptRA.UseDomains, config_parse_dhcp_use_domains, 0, offsetof(Network, ipv6_accept_ra_use_domains)
|
IPv6AcceptRA.UseDomains, config_parse_dhcp_use_domains, 0, offsetof(Network, ipv6_accept_ra_use_domains)
|
||||||
IPv6AcceptRA.DHCPv6Client, config_parse_bool, 0, offsetof(Network, ipv6_accept_ra_start_dhcp6_client)
|
|
||||||
IPv6AcceptRA.RouteTable, config_parse_section_route_table, 0, 0
|
IPv6AcceptRA.RouteTable, config_parse_section_route_table, 0, 0
|
||||||
IPv6AcceptRA.BlackList, config_parse_ndisc_black_listed_prefix, 0, 0
|
IPv6AcceptRA.BlackList, config_parse_ndisc_black_listed_prefix, 0, 0
|
||||||
DHCPServer.MaxLeaseTimeSec, config_parse_sec, 0, offsetof(Network, dhcp_server_max_lease_time_usec)
|
DHCPServer.MaxLeaseTimeSec, config_parse_sec, 0, offsetof(Network, dhcp_server_max_lease_time_usec)
|
||||||
|
@ -248,7 +245,6 @@ IPv6Prefix.OnLink, config_parse_prefix_flags,
|
||||||
IPv6Prefix.AddressAutoconfiguration, config_parse_prefix_flags, 0, 0
|
IPv6Prefix.AddressAutoconfiguration, config_parse_prefix_flags, 0, 0
|
||||||
IPv6Prefix.ValidLifetimeSec, config_parse_prefix_lifetime, 0, 0
|
IPv6Prefix.ValidLifetimeSec, config_parse_prefix_lifetime, 0, 0
|
||||||
IPv6Prefix.PreferredLifetimeSec, config_parse_prefix_lifetime, 0, 0
|
IPv6Prefix.PreferredLifetimeSec, config_parse_prefix_lifetime, 0, 0
|
||||||
IPv6Prefix.Assign, config_parse_prefix_assign, 0, 0
|
|
||||||
IPv6RoutePrefix.Route, config_parse_route_prefix, 0, 0
|
IPv6RoutePrefix.Route, config_parse_route_prefix, 0, 0
|
||||||
IPv6RoutePrefix.LifetimeSec, config_parse_route_prefix_lifetime, 0, 0
|
IPv6RoutePrefix.LifetimeSec, config_parse_route_prefix_lifetime, 0, 0
|
||||||
CAN.BitRate, config_parse_si_uint64, 0, offsetof(Network, can_bitrate)
|
CAN.BitRate, config_parse_si_uint64, 0, offsetof(Network, can_bitrate)
|
||||||
|
@ -257,10 +253,6 @@ CAN.RestartSec, config_parse_sec,
|
||||||
CAN.TripleSampling, config_parse_tristate, 0, offsetof(Network, can_triple_sampling)
|
CAN.TripleSampling, config_parse_tristate, 0, offsetof(Network, can_triple_sampling)
|
||||||
QDisc.Parent, config_parse_qdisc_parent, _QDISC_KIND_INVALID, 0
|
QDisc.Parent, config_parse_qdisc_parent, _QDISC_KIND_INVALID, 0
|
||||||
QDisc.Handle, config_parse_qdisc_handle, _QDISC_KIND_INVALID, 0
|
QDisc.Handle, config_parse_qdisc_handle, _QDISC_KIND_INVALID, 0
|
||||||
CAKE.Parent, config_parse_qdisc_parent, QDISC_KIND_CAKE, 0
|
|
||||||
CAKE.Handle, config_parse_qdisc_handle, QDISC_KIND_CAKE, 0
|
|
||||||
CAKE.Bandwidth, config_parse_cake_bandwidth, QDISC_KIND_CAKE, 0
|
|
||||||
CAKE.Overhead, config_parse_cake_overhead, QDISC_KIND_CAKE, 0
|
|
||||||
ControlledDelay.Parent, config_parse_qdisc_parent, QDISC_KIND_CODEL, 0
|
ControlledDelay.Parent, config_parse_qdisc_parent, QDISC_KIND_CODEL, 0
|
||||||
ControlledDelay.Handle, config_parse_qdisc_handle, QDISC_KIND_CODEL, 0
|
ControlledDelay.Handle, config_parse_qdisc_handle, QDISC_KIND_CODEL, 0
|
||||||
ControlledDelay.PacketLimit, config_parse_controlled_delay_u32, QDISC_KIND_CODEL, 0
|
ControlledDelay.PacketLimit, config_parse_controlled_delay_u32, QDISC_KIND_CODEL, 0
|
||||||
|
@ -268,9 +260,6 @@ ControlledDelay.TargetSec, config_parse_controlled_delay_usec,
|
||||||
ControlledDelay.IntervalSec, config_parse_controlled_delay_usec, QDISC_KIND_CODEL, 0
|
ControlledDelay.IntervalSec, config_parse_controlled_delay_usec, QDISC_KIND_CODEL, 0
|
||||||
ControlledDelay.CEThresholdSec, config_parse_controlled_delay_usec, QDISC_KIND_CODEL, 0
|
ControlledDelay.CEThresholdSec, config_parse_controlled_delay_usec, QDISC_KIND_CODEL, 0
|
||||||
ControlledDelay.ECN, config_parse_controlled_delay_bool, QDISC_KIND_CODEL, 0
|
ControlledDelay.ECN, config_parse_controlled_delay_bool, QDISC_KIND_CODEL, 0
|
||||||
PFIFO.Parent, config_parse_qdisc_parent, QDISC_KIND_PFIFO, 0
|
|
||||||
PFIFO.Handle, config_parse_qdisc_handle, QDISC_KIND_PFIFO, 0
|
|
||||||
PFIFO.PacketLimit, config_parse_fifo_size, QDISC_KIND_PFIFO, 0
|
|
||||||
FairQueueing.Parent, config_parse_qdisc_parent, QDISC_KIND_FQ, 0
|
FairQueueing.Parent, config_parse_qdisc_parent, QDISC_KIND_FQ, 0
|
||||||
FairQueueing.Handle, config_parse_qdisc_handle, QDISC_KIND_FQ, 0
|
FairQueueing.Handle, config_parse_qdisc_handle, QDISC_KIND_FQ, 0
|
||||||
FairQueueing.PacketLimit, config_parse_fair_queueing_u32, QDISC_KIND_FQ, 0
|
FairQueueing.PacketLimit, config_parse_fair_queueing_u32, QDISC_KIND_FQ, 0
|
||||||
|
@ -292,19 +281,6 @@ FairQueueingControlledDelay.TargetSec, config_parse_fair_queueing_controll
|
||||||
FairQueueingControlledDelay.IntervalSec, config_parse_fair_queueing_controlled_delay_usec, QDISC_KIND_FQ_CODEL, 0
|
FairQueueingControlledDelay.IntervalSec, config_parse_fair_queueing_controlled_delay_usec, QDISC_KIND_FQ_CODEL, 0
|
||||||
FairQueueingControlledDelay.CEThresholdSec, config_parse_fair_queueing_controlled_delay_usec, QDISC_KIND_FQ_CODEL, 0
|
FairQueueingControlledDelay.CEThresholdSec, config_parse_fair_queueing_controlled_delay_usec, QDISC_KIND_FQ_CODEL, 0
|
||||||
FairQueueingControlledDelay.ECN, config_parse_fair_queueing_controlled_delay_bool, QDISC_KIND_FQ_CODEL, 0
|
FairQueueingControlledDelay.ECN, config_parse_fair_queueing_controlled_delay_bool, QDISC_KIND_FQ_CODEL, 0
|
||||||
GenericRandomEarlyDetection.Parent, config_parse_qdisc_parent, QDISC_KIND_GRED, 0
|
|
||||||
GenericRandomEarlyDetection.Handle, config_parse_qdisc_handle, QDISC_KIND_GRED, 0
|
|
||||||
GenericRandomEarlyDetection.VirtualQueues, config_parse_generic_random_early_detection_u32, QDISC_KIND_GRED, 0
|
|
||||||
GenericRandomEarlyDetection.DefaultVirtualQueue, config_parse_generic_random_early_detection_u32, QDISC_KIND_GRED, 0
|
|
||||||
GenericRandomEarlyDetection.GenericRIO, config_parse_generic_random_early_detection_bool, QDISC_KIND_GRED, 0
|
|
||||||
HierarchyTokenBucket.Parent, config_parse_qdisc_parent, QDISC_KIND_HTB, 0
|
|
||||||
HierarchyTokenBucket.Handle, config_parse_qdisc_handle, QDISC_KIND_HTB, 0
|
|
||||||
HierarchyTokenBucket.DefaultClass, config_parse_hierarchy_token_bucket_default_class, QDISC_KIND_HTB, 0
|
|
||||||
HierarchyTokenBucketClass.Parent, config_parse_tclass_parent, TCLASS_KIND_HTB, 0
|
|
||||||
HierarchyTokenBucketClass.ClassId, config_parse_tclass_classid, TCLASS_KIND_HTB, 0
|
|
||||||
HierarchyTokenBucketClass.Priority, config_parse_hierarchy_token_bucket_u32, TCLASS_KIND_HTB, 0
|
|
||||||
HierarchyTokenBucketClass.Rate, config_parse_hierarchy_token_bucket_rate, TCLASS_KIND_HTB, 0
|
|
||||||
HierarchyTokenBucketClass.CeilRate, config_parse_hierarchy_token_bucket_rate, TCLASS_KIND_HTB, 0
|
|
||||||
NetworkEmulator.Parent, config_parse_qdisc_parent, QDISC_KIND_NETEM, 0
|
NetworkEmulator.Parent, config_parse_qdisc_parent, QDISC_KIND_NETEM, 0
|
||||||
NetworkEmulator.Handle, config_parse_qdisc_handle, QDISC_KIND_NETEM, 0
|
NetworkEmulator.Handle, config_parse_qdisc_handle, QDISC_KIND_NETEM, 0
|
||||||
NetworkEmulator.DelaySec, config_parse_network_emulator_delay, QDISC_KIND_NETEM, 0
|
NetworkEmulator.DelaySec, config_parse_network_emulator_delay, QDISC_KIND_NETEM, 0
|
||||||
|
@ -312,9 +288,6 @@ NetworkEmulator.DelayJitterSec, config_parse_network_emulator_delay
|
||||||
NetworkEmulator.LossRate, config_parse_network_emulator_rate, QDISC_KIND_NETEM, 0
|
NetworkEmulator.LossRate, config_parse_network_emulator_rate, QDISC_KIND_NETEM, 0
|
||||||
NetworkEmulator.DuplicateRate, config_parse_network_emulator_rate, QDISC_KIND_NETEM, 0
|
NetworkEmulator.DuplicateRate, config_parse_network_emulator_rate, QDISC_KIND_NETEM, 0
|
||||||
NetworkEmulator.PacketLimit, config_parse_network_emulator_packet_limit, QDISC_KIND_NETEM, 0
|
NetworkEmulator.PacketLimit, config_parse_network_emulator_packet_limit, QDISC_KIND_NETEM, 0
|
||||||
StochasticFairBlue.Parent, config_parse_qdisc_parent, QDISC_KIND_SFB, 0
|
|
||||||
StochasticFairBlue.Handle, config_parse_qdisc_handle, QDISC_KIND_SFB, 0
|
|
||||||
StochasticFairBlue.PacketLimit, config_parse_stochastic_fair_blue_u32, QDISC_KIND_SFB, 0
|
|
||||||
StochasticFairnessQueueing.Parent, config_parse_qdisc_parent, QDISC_KIND_SFQ, 0
|
StochasticFairnessQueueing.Parent, config_parse_qdisc_parent, QDISC_KIND_SFQ, 0
|
||||||
StochasticFairnessQueueing.Handle, config_parse_qdisc_handle, QDISC_KIND_SFQ, 0
|
StochasticFairnessQueueing.Handle, config_parse_qdisc_handle, QDISC_KIND_SFQ, 0
|
||||||
StochasticFairnessQueueing.PerturbPeriodSec, config_parse_stochastic_fairness_queueing_perturb_period, QDISC_KIND_SFQ, 0
|
StochasticFairnessQueueing.PerturbPeriodSec, config_parse_stochastic_fairness_queueing_perturb_period, QDISC_KIND_SFQ, 0
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
#include "string-table.h"
|
#include "string-table.h"
|
||||||
#include "string-util.h"
|
#include "string-util.h"
|
||||||
#include "strv.h"
|
#include "strv.h"
|
||||||
#include "tc.h"
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
/* Let's assume that anything above this number is a user misconfiguration. */
|
/* Let's assume that anything above this number is a user misconfiguration. */
|
||||||
|
@ -155,7 +154,7 @@ int network_verify(Network *network) {
|
||||||
Prefix *prefix, *prefix_next;
|
Prefix *prefix, *prefix_next;
|
||||||
Route *route, *route_next;
|
Route *route, *route_next;
|
||||||
FdbEntry *fdb, *fdb_next;
|
FdbEntry *fdb, *fdb_next;
|
||||||
TrafficControl *tc;
|
QDisc *qdisc;
|
||||||
Iterator i;
|
Iterator i;
|
||||||
|
|
||||||
assert(network);
|
assert(network);
|
||||||
|
@ -317,9 +316,9 @@ int network_verify(Network *network) {
|
||||||
routing_policy_rule_free(rule);
|
routing_policy_rule_free(rule);
|
||||||
|
|
||||||
bool has_root = false, has_clsact = false;
|
bool has_root = false, has_clsact = false;
|
||||||
ORDERED_HASHMAP_FOREACH(tc, network->tc_by_section, i)
|
ORDERED_HASHMAP_FOREACH(qdisc, network->qdiscs_by_section, i)
|
||||||
if (traffic_control_section_verify(tc, &has_root, &has_clsact) < 0)
|
if (qdisc_section_verify(qdisc, &has_root, &has_clsact) < 0)
|
||||||
traffic_control_free(tc);
|
qdisc_free(qdisc);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -452,7 +451,6 @@ int network_load_one(Manager *manager, OrderedHashmap **networks, const char *fi
|
||||||
.ipv6_accept_ra_use_onlink_prefix = true,
|
.ipv6_accept_ra_use_onlink_prefix = true,
|
||||||
.ipv6_accept_ra_route_table = RT_TABLE_MAIN,
|
.ipv6_accept_ra_route_table = RT_TABLE_MAIN,
|
||||||
.ipv6_accept_ra_route_table_set = false,
|
.ipv6_accept_ra_route_table_set = false,
|
||||||
.ipv6_accept_ra_start_dhcp6_client = true,
|
|
||||||
|
|
||||||
.keep_configuration = _KEEP_CONFIGURATION_INVALID,
|
.keep_configuration = _KEEP_CONFIGURATION_INVALID,
|
||||||
|
|
||||||
|
@ -485,16 +483,10 @@ int network_load_one(Manager *manager, OrderedHashmap **networks, const char *fi
|
||||||
"TrafficControlQueueingDiscipline\0"
|
"TrafficControlQueueingDiscipline\0"
|
||||||
"CAN\0"
|
"CAN\0"
|
||||||
"QDisc\0"
|
"QDisc\0"
|
||||||
"CAKE\0"
|
|
||||||
"ControlledDelay\0"
|
"ControlledDelay\0"
|
||||||
"PFIFO\0"
|
|
||||||
"FairQueueing\0"
|
"FairQueueing\0"
|
||||||
"FairQueueingControlledDelay\0"
|
"FairQueueingControlledDelay\0"
|
||||||
"GenericRandomEarlyDetection\0"
|
|
||||||
"HierarchyTokenBucket\0"
|
|
||||||
"HierarchyTokenBucketClass\0"
|
|
||||||
"NetworkEmulator\0"
|
"NetworkEmulator\0"
|
||||||
"StochasticFairBlue\0"
|
|
||||||
"StochasticFairnessQueueing\0"
|
"StochasticFairnessQueueing\0"
|
||||||
"TokenBucketFilter\0"
|
"TokenBucketFilter\0"
|
||||||
"TrivialLinkEqualizer\0",
|
"TrivialLinkEqualizer\0",
|
||||||
|
@ -698,7 +690,7 @@ static Network *network_free(Network *network) {
|
||||||
hashmap_free(network->prefixes_by_section);
|
hashmap_free(network->prefixes_by_section);
|
||||||
hashmap_free(network->route_prefixes_by_section);
|
hashmap_free(network->route_prefixes_by_section);
|
||||||
hashmap_free(network->rules_by_section);
|
hashmap_free(network->rules_by_section);
|
||||||
ordered_hashmap_free_with_destructor(network->tc_by_section, traffic_control_free);
|
ordered_hashmap_free_with_destructor(network->qdiscs_by_section, qdisc_free);
|
||||||
|
|
||||||
if (network->manager &&
|
if (network->manager &&
|
||||||
network->manager->duids_requesting_uuid)
|
network->manager->duids_requesting_uuid)
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#include "networkd-routing-policy-rule.h"
|
#include "networkd-routing-policy-rule.h"
|
||||||
#include "networkd-util.h"
|
#include "networkd-util.h"
|
||||||
#include "ordered-set.h"
|
#include "ordered-set.h"
|
||||||
|
#include "qdisc.h"
|
||||||
#include "resolve-util.h"
|
#include "resolve-util.h"
|
||||||
|
|
||||||
typedef enum IPv6PrivacyExtensions {
|
typedef enum IPv6PrivacyExtensions {
|
||||||
|
@ -125,7 +126,6 @@ struct Network {
|
||||||
/* DHCPv6 Client support*/
|
/* DHCPv6 Client support*/
|
||||||
bool dhcp6_use_dns;
|
bool dhcp6_use_dns;
|
||||||
bool dhcp6_use_ntp;
|
bool dhcp6_use_ntp;
|
||||||
bool dhcp6_without_ra;
|
|
||||||
uint8_t dhcp6_pd_length;
|
uint8_t dhcp6_pd_length;
|
||||||
struct in6_addr dhcp6_pd_address;
|
struct in6_addr dhcp6_pd_address;
|
||||||
|
|
||||||
|
@ -213,7 +213,6 @@ struct Network {
|
||||||
bool ipv6_accept_ra_use_dns;
|
bool ipv6_accept_ra_use_dns;
|
||||||
bool ipv6_accept_ra_use_autonomous_prefix;
|
bool ipv6_accept_ra_use_autonomous_prefix;
|
||||||
bool ipv6_accept_ra_use_onlink_prefix;
|
bool ipv6_accept_ra_use_onlink_prefix;
|
||||||
bool ipv6_accept_ra_start_dhcp6_client;
|
|
||||||
bool active_slave;
|
bool active_slave;
|
||||||
bool primary_slave;
|
bool primary_slave;
|
||||||
DHCPUseDomains ipv6_accept_ra_use_domains;
|
DHCPUseDomains ipv6_accept_ra_use_domains;
|
||||||
|
@ -275,7 +274,7 @@ struct Network {
|
||||||
Hashmap *prefixes_by_section;
|
Hashmap *prefixes_by_section;
|
||||||
Hashmap *route_prefixes_by_section;
|
Hashmap *route_prefixes_by_section;
|
||||||
Hashmap *rules_by_section;
|
Hashmap *rules_by_section;
|
||||||
OrderedHashmap *tc_by_section;
|
OrderedHashmap *qdiscs_by_section;
|
||||||
|
|
||||||
/* All kinds of DNS configuration */
|
/* All kinds of DNS configuration */
|
||||||
struct in_addr_data *dns;
|
struct in_addr_data *dns;
|
||||||
|
|
|
@ -319,46 +319,6 @@ int config_parse_prefix_lifetime(const char *unit,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int config_parse_prefix_assign(
|
|
||||||
const char *unit,
|
|
||||||
const char *filename,
|
|
||||||
unsigned line,
|
|
||||||
const char *section,
|
|
||||||
unsigned section_line,
|
|
||||||
const char *lvalue,
|
|
||||||
int ltype,
|
|
||||||
const char *rvalue,
|
|
||||||
void *data,
|
|
||||||
void *userdata) {
|
|
||||||
|
|
||||||
Network *network = userdata;
|
|
||||||
_cleanup_(prefix_free_or_set_invalidp) Prefix *p = NULL;
|
|
||||||
int r;
|
|
||||||
|
|
||||||
assert(filename);
|
|
||||||
assert(section);
|
|
||||||
assert(lvalue);
|
|
||||||
assert(rvalue);
|
|
||||||
assert(data);
|
|
||||||
|
|
||||||
r = prefix_new_static(network, filename, section_line, &p);
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
|
|
||||||
r = parse_boolean(rvalue);
|
|
||||||
if (r < 0) {
|
|
||||||
log_syntax(unit, LOG_ERR, filename, line, r,
|
|
||||||
"Failed to parse %s=, ignoring assignment: %s",
|
|
||||||
lvalue, rvalue);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
p->assign = r;
|
|
||||||
p = NULL;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int config_parse_route_prefix(const char *unit,
|
int config_parse_route_prefix(const char *unit,
|
||||||
const char *filename,
|
const char *filename,
|
||||||
unsigned line,
|
unsigned line,
|
||||||
|
|
|
@ -28,8 +28,6 @@ struct Prefix {
|
||||||
|
|
||||||
sd_radv_prefix *radv_prefix;
|
sd_radv_prefix *radv_prefix;
|
||||||
|
|
||||||
bool assign;
|
|
||||||
|
|
||||||
LIST_FIELDS(Prefix, prefixes);
|
LIST_FIELDS(Prefix, prefixes);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -61,7 +59,6 @@ CONFIG_PARSER_PROTOTYPE(config_parse_router_preference);
|
||||||
CONFIG_PARSER_PROTOTYPE(config_parse_prefix);
|
CONFIG_PARSER_PROTOTYPE(config_parse_prefix);
|
||||||
CONFIG_PARSER_PROTOTYPE(config_parse_prefix_flags);
|
CONFIG_PARSER_PROTOTYPE(config_parse_prefix_flags);
|
||||||
CONFIG_PARSER_PROTOTYPE(config_parse_prefix_lifetime);
|
CONFIG_PARSER_PROTOTYPE(config_parse_prefix_lifetime);
|
||||||
CONFIG_PARSER_PROTOTYPE(config_parse_prefix_assign);
|
|
||||||
CONFIG_PARSER_PROTOTYPE(config_parse_radv_dns);
|
CONFIG_PARSER_PROTOTYPE(config_parse_radv_dns);
|
||||||
CONFIG_PARSER_PROTOTYPE(config_parse_radv_search_domains);
|
CONFIG_PARSER_PROTOTYPE(config_parse_radv_search_domains);
|
||||||
CONFIG_PARSER_PROTOTYPE(config_parse_route_prefix);
|
CONFIG_PARSER_PROTOTYPE(config_parse_route_prefix);
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
[Network]
|
[Network]
|
||||||
#SpeedMeter=no
|
#SpeedMeter=no
|
||||||
#SpeedMeterIntervalSec=10sec
|
#SpeedMeterIntervalSec=10sec
|
||||||
#ManageForeignRoutes=yes
|
|
||||||
|
|
||||||
[DHCP]
|
[DHCP]
|
||||||
#DUIDType=vendor
|
#DUIDType=vendor
|
||||||
|
|
|
@ -139,17 +139,6 @@
|
||||||
<annotate key="org.freedesktop.policykit.owner">unix-user:systemd-network</annotate>
|
<annotate key="org.freedesktop.policykit.owner">unix-user:systemd-network</annotate>
|
||||||
</action>
|
</action>
|
||||||
|
|
||||||
<action id="org.freedesktop.network1.forcerenew">
|
|
||||||
<description gettext-domain="systemd">DHCP server sends force renew message</description>
|
|
||||||
<message gettext-domain="systemd">Authentication is required to send force renew message.</message>
|
|
||||||
<defaults>
|
|
||||||
<allow_any>auth_admin</allow_any>
|
|
||||||
<allow_inactive>auth_admin</allow_inactive>
|
|
||||||
<allow_active>auth_admin_keep</allow_active>
|
|
||||||
</defaults>
|
|
||||||
<annotate key="org.freedesktop.policykit.owner">unix-user:systemd-network</annotate>
|
|
||||||
</action>
|
|
||||||
|
|
||||||
<action id="org.freedesktop.network1.renew">
|
<action id="org.freedesktop.network1.renew">
|
||||||
<description gettext-domain="systemd">Renew dynamic addresses</description>
|
<description gettext-domain="systemd">Renew dynamic addresses</description>
|
||||||
<message gettext-domain="systemd">Authentication is required to renew dynamic addresses.</message>
|
<message gettext-domain="systemd">Authentication is required to renew dynamic addresses.</message>
|
||||||
|
|
|
@ -1,159 +0,0 @@
|
||||||
/* SPDX-License-Identifier: LGPL-2.1+
|
|
||||||
* Copyright © 2020 VMware, Inc. */
|
|
||||||
|
|
||||||
#include <linux/pkt_sched.h>
|
|
||||||
|
|
||||||
#include "alloc-util.h"
|
|
||||||
#include "cake.h"
|
|
||||||
#include "conf-parser.h"
|
|
||||||
#include "netlink-util.h"
|
|
||||||
#include "parse-util.h"
|
|
||||||
#include "qdisc.h"
|
|
||||||
#include "string-util.h"
|
|
||||||
|
|
||||||
static int cake_fill_message(Link *link, QDisc *qdisc, sd_netlink_message *req) {
|
|
||||||
CommonApplicationsKeptEnhanced *c;
|
|
||||||
int r;
|
|
||||||
|
|
||||||
assert(link);
|
|
||||||
assert(qdisc);
|
|
||||||
assert(req);
|
|
||||||
|
|
||||||
c = CAKE(qdisc);
|
|
||||||
|
|
||||||
r = sd_netlink_message_open_container_union(req, TCA_OPTIONS, "cake");
|
|
||||||
if (r < 0)
|
|
||||||
return log_link_error_errno(link, r, "Could not open container TCA_OPTIONS: %m");
|
|
||||||
|
|
||||||
if (c->bandwidth > 0) {
|
|
||||||
r = sd_netlink_message_append_u64(req, TCA_CAKE_BASE_RATE64, c->bandwidth);
|
|
||||||
if (r < 0)
|
|
||||||
return log_link_error_errno(link, r, "Could not append TCA_CAKE_BASE_RATE64 attribute: %m");
|
|
||||||
}
|
|
||||||
|
|
||||||
r = sd_netlink_message_append_s32(req, TCA_CAKE_OVERHEAD, c->overhead);
|
|
||||||
if (r < 0)
|
|
||||||
return log_link_error_errno(link, r, "Could not append TCA_CAKE_OVERHEAD attribute: %m");
|
|
||||||
|
|
||||||
r = sd_netlink_message_close_container(req);
|
|
||||||
if (r < 0)
|
|
||||||
return log_link_error_errno(link, r, "Could not close container TCA_OPTIONS: %m");
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int config_parse_cake_bandwidth(
|
|
||||||
const char *unit,
|
|
||||||
const char *filename,
|
|
||||||
unsigned line,
|
|
||||||
const char *section,
|
|
||||||
unsigned section_line,
|
|
||||||
const char *lvalue,
|
|
||||||
int ltype,
|
|
||||||
const char *rvalue,
|
|
||||||
void *data,
|
|
||||||
void *userdata) {
|
|
||||||
|
|
||||||
_cleanup_(qdisc_free_or_set_invalidp) QDisc *qdisc = NULL;
|
|
||||||
CommonApplicationsKeptEnhanced *c;
|
|
||||||
Network *network = data;
|
|
||||||
uint64_t k;
|
|
||||||
int r;
|
|
||||||
|
|
||||||
assert(filename);
|
|
||||||
assert(lvalue);
|
|
||||||
assert(rvalue);
|
|
||||||
assert(data);
|
|
||||||
|
|
||||||
r = qdisc_new_static(QDISC_KIND_CAKE, network, filename, section_line, &qdisc);
|
|
||||||
if (r == -ENOMEM)
|
|
||||||
return log_oom();
|
|
||||||
if (r < 0)
|
|
||||||
return log_syntax(unit, LOG_ERR, filename, line, r,
|
|
||||||
"More than one kind of queueing discipline, ignoring assignment: %m");
|
|
||||||
|
|
||||||
c = CAKE(qdisc);
|
|
||||||
|
|
||||||
if (isempty(rvalue)) {
|
|
||||||
c->bandwidth = 0;
|
|
||||||
|
|
||||||
qdisc = NULL;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
r = parse_size(rvalue, 1000, &k);
|
|
||||||
if (r < 0) {
|
|
||||||
log_syntax(unit, LOG_ERR, filename, line, r,
|
|
||||||
"Failed to parse '%s=', ignoring assignment: %s",
|
|
||||||
lvalue, rvalue);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
c->bandwidth = k/8;
|
|
||||||
qdisc = NULL;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int config_parse_cake_overhead(
|
|
||||||
const char *unit,
|
|
||||||
const char *filename,
|
|
||||||
unsigned line,
|
|
||||||
const char *section,
|
|
||||||
unsigned section_line,
|
|
||||||
const char *lvalue,
|
|
||||||
int ltype,
|
|
||||||
const char *rvalue,
|
|
||||||
void *data,
|
|
||||||
void *userdata) {
|
|
||||||
|
|
||||||
_cleanup_(qdisc_free_or_set_invalidp) QDisc *qdisc = NULL;
|
|
||||||
CommonApplicationsKeptEnhanced *c;
|
|
||||||
Network *network = data;
|
|
||||||
int32_t v;
|
|
||||||
int r;
|
|
||||||
|
|
||||||
assert(filename);
|
|
||||||
assert(lvalue);
|
|
||||||
assert(rvalue);
|
|
||||||
assert(data);
|
|
||||||
|
|
||||||
r = qdisc_new_static(QDISC_KIND_CAKE, network, filename, section_line, &qdisc);
|
|
||||||
if (r == -ENOMEM)
|
|
||||||
return log_oom();
|
|
||||||
if (r < 0)
|
|
||||||
return log_syntax(unit, LOG_ERR, filename, line, r,
|
|
||||||
"More than one kind of queueing discipline, ignoring assignment: %m");
|
|
||||||
|
|
||||||
c = CAKE(qdisc);
|
|
||||||
|
|
||||||
if (isempty(rvalue)) {
|
|
||||||
c->overhead = 0;
|
|
||||||
qdisc = NULL;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
r = safe_atoi32(rvalue, &v);
|
|
||||||
if (r < 0) {
|
|
||||||
log_syntax(unit, LOG_ERR, filename, line, r,
|
|
||||||
"Failed to parse 'Overhead=', ignoring assignment: %s",
|
|
||||||
rvalue);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if (v < -64 || v > 256) {
|
|
||||||
log_syntax(unit, LOG_ERR, filename, line, 0,
|
|
||||||
"Invalid 'Overhead=', ignoring assignment: %s",
|
|
||||||
rvalue);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
c->overhead = v;
|
|
||||||
qdisc = NULL;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
const QDiscVTable cake_vtable = {
|
|
||||||
.object_size = sizeof(CommonApplicationsKeptEnhanced),
|
|
||||||
.tca_kind = "cake",
|
|
||||||
.fill_message = cake_fill_message,
|
|
||||||
};
|
|
|
@ -1,20 +0,0 @@
|
||||||
/* SPDX-License-Identifier: LGPL-2.1+
|
|
||||||
* Copyright © 2020 VMware, Inc. */
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "conf-parser.h"
|
|
||||||
#include "qdisc.h"
|
|
||||||
|
|
||||||
typedef struct CommonApplicationsKeptEnhanced {
|
|
||||||
QDisc meta;
|
|
||||||
|
|
||||||
int overhead;
|
|
||||||
uint64_t bandwidth;
|
|
||||||
|
|
||||||
} CommonApplicationsKeptEnhanced;
|
|
||||||
|
|
||||||
DEFINE_QDISC_CAST(CAKE, CommonApplicationsKeptEnhanced);
|
|
||||||
extern const QDiscVTable cake_vtable;
|
|
||||||
|
|
||||||
CONFIG_PARSER_PROTOTYPE(config_parse_cake_bandwidth);
|
|
||||||
CONFIG_PARSER_PROTOTYPE(config_parse_cake_overhead);
|
|
|
@ -1,87 +0,0 @@
|
||||||
/* SPDX-License-Identifier: LGPL-2.1+
|
|
||||||
* Copyright © 2020 VMware, Inc. */
|
|
||||||
|
|
||||||
#include <linux/pkt_sched.h>
|
|
||||||
|
|
||||||
#include "alloc-util.h"
|
|
||||||
#include "conf-parser.h"
|
|
||||||
#include "fifo.h"
|
|
||||||
#include "netlink-util.h"
|
|
||||||
#include "parse-util.h"
|
|
||||||
#include "string-util.h"
|
|
||||||
|
|
||||||
static int fifo_fill_message(Link *link, QDisc *qdisc, sd_netlink_message *req) {
|
|
||||||
struct tc_fifo_qopt opt = {};
|
|
||||||
FirstInFirstOut *fifo;
|
|
||||||
int r;
|
|
||||||
|
|
||||||
assert(link);
|
|
||||||
assert(qdisc);
|
|
||||||
assert(req);
|
|
||||||
|
|
||||||
fifo = PFIFO(qdisc);
|
|
||||||
|
|
||||||
opt.limit = fifo->limit;
|
|
||||||
|
|
||||||
r = sd_netlink_message_append_data(req, TCA_OPTIONS, &opt, sizeof(struct tc_fifo_qopt));
|
|
||||||
if (r < 0)
|
|
||||||
return log_link_error_errno(link, r, "Could not append TCA_OPTIONS attribute: %m");
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int config_parse_fifo_size(
|
|
||||||
const char *unit,
|
|
||||||
const char *filename,
|
|
||||||
unsigned line,
|
|
||||||
const char *section,
|
|
||||||
unsigned section_line,
|
|
||||||
const char *lvalue,
|
|
||||||
int ltype,
|
|
||||||
const char *rvalue,
|
|
||||||
void *data,
|
|
||||||
void *userdata) {
|
|
||||||
|
|
||||||
_cleanup_(qdisc_free_or_set_invalidp) QDisc *qdisc = NULL;
|
|
||||||
Network *network = data;
|
|
||||||
FirstInFirstOut *fifo;
|
|
||||||
int r;
|
|
||||||
|
|
||||||
assert(filename);
|
|
||||||
assert(lvalue);
|
|
||||||
assert(rvalue);
|
|
||||||
assert(data);
|
|
||||||
|
|
||||||
r = qdisc_new_static(QDISC_KIND_PFIFO, network, filename, section_line, &qdisc);
|
|
||||||
if (r == -ENOMEM)
|
|
||||||
return log_oom();
|
|
||||||
if (r < 0)
|
|
||||||
return log_syntax(unit, LOG_ERR, filename, line, r,
|
|
||||||
"More than one kind of queueing discipline, ignoring assignment: %m");
|
|
||||||
|
|
||||||
fifo = PFIFO(qdisc);
|
|
||||||
|
|
||||||
if (isempty(rvalue)) {
|
|
||||||
fifo->limit = 0;
|
|
||||||
|
|
||||||
qdisc = NULL;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
r = safe_atou32(rvalue, &fifo->limit);
|
|
||||||
if (r < 0) {
|
|
||||||
log_syntax(unit, LOG_ERR, filename, line, r,
|
|
||||||
"Failed to parse '%s=', ignoring assignment: %s",
|
|
||||||
lvalue, rvalue);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
qdisc = NULL;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
const QDiscVTable pfifo_vtable = {
|
|
||||||
.object_size = sizeof(FirstInFirstOut),
|
|
||||||
.tca_kind = "pfifo",
|
|
||||||
.fill_message = fifo_fill_message,
|
|
||||||
};
|
|
|
@ -1,17 +0,0 @@
|
||||||
/* SPDX-License-Identifier: LGPL-2.1+
|
|
||||||
* Copyright © 2020 VMware, Inc. */
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "conf-parser.h"
|
|
||||||
#include "qdisc.h"
|
|
||||||
|
|
||||||
typedef struct FirstInFirstOut {
|
|
||||||
QDisc meta;
|
|
||||||
|
|
||||||
uint32_t limit;
|
|
||||||
} FirstInFirstOut;
|
|
||||||
|
|
||||||
DEFINE_QDISC_CAST(PFIFO, FirstInFirstOut);
|
|
||||||
extern const QDiscVTable pfifo_vtable;
|
|
||||||
|
|
||||||
CONFIG_PARSER_PROTOTYPE(config_parse_fifo_size);
|
|
|
@ -1,193 +0,0 @@
|
||||||
/* SPDX-License-Identifier: LGPL-2.1+
|
|
||||||
* Copyright © 2020 VMware, Inc. */
|
|
||||||
|
|
||||||
#include <linux/pkt_sched.h>
|
|
||||||
|
|
||||||
#include "alloc-util.h"
|
|
||||||
#include "conf-parser.h"
|
|
||||||
#include "netlink-util.h"
|
|
||||||
#include "parse-util.h"
|
|
||||||
#include "qdisc.h"
|
|
||||||
#include "string-util.h"
|
|
||||||
|
|
||||||
static int generic_random_early_detection_init(QDisc *qdisc) {
|
|
||||||
GenericRandomEarlyDetection *gred;
|
|
||||||
|
|
||||||
assert(qdisc);
|
|
||||||
|
|
||||||
gred = GRED(qdisc);
|
|
||||||
|
|
||||||
gred->grio = -1;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int generic_random_early_detection_fill_message(Link *link, QDisc *qdisc, sd_netlink_message *req) {
|
|
||||||
GenericRandomEarlyDetection *gred;
|
|
||||||
struct tc_gred_sopt opt = {};
|
|
||||||
int r;
|
|
||||||
|
|
||||||
assert(link);
|
|
||||||
assert(qdisc);
|
|
||||||
assert(req);
|
|
||||||
|
|
||||||
gred = GRED(qdisc);
|
|
||||||
|
|
||||||
opt.DPs = gred->virtual_queues;
|
|
||||||
opt.def_DP = gred->default_virtual_queue;
|
|
||||||
|
|
||||||
if (gred->grio >= 0)
|
|
||||||
opt.grio = gred->grio;
|
|
||||||
|
|
||||||
r = sd_netlink_message_open_container_union(req, TCA_OPTIONS, "gred");
|
|
||||||
if (r < 0)
|
|
||||||
return log_link_error_errno(link, r, "Could not open container TCA_OPTIONS: %m");
|
|
||||||
|
|
||||||
r = sd_netlink_message_append_data(req, TCA_GRED_DPS, &opt, sizeof(struct tc_gred_sopt));
|
|
||||||
if (r < 0)
|
|
||||||
return log_link_error_errno(link, r, "Could not append TCA_GRED_DPS attribute: %m");
|
|
||||||
|
|
||||||
r = sd_netlink_message_close_container(req);
|
|
||||||
if (r < 0)
|
|
||||||
return log_link_error_errno(link, r, "Could not close container TCA_OPTIONS: %m");
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int generic_random_early_detection_verify(QDisc *qdisc) {
|
|
||||||
GenericRandomEarlyDetection *gred = GRED(qdisc);
|
|
||||||
|
|
||||||
if (gred->default_virtual_queue >= gred->virtual_queues)
|
|
||||||
return log_warning_errno(SYNTHETIC_ERRNO(EINVAL),
|
|
||||||
"%s: DefaultVirtualQueue= must be less than VirtualQueues=. "
|
|
||||||
"Ignoring [GenericRandomEarlyDetection] section from line %u.",
|
|
||||||
qdisc->section->filename, qdisc->section->line);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int config_parse_generic_random_early_detection_u32(
|
|
||||||
const char *unit,
|
|
||||||
const char *filename,
|
|
||||||
unsigned line,
|
|
||||||
const char *section,
|
|
||||||
unsigned section_line,
|
|
||||||
const char *lvalue,
|
|
||||||
int ltype,
|
|
||||||
const char *rvalue,
|
|
||||||
void *data,
|
|
||||||
void *userdata) {
|
|
||||||
|
|
||||||
_cleanup_(qdisc_free_or_set_invalidp) QDisc *qdisc = NULL;
|
|
||||||
GenericRandomEarlyDetection *gred;
|
|
||||||
Network *network = data;
|
|
||||||
uint32_t *p;
|
|
||||||
uint32_t v;
|
|
||||||
int r;
|
|
||||||
|
|
||||||
assert(filename);
|
|
||||||
assert(lvalue);
|
|
||||||
assert(rvalue);
|
|
||||||
assert(data);
|
|
||||||
|
|
||||||
r = qdisc_new_static(QDISC_KIND_GRED, network, filename, section_line, &qdisc);
|
|
||||||
if (r == -ENOMEM)
|
|
||||||
return log_oom();
|
|
||||||
if (r < 0)
|
|
||||||
return log_syntax(unit, LOG_ERR, filename, line, r,
|
|
||||||
"More than one kind of queueing discipline, ignoring assignment: %m");
|
|
||||||
|
|
||||||
gred = GRED(qdisc);
|
|
||||||
|
|
||||||
if (streq(lvalue, "VirtualQueues"))
|
|
||||||
p = &gred->virtual_queues;
|
|
||||||
else if (streq(lvalue, "DefaultVirtualQueue"))
|
|
||||||
p = &gred->default_virtual_queue;
|
|
||||||
else
|
|
||||||
assert_not_reached("Invalid lvalue.");
|
|
||||||
|
|
||||||
if (isempty(rvalue)) {
|
|
||||||
*p = 0;
|
|
||||||
|
|
||||||
qdisc = NULL;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
r = safe_atou32(rvalue, &v);
|
|
||||||
if (r < 0) {
|
|
||||||
log_syntax(unit, LOG_ERR, filename, line, r,
|
|
||||||
"Failed to parse '%s=', ignoring assignment: %s",
|
|
||||||
lvalue, rvalue);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (v > MAX_DPs) {
|
|
||||||
log_syntax(unit, LOG_ERR, filename, line, 0,
|
|
||||||
"Invalid '%s=', ignoring assignment: %s",
|
|
||||||
lvalue, rvalue);
|
|
||||||
}
|
|
||||||
|
|
||||||
*p = v;
|
|
||||||
qdisc = NULL;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
int config_parse_generic_random_early_detection_bool(
|
|
||||||
const char *unit,
|
|
||||||
const char *filename,
|
|
||||||
unsigned line,
|
|
||||||
const char *section,
|
|
||||||
unsigned section_line,
|
|
||||||
const char *lvalue,
|
|
||||||
int ltype,
|
|
||||||
const char *rvalue,
|
|
||||||
void *data,
|
|
||||||
void *userdata) {
|
|
||||||
|
|
||||||
_cleanup_(qdisc_free_or_set_invalidp) QDisc *qdisc = NULL;
|
|
||||||
GenericRandomEarlyDetection *gred;
|
|
||||||
Network *network = data;
|
|
||||||
int r;
|
|
||||||
|
|
||||||
assert(filename);
|
|
||||||
assert(lvalue);
|
|
||||||
assert(rvalue);
|
|
||||||
assert(data);
|
|
||||||
|
|
||||||
r = qdisc_new_static(QDISC_KIND_GRED, network, filename, section_line, &qdisc);
|
|
||||||
if (r == -ENOMEM)
|
|
||||||
return log_oom();
|
|
||||||
if (r < 0)
|
|
||||||
return log_syntax(unit, LOG_ERR, filename, line, r,
|
|
||||||
"More than one kind of queueing discipline, ignoring assignment: %m");
|
|
||||||
|
|
||||||
gred = GRED(qdisc);
|
|
||||||
|
|
||||||
if (isempty(rvalue)) {
|
|
||||||
gred->grio = -1;
|
|
||||||
|
|
||||||
qdisc = NULL;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
r = parse_boolean(rvalue);
|
|
||||||
if (r < 0) {
|
|
||||||
log_syntax(unit, LOG_ERR, filename, line, r,
|
|
||||||
"Failed to parse '%s=', ignoring assignment: %s",
|
|
||||||
lvalue, rvalue);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
gred->grio = r;
|
|
||||||
qdisc = NULL;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
const QDiscVTable gred_vtable = {
|
|
||||||
.object_size = sizeof(GenericRandomEarlyDetection),
|
|
||||||
.tca_kind = "gred",
|
|
||||||
.init = generic_random_early_detection_init,
|
|
||||||
.fill_message = generic_random_early_detection_fill_message,
|
|
||||||
.verify = generic_random_early_detection_verify,
|
|
||||||
};
|
|
|
@ -1,20 +0,0 @@
|
||||||
/* SPDX-License-Identifier: LGPL-2.1+
|
|
||||||
* Copyright © 2020 VMware, Inc. */
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "conf-parser.h"
|
|
||||||
#include "qdisc.h"
|
|
||||||
|
|
||||||
typedef struct GenericRandomEarlyDetection {
|
|
||||||
QDisc meta;
|
|
||||||
|
|
||||||
uint32_t virtual_queues;
|
|
||||||
uint32_t default_virtual_queue;
|
|
||||||
int grio;
|
|
||||||
} GenericRandomEarlyDetection;
|
|
||||||
|
|
||||||
DEFINE_QDISC_CAST(GRED, GenericRandomEarlyDetection);
|
|
||||||
extern const QDiscVTable gred_vtable;
|
|
||||||
|
|
||||||
CONFIG_PARSER_PROTOTYPE(config_parse_generic_random_early_detection_u32);
|
|
||||||
CONFIG_PARSER_PROTOTYPE(config_parse_generic_random_early_detection_bool);
|
|
|
@ -1,279 +0,0 @@
|
||||||
/* SPDX-License-Identifier: LGPL-2.1+ */
|
|
||||||
|
|
||||||
#include <linux/pkt_sched.h>
|
|
||||||
|
|
||||||
#include "alloc-util.h"
|
|
||||||
#include "conf-parser.h"
|
|
||||||
#include "netlink-util.h"
|
|
||||||
#include "parse-util.h"
|
|
||||||
#include "qdisc.h"
|
|
||||||
#include "htb.h"
|
|
||||||
#include "string-util.h"
|
|
||||||
#include "tc-util.h"
|
|
||||||
|
|
||||||
static int hierarchy_token_bucket_fill_message(Link *link, QDisc *qdisc, sd_netlink_message *req) {
|
|
||||||
HierarchyTokenBucket *htb;
|
|
||||||
struct tc_htb_glob opt = {
|
|
||||||
.rate2quantum = 10,
|
|
||||||
.version = 3,
|
|
||||||
};
|
|
||||||
int r;
|
|
||||||
|
|
||||||
assert(link);
|
|
||||||
assert(qdisc);
|
|
||||||
assert(req);
|
|
||||||
|
|
||||||
htb = HTB(qdisc);
|
|
||||||
|
|
||||||
opt.defcls = htb->default_class;
|
|
||||||
|
|
||||||
r = sd_netlink_message_open_container_union(req, TCA_OPTIONS, "htb");
|
|
||||||
if (r < 0)
|
|
||||||
return log_link_error_errno(link, r, "Could not open container TCA_OPTIONS: %m");
|
|
||||||
|
|
||||||
r = sd_netlink_message_append_data(req, TCA_HTB_INIT, &opt, sizeof(opt));
|
|
||||||
if (r < 0)
|
|
||||||
return log_link_error_errno(link, r, "Could not append TCA_HTB_INIT attribute: %m");
|
|
||||||
|
|
||||||
r = sd_netlink_message_close_container(req);
|
|
||||||
if (r < 0)
|
|
||||||
return log_link_error_errno(link, r, "Could not close container TCA_OPTIONS: %m");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int config_parse_hierarchy_token_bucket_default_class(
|
|
||||||
const char *unit,
|
|
||||||
const char *filename,
|
|
||||||
unsigned line,
|
|
||||||
const char *section,
|
|
||||||
unsigned section_line,
|
|
||||||
const char *lvalue,
|
|
||||||
int ltype,
|
|
||||||
const char *rvalue,
|
|
||||||
void *data,
|
|
||||||
void *userdata) {
|
|
||||||
|
|
||||||
_cleanup_(qdisc_free_or_set_invalidp) QDisc *qdisc = NULL;
|
|
||||||
HierarchyTokenBucket *htb;
|
|
||||||
Network *network = data;
|
|
||||||
int r;
|
|
||||||
|
|
||||||
assert(filename);
|
|
||||||
assert(lvalue);
|
|
||||||
assert(rvalue);
|
|
||||||
assert(data);
|
|
||||||
|
|
||||||
r = qdisc_new_static(QDISC_KIND_HTB, network, filename, section_line, &qdisc);
|
|
||||||
if (r == -ENOMEM)
|
|
||||||
return log_oom();
|
|
||||||
if (r < 0)
|
|
||||||
return log_syntax(unit, LOG_ERR, filename, line, r,
|
|
||||||
"More than one kind of queueing discipline, ignoring assignment: %m");
|
|
||||||
|
|
||||||
htb = HTB(qdisc);
|
|
||||||
|
|
||||||
if (isempty(rvalue)) {
|
|
||||||
htb->default_class = 0;
|
|
||||||
|
|
||||||
qdisc = NULL;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
r = safe_atou32_full(rvalue, 16, &htb->default_class);
|
|
||||||
if (r < 0) {
|
|
||||||
log_syntax(unit, LOG_ERR, filename, line, r,
|
|
||||||
"Failed to parse '%s=', ignoring assignment: %s",
|
|
||||||
lvalue, rvalue);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
qdisc = NULL;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
const QDiscVTable htb_vtable = {
|
|
||||||
.object_size = sizeof(HierarchyTokenBucket),
|
|
||||||
.tca_kind = "htb",
|
|
||||||
.fill_message = hierarchy_token_bucket_fill_message,
|
|
||||||
};
|
|
||||||
|
|
||||||
static int hierarchy_token_bucket_class_fill_message(Link *link, TClass *tclass, sd_netlink_message *req) {
|
|
||||||
HierarchyTokenBucketClass *htb;
|
|
||||||
struct tc_htb_opt opt = {};
|
|
||||||
uint32_t rtab[256], ctab[256], mtu = 1600; /* Ethernet packet length */
|
|
||||||
int r;
|
|
||||||
|
|
||||||
assert(link);
|
|
||||||
assert(tclass);
|
|
||||||
assert(req);
|
|
||||||
|
|
||||||
htb = TCLASS_TO_HTB(tclass);
|
|
||||||
|
|
||||||
if (htb->ceil_rate == 0)
|
|
||||||
htb->ceil_rate = htb->rate;
|
|
||||||
|
|
||||||
opt.prio = htb->priority;
|
|
||||||
opt.rate.rate = (htb->rate >= (1ULL << 32)) ? ~0U : htb->rate;
|
|
||||||
opt.ceil.rate = (htb->ceil_rate >= (1ULL << 32)) ? ~0U : htb->ceil_rate;
|
|
||||||
r = tc_transmit_time(htb->rate, mtu, &opt.buffer);
|
|
||||||
if (r < 0)
|
|
||||||
return log_link_error_errno(link, r, "Failed to calculate buffer size: %m");
|
|
||||||
|
|
||||||
r = tc_transmit_time(htb->ceil_rate, mtu, &opt.cbuffer);
|
|
||||||
if (r < 0)
|
|
||||||
return log_link_error_errno(link, r, "Failed to calculate ceil buffer size: %m");
|
|
||||||
|
|
||||||
r = tc_fill_ratespec_and_table(&opt.rate, rtab, mtu);
|
|
||||||
if (r < 0)
|
|
||||||
return log_link_error_errno(link, r, "Failed to calculate rate table: %m");
|
|
||||||
|
|
||||||
r = tc_fill_ratespec_and_table(&opt.ceil, ctab, mtu);
|
|
||||||
if (r < 0)
|
|
||||||
return log_link_error_errno(link, r, "Failed to calculate ceil rate table: %m");
|
|
||||||
|
|
||||||
r = sd_netlink_message_open_container_union(req, TCA_OPTIONS, "htb");
|
|
||||||
if (r < 0)
|
|
||||||
return log_link_error_errno(link, r, "Could not open container TCA_OPTIONS: %m");
|
|
||||||
|
|
||||||
r = sd_netlink_message_append_data(req, TCA_HTB_PARMS, &opt, sizeof(opt));
|
|
||||||
if (r < 0)
|
|
||||||
return log_link_error_errno(link, r, "Could not append TCA_HTB_PARMS attribute: %m");
|
|
||||||
|
|
||||||
if (htb->rate >= (1ULL << 32)) {
|
|
||||||
r = sd_netlink_message_append_u64(req, TCA_HTB_RATE64, htb->rate);
|
|
||||||
if (r < 0)
|
|
||||||
return log_link_error_errno(link, r, "Could not append TCA_HTB_RATE64 attribute: %m");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (htb->ceil_rate >= (1ULL << 32)) {
|
|
||||||
r = sd_netlink_message_append_u64(req, TCA_HTB_CEIL64, htb->ceil_rate);
|
|
||||||
if (r < 0)
|
|
||||||
return log_link_error_errno(link, r, "Could not append TCA_HTB_CEIL64 attribute: %m");
|
|
||||||
}
|
|
||||||
|
|
||||||
r = sd_netlink_message_append_data(req, TCA_HTB_RTAB, rtab, sizeof(rtab));
|
|
||||||
if (r < 0)
|
|
||||||
return log_link_error_errno(link, r, "Could not append TCA_HTB_RTAB attribute: %m");
|
|
||||||
|
|
||||||
r = sd_netlink_message_append_data(req, TCA_HTB_CTAB, ctab, sizeof(ctab));
|
|
||||||
if (r < 0)
|
|
||||||
return log_link_error_errno(link, r, "Could not append TCA_HTB_CTAB attribute: %m");
|
|
||||||
|
|
||||||
r = sd_netlink_message_close_container(req);
|
|
||||||
if (r < 0)
|
|
||||||
return log_link_error_errno(link, r, "Could not close container TCA_OPTIONS: %m");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int config_parse_hierarchy_token_bucket_u32(
|
|
||||||
const char *unit,
|
|
||||||
const char *filename,
|
|
||||||
unsigned line,
|
|
||||||
const char *section,
|
|
||||||
unsigned section_line,
|
|
||||||
const char *lvalue,
|
|
||||||
int ltype,
|
|
||||||
const char *rvalue,
|
|
||||||
void *data,
|
|
||||||
void *userdata) {
|
|
||||||
|
|
||||||
_cleanup_(tclass_free_or_set_invalidp) TClass *tclass = NULL;
|
|
||||||
HierarchyTokenBucketClass *htb;
|
|
||||||
Network *network = data;
|
|
||||||
int r;
|
|
||||||
|
|
||||||
assert(filename);
|
|
||||||
assert(lvalue);
|
|
||||||
assert(rvalue);
|
|
||||||
assert(data);
|
|
||||||
|
|
||||||
r = tclass_new_static(TCLASS_KIND_HTB, network, filename, section_line, &tclass);
|
|
||||||
if (r < 0)
|
|
||||||
return log_syntax(unit, LOG_ERR, filename, line, r,
|
|
||||||
"Failed to create traffic control class, ignoring assignment: %m");
|
|
||||||
|
|
||||||
htb = TCLASS_TO_HTB(tclass);
|
|
||||||
|
|
||||||
if (isempty(rvalue)) {
|
|
||||||
htb->priority = 0;
|
|
||||||
|
|
||||||
tclass = NULL;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
r = safe_atou32(rvalue, &htb->priority);
|
|
||||||
if (r < 0) {
|
|
||||||
log_syntax(unit, LOG_ERR, filename, line, r,
|
|
||||||
"Failed to parse '%s=', ignoring assignment: %s",
|
|
||||||
lvalue, rvalue);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
tclass = NULL;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int config_parse_hierarchy_token_bucket_rate(
|
|
||||||
const char *unit,
|
|
||||||
const char *filename,
|
|
||||||
unsigned line,
|
|
||||||
const char *section,
|
|
||||||
unsigned section_line,
|
|
||||||
const char *lvalue,
|
|
||||||
int ltype,
|
|
||||||
const char *rvalue,
|
|
||||||
void *data,
|
|
||||||
void *userdata) {
|
|
||||||
|
|
||||||
_cleanup_(tclass_free_or_set_invalidp) TClass *tclass = NULL;
|
|
||||||
HierarchyTokenBucketClass *htb;
|
|
||||||
Network *network = data;
|
|
||||||
uint64_t *v;
|
|
||||||
int r;
|
|
||||||
|
|
||||||
assert(filename);
|
|
||||||
assert(lvalue);
|
|
||||||
assert(rvalue);
|
|
||||||
assert(data);
|
|
||||||
|
|
||||||
r = tclass_new_static(TCLASS_KIND_HTB, network, filename, section_line, &tclass);
|
|
||||||
if (r < 0)
|
|
||||||
return log_syntax(unit, LOG_ERR, filename, line, r,
|
|
||||||
"Failed to create traffic control class, ignoring assignment: %m");
|
|
||||||
|
|
||||||
htb = TCLASS_TO_HTB(tclass);
|
|
||||||
if (streq(lvalue, "Rate"))
|
|
||||||
v = &htb->rate;
|
|
||||||
else if (streq(lvalue, "CeilRate"))
|
|
||||||
v = &htb->ceil_rate;
|
|
||||||
else
|
|
||||||
assert_not_reached("Invalid lvalue");
|
|
||||||
|
|
||||||
if (isempty(rvalue)) {
|
|
||||||
*v = 0;
|
|
||||||
|
|
||||||
tclass = NULL;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
r = parse_size(rvalue, 1000, v);
|
|
||||||
if (r < 0) {
|
|
||||||
log_syntax(unit, LOG_ERR, filename, line, r,
|
|
||||||
"Failed to parse '%s=', ignoring assignment: %s",
|
|
||||||
lvalue, rvalue);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
*v /= 8;
|
|
||||||
tclass = NULL;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
const TClassVTable htb_tclass_vtable = {
|
|
||||||
.object_size = sizeof(HierarchyTokenBucketClass),
|
|
||||||
.tca_kind = "htb",
|
|
||||||
.fill_message = hierarchy_token_bucket_class_fill_message,
|
|
||||||
};
|
|
|
@ -1,31 +0,0 @@
|
||||||
/* SPDX-License-Identifier: LGPL-2.1+ */
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "conf-parser.h"
|
|
||||||
#include "qdisc.h"
|
|
||||||
#include "tclass.h"
|
|
||||||
|
|
||||||
typedef struct HierarchyTokenBucket {
|
|
||||||
QDisc meta;
|
|
||||||
|
|
||||||
uint32_t default_class;
|
|
||||||
} HierarchyTokenBucket;
|
|
||||||
|
|
||||||
DEFINE_QDISC_CAST(HTB, HierarchyTokenBucket);
|
|
||||||
extern const QDiscVTable htb_vtable;
|
|
||||||
|
|
||||||
CONFIG_PARSER_PROTOTYPE(config_parse_hierarchy_token_bucket_default_class);
|
|
||||||
|
|
||||||
typedef struct HierarchyTokenBucketClass {
|
|
||||||
TClass meta;
|
|
||||||
|
|
||||||
uint32_t priority;
|
|
||||||
uint64_t rate;
|
|
||||||
uint64_t ceil_rate;
|
|
||||||
} HierarchyTokenBucketClass;
|
|
||||||
|
|
||||||
DEFINE_TCLASS_CAST(HTB, HierarchyTokenBucketClass);
|
|
||||||
extern const TClassVTable htb_tclass_vtable;
|
|
||||||
|
|
||||||
CONFIG_PARSER_PROTOTYPE(config_parse_hierarchy_token_bucket_u32);
|
|
||||||
CONFIG_PARSER_PROTOTYPE(config_parse_hierarchy_token_bucket_rate);
|
|
|
@ -12,19 +12,12 @@
|
||||||
#include "qdisc.h"
|
#include "qdisc.h"
|
||||||
#include "set.h"
|
#include "set.h"
|
||||||
#include "string-util.h"
|
#include "string-util.h"
|
||||||
#include "strv.h"
|
|
||||||
#include "tc-util.h"
|
|
||||||
|
|
||||||
const QDiscVTable * const qdisc_vtable[_QDISC_KIND_MAX] = {
|
const QDiscVTable * const qdisc_vtable[_QDISC_KIND_MAX] = {
|
||||||
[QDISC_KIND_CAKE] = &cake_vtable,
|
|
||||||
[QDISC_KIND_CODEL] = &codel_vtable,
|
[QDISC_KIND_CODEL] = &codel_vtable,
|
||||||
[QDISC_KIND_FQ] = &fq_vtable,
|
[QDISC_KIND_FQ] = &fq_vtable,
|
||||||
[QDISC_KIND_FQ_CODEL] = &fq_codel_vtable,
|
[QDISC_KIND_FQ_CODEL] = &fq_codel_vtable,
|
||||||
[QDISC_KIND_GRED] = &gred_vtable,
|
|
||||||
[QDISC_KIND_HTB] = &htb_vtable,
|
|
||||||
[QDISC_KIND_NETEM] = &netem_vtable,
|
[QDISC_KIND_NETEM] = &netem_vtable,
|
||||||
[QDISC_KIND_PFIFO] = &pfifo_vtable,
|
|
||||||
[QDISC_KIND_SFB] = &sfb_vtable,
|
|
||||||
[QDISC_KIND_SFQ] = &sfq_vtable,
|
[QDISC_KIND_SFQ] = &sfq_vtable,
|
||||||
[QDISC_KIND_TBF] = &tbf_vtable,
|
[QDISC_KIND_TBF] = &tbf_vtable,
|
||||||
[QDISC_KIND_TEQL] = &teql_vtable,
|
[QDISC_KIND_TEQL] = &teql_vtable,
|
||||||
|
@ -40,7 +33,6 @@ static int qdisc_new(QDiscKind kind, QDisc **ret) {
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
*qdisc = (QDisc) {
|
*qdisc = (QDisc) {
|
||||||
.meta.kind = TC_KIND_QDISC,
|
|
||||||
.family = AF_UNSPEC,
|
.family = AF_UNSPEC,
|
||||||
.parent = TC_H_ROOT,
|
.parent = TC_H_ROOT,
|
||||||
.kind = kind,
|
.kind = kind,
|
||||||
|
@ -50,7 +42,6 @@ static int qdisc_new(QDiscKind kind, QDisc **ret) {
|
||||||
if (!qdisc)
|
if (!qdisc)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
qdisc->meta.kind = TC_KIND_QDISC,
|
|
||||||
qdisc->family = AF_UNSPEC;
|
qdisc->family = AF_UNSPEC;
|
||||||
qdisc->parent = TC_H_ROOT;
|
qdisc->parent = TC_H_ROOT;
|
||||||
qdisc->kind = kind;
|
qdisc->kind = kind;
|
||||||
|
@ -70,8 +61,7 @@ static int qdisc_new(QDiscKind kind, QDisc **ret) {
|
||||||
int qdisc_new_static(QDiscKind kind, Network *network, const char *filename, unsigned section_line, QDisc **ret) {
|
int qdisc_new_static(QDiscKind kind, Network *network, const char *filename, unsigned section_line, QDisc **ret) {
|
||||||
_cleanup_(network_config_section_freep) NetworkConfigSection *n = NULL;
|
_cleanup_(network_config_section_freep) NetworkConfigSection *n = NULL;
|
||||||
_cleanup_(qdisc_freep) QDisc *qdisc = NULL;
|
_cleanup_(qdisc_freep) QDisc *qdisc = NULL;
|
||||||
TrafficControl *existing;
|
QDisc *existing;
|
||||||
QDisc *q = NULL;
|
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
assert(network);
|
assert(network);
|
||||||
|
@ -83,20 +73,15 @@ int qdisc_new_static(QDiscKind kind, Network *network, const char *filename, uns
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
existing = ordered_hashmap_get(network->tc_by_section, n);
|
existing = ordered_hashmap_get(network->qdiscs_by_section, n);
|
||||||
if (existing) {
|
if (existing) {
|
||||||
if (existing->kind != TC_KIND_QDISC)
|
if (existing->kind != _QDISC_KIND_INVALID &&
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
q = TC_TO_QDISC(existing);
|
|
||||||
|
|
||||||
if (q->kind != _QDISC_KIND_INVALID &&
|
|
||||||
kind != _QDISC_KIND_INVALID &&
|
kind != _QDISC_KIND_INVALID &&
|
||||||
q->kind != kind)
|
existing->kind != kind)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (q->kind == kind || kind == _QDISC_KIND_INVALID) {
|
if (existing->kind == kind || kind == _QDISC_KIND_INVALID) {
|
||||||
*ret = q;
|
*ret = existing;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -105,23 +90,23 @@ int qdisc_new_static(QDiscKind kind, Network *network, const char *filename, uns
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
if (q) {
|
if (existing) {
|
||||||
qdisc->family = q->family;
|
qdisc->family = existing->family;
|
||||||
qdisc->handle = q->handle;
|
qdisc->handle = existing->handle;
|
||||||
qdisc->parent = q->parent;
|
qdisc->parent = existing->parent;
|
||||||
qdisc->tca_kind = TAKE_PTR(q->tca_kind);
|
qdisc->tca_kind = TAKE_PTR(existing->tca_kind);
|
||||||
|
|
||||||
qdisc_free(q);
|
qdisc_free(ordered_hashmap_remove(network->qdiscs_by_section, n));
|
||||||
}
|
}
|
||||||
|
|
||||||
qdisc->network = network;
|
qdisc->network = network;
|
||||||
qdisc->section = TAKE_PTR(n);
|
qdisc->section = TAKE_PTR(n);
|
||||||
|
|
||||||
r = ordered_hashmap_ensure_allocated(&network->tc_by_section, &network_config_hash_ops);
|
r = ordered_hashmap_ensure_allocated(&network->qdiscs_by_section, &network_config_hash_ops);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
r = ordered_hashmap_put(network->tc_by_section, qdisc->section, TC(qdisc));
|
r = ordered_hashmap_put(network->qdiscs_by_section, qdisc->section, qdisc);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
|
@ -134,7 +119,7 @@ void qdisc_free(QDisc *qdisc) {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (qdisc->network && qdisc->section)
|
if (qdisc->network && qdisc->section)
|
||||||
ordered_hashmap_remove(qdisc->network->tc_by_section, qdisc->section);
|
ordered_hashmap_remove(qdisc->network->qdiscs_by_section, qdisc->section);
|
||||||
|
|
||||||
network_config_section_free(qdisc->section);
|
network_config_section_free(qdisc->section);
|
||||||
|
|
||||||
|
@ -146,8 +131,8 @@ static int qdisc_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link) {
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
assert(link);
|
assert(link);
|
||||||
assert(link->tc_messages > 0);
|
assert(link->qdisc_messages > 0);
|
||||||
link->tc_messages--;
|
link->qdisc_messages--;
|
||||||
|
|
||||||
if (IN_SET(link->state, LINK_STATE_FAILED, LINK_STATE_LINGER))
|
if (IN_SET(link->state, LINK_STATE_FAILED, LINK_STATE_LINGER))
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -159,9 +144,9 @@ static int qdisc_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (link->tc_messages == 0) {
|
if (link->qdisc_messages == 0) {
|
||||||
log_link_debug(link, "Traffic control configured");
|
log_link_debug(link, "QDisc configured");
|
||||||
link->tc_configured = true;
|
link->qdiscs_configured = true;
|
||||||
link_check_ready(link);
|
link_check_ready(link);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,7 +203,7 @@ int qdisc_configure(Link *link, QDisc *qdisc) {
|
||||||
return log_link_error_errno(link, r, "Could not send rtnetlink message: %m");
|
return log_link_error_errno(link, r, "Could not send rtnetlink message: %m");
|
||||||
|
|
||||||
link_ref(link);
|
link_ref(link);
|
||||||
link->tc_messages++;
|
link->qdisc_messages++;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -294,21 +279,19 @@ int config_parse_qdisc_parent(
|
||||||
qdisc->parent = TC_H_INGRESS;
|
qdisc->parent = TC_H_INGRESS;
|
||||||
qdisc->handle = TC_H_MAKE(TC_H_INGRESS, 0);
|
qdisc->handle = TC_H_MAKE(TC_H_INGRESS, 0);
|
||||||
} else {
|
} else {
|
||||||
r = parse_handle(rvalue, &qdisc->parent);
|
log_syntax(unit, LOG_ERR, filename, line, r,
|
||||||
if (r < 0) {
|
"Failed to parse 'Parent=', ignoring assignment: %s",
|
||||||
log_syntax(unit, LOG_ERR, filename, line, r,
|
rvalue);
|
||||||
"Failed to parse 'Parent=', ignoring assignment: %s",
|
return 0;
|
||||||
rvalue);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (STR_IN_SET(rvalue, "clsact", "ingress")) {
|
if (streq(rvalue, "root"))
|
||||||
|
qdisc->tca_kind = mfree(qdisc->tca_kind);
|
||||||
|
else {
|
||||||
r = free_and_strdup(&qdisc->tca_kind, rvalue);
|
r = free_and_strdup(&qdisc->tca_kind, rvalue);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_oom();
|
return log_oom();
|
||||||
} else
|
}
|
||||||
qdisc->tca_kind = mfree(qdisc->tca_kind);
|
|
||||||
|
|
||||||
qdisc = NULL;
|
qdisc = NULL;
|
||||||
|
|
||||||
|
|
|
@ -6,18 +6,12 @@
|
||||||
#include "networkd-link.h"
|
#include "networkd-link.h"
|
||||||
#include "networkd-network.h"
|
#include "networkd-network.h"
|
||||||
#include "networkd-util.h"
|
#include "networkd-util.h"
|
||||||
#include "tc.h"
|
|
||||||
|
|
||||||
typedef enum QDiscKind {
|
typedef enum QDiscKind {
|
||||||
QDISC_KIND_CAKE,
|
|
||||||
QDISC_KIND_CODEL,
|
QDISC_KIND_CODEL,
|
||||||
QDISC_KIND_FQ,
|
QDISC_KIND_FQ,
|
||||||
QDISC_KIND_FQ_CODEL,
|
QDISC_KIND_FQ_CODEL,
|
||||||
QDISC_KIND_GRED,
|
|
||||||
QDISC_KIND_HTB,
|
|
||||||
QDISC_KIND_NETEM,
|
QDISC_KIND_NETEM,
|
||||||
QDISC_KIND_PFIFO,
|
|
||||||
QDISC_KIND_SFB,
|
|
||||||
QDISC_KIND_SFQ,
|
QDISC_KIND_SFQ,
|
||||||
QDISC_KIND_TBF,
|
QDISC_KIND_TBF,
|
||||||
QDISC_KIND_TEQL,
|
QDISC_KIND_TEQL,
|
||||||
|
@ -26,8 +20,6 @@ typedef enum QDiscKind {
|
||||||
} QDiscKind;
|
} QDiscKind;
|
||||||
|
|
||||||
typedef struct QDisc {
|
typedef struct QDisc {
|
||||||
TrafficControl meta;
|
|
||||||
|
|
||||||
NetworkConfigSection *section;
|
NetworkConfigSection *section;
|
||||||
Network *network;
|
Network *network;
|
||||||
|
|
||||||
|
@ -73,20 +65,13 @@ int qdisc_section_verify(QDisc *qdisc, bool *has_root, bool *has_clsact);
|
||||||
|
|
||||||
DEFINE_NETWORK_SECTION_FUNCTIONS(QDisc, qdisc_free);
|
DEFINE_NETWORK_SECTION_FUNCTIONS(QDisc, qdisc_free);
|
||||||
|
|
||||||
DEFINE_TC_CAST(QDISC, QDisc);
|
|
||||||
|
|
||||||
CONFIG_PARSER_PROTOTYPE(config_parse_qdisc_parent);
|
CONFIG_PARSER_PROTOTYPE(config_parse_qdisc_parent);
|
||||||
CONFIG_PARSER_PROTOTYPE(config_parse_qdisc_handle);
|
CONFIG_PARSER_PROTOTYPE(config_parse_qdisc_handle);
|
||||||
|
|
||||||
#include "cake.h"
|
|
||||||
#include "codel.h"
|
#include "codel.h"
|
||||||
#include "fifo.h"
|
|
||||||
#include "fq-codel.h"
|
#include "fq-codel.h"
|
||||||
#include "fq.h"
|
#include "fq.h"
|
||||||
#include "gred.h"
|
|
||||||
#include "htb.h"
|
|
||||||
#include "netem.h"
|
#include "netem.h"
|
||||||
#include "sfb.h"
|
|
||||||
#include "sfq.h"
|
#include "sfq.h"
|
||||||
#include "tbf.h"
|
#include "tbf.h"
|
||||||
#include "teql.h"
|
#include "teql.h"
|
||||||
|
|
|
@ -1,106 +0,0 @@
|
||||||
/* SPDX-License-Identifier: LGPL-2.1+
|
|
||||||
* Copyright © 2020 VMware, Inc. */
|
|
||||||
|
|
||||||
#include <linux/pkt_sched.h>
|
|
||||||
|
|
||||||
#include "alloc-util.h"
|
|
||||||
#include "conf-parser.h"
|
|
||||||
#include "netlink-util.h"
|
|
||||||
#include "parse-util.h"
|
|
||||||
#include "qdisc.h"
|
|
||||||
#include "sfb.h"
|
|
||||||
#include "string-util.h"
|
|
||||||
|
|
||||||
static int stochastic_fair_blue_fill_message(Link *link, QDisc *qdisc, sd_netlink_message *req) {
|
|
||||||
StochasticFairBlue *sfb;
|
|
||||||
struct tc_sfb_qopt opt = {
|
|
||||||
.rehash_interval = 600*1000,
|
|
||||||
.warmup_time = 60*1000,
|
|
||||||
.penalty_rate = 10,
|
|
||||||
.penalty_burst = 20,
|
|
||||||
.increment = (SFB_MAX_PROB + 1000) / 2000,
|
|
||||||
.decrement = (SFB_MAX_PROB + 10000) / 20000,
|
|
||||||
.max = 25,
|
|
||||||
.bin_size = 20,
|
|
||||||
};
|
|
||||||
int r;
|
|
||||||
|
|
||||||
assert(link);
|
|
||||||
assert(qdisc);
|
|
||||||
assert(req);
|
|
||||||
|
|
||||||
sfb = SFB(qdisc);
|
|
||||||
|
|
||||||
opt.limit = sfb->packet_limit;
|
|
||||||
|
|
||||||
r = sd_netlink_message_open_container_union(req, TCA_OPTIONS, "sfb");
|
|
||||||
if (r < 0)
|
|
||||||
return log_link_error_errno(link, r, "Could not open container TCA_OPTIONS: %m");
|
|
||||||
|
|
||||||
r = sd_netlink_message_append_data(req, TCA_SFB_PARMS, &opt, sizeof(struct tc_sfb_qopt));
|
|
||||||
if (r < 0)
|
|
||||||
return log_link_error_errno(link, r, "Could not append TCA_SFB_PARMS attribute: %m");
|
|
||||||
|
|
||||||
r = sd_netlink_message_close_container(req);
|
|
||||||
if (r < 0)
|
|
||||||
return log_link_error_errno(link, r, "Could not close container TCA_OPTIONS: %m");
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int config_parse_stochastic_fair_blue_u32(
|
|
||||||
const char *unit,
|
|
||||||
const char *filename,
|
|
||||||
unsigned line,
|
|
||||||
const char *section,
|
|
||||||
unsigned section_line,
|
|
||||||
const char *lvalue,
|
|
||||||
int ltype,
|
|
||||||
const char *rvalue,
|
|
||||||
void *data,
|
|
||||||
void *userdata) {
|
|
||||||
|
|
||||||
_cleanup_(qdisc_free_or_set_invalidp) QDisc *qdisc = NULL;
|
|
||||||
StochasticFairBlue *sfb;
|
|
||||||
Network *network = data;
|
|
||||||
int r;
|
|
||||||
|
|
||||||
assert(filename);
|
|
||||||
assert(lvalue);
|
|
||||||
assert(rvalue);
|
|
||||||
assert(data);
|
|
||||||
|
|
||||||
r = qdisc_new_static(QDISC_KIND_SFB, network, filename, section_line, &qdisc);
|
|
||||||
if (r == -ENOMEM)
|
|
||||||
return log_oom();
|
|
||||||
if (r < 0)
|
|
||||||
return log_syntax(unit, LOG_ERR, filename, line, r,
|
|
||||||
"More than one kind of queueing discipline, ignoring assignment: %m");
|
|
||||||
|
|
||||||
sfb = SFB(qdisc);
|
|
||||||
|
|
||||||
if (isempty(rvalue)) {
|
|
||||||
sfb->packet_limit = 0;
|
|
||||||
|
|
||||||
qdisc = NULL;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
r = safe_atou32(rvalue, &sfb->packet_limit);
|
|
||||||
if (r < 0) {
|
|
||||||
log_syntax(unit, LOG_ERR, filename, line, r,
|
|
||||||
"Failed to parse '%s=', ignoring assignment: %s",
|
|
||||||
lvalue, rvalue);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
qdisc = NULL;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
const QDiscVTable sfb_vtable = {
|
|
||||||
.object_size = sizeof(StochasticFairBlue),
|
|
||||||
.tca_kind = "sfb",
|
|
||||||
.fill_message = stochastic_fair_blue_fill_message,
|
|
||||||
};
|
|
|
@ -1,17 +0,0 @@
|
||||||
/* SPDX-License-Identifier: LGPL-2.1+
|
|
||||||
* Copyright © 2020 VMware, Inc. */
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "conf-parser.h"
|
|
||||||
#include "qdisc.h"
|
|
||||||
|
|
||||||
typedef struct StochasticFairBlue {
|
|
||||||
QDisc meta;
|
|
||||||
|
|
||||||
uint32_t packet_limit;
|
|
||||||
} StochasticFairBlue;
|
|
||||||
|
|
||||||
DEFINE_QDISC_CAST(SFB, StochasticFairBlue);
|
|
||||||
extern const QDiscVTable sfb_vtable;
|
|
||||||
|
|
||||||
CONFIG_PARSER_PROTOTYPE(config_parse_stochastic_fair_blue_u32);
|
|
|
@ -2,7 +2,6 @@
|
||||||
* Copyright © 2019 VMware, Inc. */
|
* Copyright © 2019 VMware, Inc. */
|
||||||
|
|
||||||
#include "alloc-util.h"
|
#include "alloc-util.h"
|
||||||
#include "extract-word.h"
|
|
||||||
#include "fileio.h"
|
#include "fileio.h"
|
||||||
#include "parse-util.h"
|
#include "parse-util.h"
|
||||||
#include "tc-util.h"
|
#include "tc-util.h"
|
||||||
|
@ -93,32 +92,3 @@ int tc_fill_ratespec_and_table(struct tc_ratespec *rate, uint32_t *rtab, uint32_
|
||||||
rate->linklayer = TC_LINKLAYER_ETHERNET;
|
rate->linklayer = TC_LINKLAYER_ETHERNET;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int parse_handle(const char *t, uint32_t *ret) {
|
|
||||||
_cleanup_free_ char *word = NULL;
|
|
||||||
uint16_t major, minor;
|
|
||||||
int r;
|
|
||||||
|
|
||||||
assert(t);
|
|
||||||
assert(ret);
|
|
||||||
|
|
||||||
/* Extract the major number. */
|
|
||||||
r = extract_first_word(&t, &word, ":", EXTRACT_DONT_COALESCE_SEPARATORS);
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
if (r == 0)
|
|
||||||
return -EINVAL;
|
|
||||||
if (!t)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
r = safe_atou16_full(word, 16, &major);
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
|
|
||||||
r = safe_atou16_full(t, 16, &minor);
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
|
|
||||||
*ret = ((uint32_t) major << 16) | minor;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
|
@ -10,4 +10,3 @@ int tc_time_to_tick(usec_t t, uint32_t *ret);
|
||||||
int parse_tc_percent(const char *s, uint32_t *percent);
|
int parse_tc_percent(const char *s, uint32_t *percent);
|
||||||
int tc_transmit_time(uint64_t rate, uint32_t size, uint32_t *ret);
|
int tc_transmit_time(uint64_t rate, uint32_t size, uint32_t *ret);
|
||||||
int tc_fill_ratespec_and_table(struct tc_ratespec *rate, uint32_t *rtab, uint32_t mtu);
|
int tc_fill_ratespec_and_table(struct tc_ratespec *rate, uint32_t *rtab, uint32_t mtu);
|
||||||
int parse_handle(const char *t, uint32_t *ret);
|
|
||||||
|
|
|
@ -1,49 +0,0 @@
|
||||||
/* SPDX-License-Identifier: LGPL-2.1+ */
|
|
||||||
|
|
||||||
#include "macro.h"
|
|
||||||
#include "qdisc.h"
|
|
||||||
#include "tc.h"
|
|
||||||
#include "tclass.h"
|
|
||||||
|
|
||||||
void traffic_control_free(TrafficControl *tc) {
|
|
||||||
if (!tc)
|
|
||||||
return;
|
|
||||||
|
|
||||||
switch (tc->kind) {
|
|
||||||
case TC_KIND_QDISC:
|
|
||||||
qdisc_free(TC_TO_QDISC(tc));
|
|
||||||
break;
|
|
||||||
case TC_KIND_TCLASS:
|
|
||||||
tclass_free(TC_TO_TCLASS(tc));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
assert_not_reached("Invalid traffic control type");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int traffic_control_configure(Link *link, TrafficControl *tc) {
|
|
||||||
assert(link);
|
|
||||||
assert(tc);
|
|
||||||
|
|
||||||
switch(tc->kind) {
|
|
||||||
case TC_KIND_QDISC:
|
|
||||||
return qdisc_configure(link, TC_TO_QDISC(tc));
|
|
||||||
case TC_KIND_TCLASS:
|
|
||||||
return tclass_configure(link, TC_TO_TCLASS(tc));
|
|
||||||
default:
|
|
||||||
assert_not_reached("Invalid traffic control type");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int traffic_control_section_verify(TrafficControl *tc, bool *qdisc_has_root, bool *qdisc_has_clsact) {
|
|
||||||
assert(tc);
|
|
||||||
|
|
||||||
switch(tc->kind) {
|
|
||||||
case TC_KIND_QDISC:
|
|
||||||
return qdisc_section_verify(TC_TO_QDISC(tc), qdisc_has_root, qdisc_has_clsact);
|
|
||||||
case TC_KIND_TCLASS:
|
|
||||||
return tclass_section_verify(TC_TO_TCLASS(tc));
|
|
||||||
default:
|
|
||||||
assert_not_reached("Invalid traffic control type");
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,32 +0,0 @@
|
||||||
/* SPDX-License-Identifier: LGPL-2.1+ */
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "networkd-link.h"
|
|
||||||
|
|
||||||
typedef enum TrafficControlKind {
|
|
||||||
TC_KIND_QDISC,
|
|
||||||
TC_KIND_TCLASS,
|
|
||||||
TC_KIND_FILTER,
|
|
||||||
_TC_KIND_MAX,
|
|
||||||
_TC_KIND_INVALID = -1,
|
|
||||||
} TrafficControlKind;
|
|
||||||
|
|
||||||
typedef struct TrafficControl {
|
|
||||||
TrafficControlKind kind;
|
|
||||||
} TrafficControl;
|
|
||||||
|
|
||||||
/* For casting a tc into the various tc kinds */
|
|
||||||
#define DEFINE_TC_CAST(UPPERCASE, MixedCase) \
|
|
||||||
static inline MixedCase* TC_TO_##UPPERCASE(TrafficControl *tc) { \
|
|
||||||
if (_unlikely_(!tc || tc->kind != TC_KIND_##UPPERCASE)) \
|
|
||||||
return NULL; \
|
|
||||||
\
|
|
||||||
return (MixedCase*) tc; \
|
|
||||||
}
|
|
||||||
|
|
||||||
/* For casting the various tc kinds into a tc */
|
|
||||||
#define TC(tc) (&(tc)->meta)
|
|
||||||
|
|
||||||
void traffic_control_free(TrafficControl *tc);
|
|
||||||
int traffic_control_configure(Link *link, TrafficControl *tc);
|
|
||||||
int traffic_control_section_verify(TrafficControl *tc, bool *qdisc_has_root, bool *qdisc_has_clsact);
|
|
|
@ -1,277 +0,0 @@
|
||||||
/* SPDX-License-Identifier: LGPL-2.1+
|
|
||||||
* Copyright © 2019 VMware, Inc. */
|
|
||||||
|
|
||||||
#include <linux/pkt_sched.h>
|
|
||||||
|
|
||||||
#include "alloc-util.h"
|
|
||||||
#include "conf-parser.h"
|
|
||||||
#include "in-addr-util.h"
|
|
||||||
#include "netlink-util.h"
|
|
||||||
#include "networkd-manager.h"
|
|
||||||
#include "parse-util.h"
|
|
||||||
#include "set.h"
|
|
||||||
#include "string-util.h"
|
|
||||||
#include "strv.h"
|
|
||||||
#include "tc-util.h"
|
|
||||||
#include "tclass.h"
|
|
||||||
|
|
||||||
const TClassVTable * const tclass_vtable[_TCLASS_KIND_MAX] = {
|
|
||||||
[TCLASS_KIND_HTB] = &htb_tclass_vtable,
|
|
||||||
};
|
|
||||||
|
|
||||||
static int tclass_new(TClassKind kind, TClass **ret) {
|
|
||||||
TClass *tclass;
|
|
||||||
int r;
|
|
||||||
|
|
||||||
tclass = malloc0(tclass_vtable[kind]->object_size);
|
|
||||||
if (!tclass)
|
|
||||||
return -ENOMEM;
|
|
||||||
|
|
||||||
tclass->meta.kind = TC_KIND_TCLASS,
|
|
||||||
tclass->parent = TC_H_ROOT;
|
|
||||||
tclass->kind = kind;
|
|
||||||
|
|
||||||
if (TCLASS_VTABLE(tclass)->init) {
|
|
||||||
r = TCLASS_VTABLE(tclass)->init(tclass);
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
*ret = TAKE_PTR(tclass);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int tclass_new_static(TClassKind kind, Network *network, const char *filename, unsigned section_line, TClass **ret) {
|
|
||||||
_cleanup_(network_config_section_freep) NetworkConfigSection *n = NULL;
|
|
||||||
_cleanup_(tclass_freep) TClass *tclass = NULL;
|
|
||||||
TrafficControl *existing;
|
|
||||||
int r;
|
|
||||||
|
|
||||||
assert(network);
|
|
||||||
assert(ret);
|
|
||||||
assert(filename);
|
|
||||||
assert(section_line > 0);
|
|
||||||
|
|
||||||
r = network_config_section_new(filename, section_line, &n);
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
|
|
||||||
existing = ordered_hashmap_get(network->tc_by_section, n);
|
|
||||||
if (existing) {
|
|
||||||
TClass *t;
|
|
||||||
|
|
||||||
if (existing->kind != TC_KIND_TCLASS)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
t = TC_TO_TCLASS(existing);
|
|
||||||
|
|
||||||
if (t->kind != kind)
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
*ret = t;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
r = tclass_new(kind, &tclass);
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
|
|
||||||
tclass->network = network;
|
|
||||||
tclass->section = TAKE_PTR(n);
|
|
||||||
|
|
||||||
r = ordered_hashmap_ensure_allocated(&network->tc_by_section, &network_config_hash_ops);
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
|
|
||||||
r = ordered_hashmap_put(network->tc_by_section, tclass->section, tclass);
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
|
|
||||||
*ret = TAKE_PTR(tclass);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void tclass_free(TClass *tclass) {
|
|
||||||
if (!tclass)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (tclass->network && tclass->section)
|
|
||||||
ordered_hashmap_remove(tclass->network->tc_by_section, tclass->section);
|
|
||||||
|
|
||||||
network_config_section_free(tclass->section);
|
|
||||||
|
|
||||||
free(tclass);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int tclass_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link) {
|
|
||||||
int r;
|
|
||||||
|
|
||||||
assert(link);
|
|
||||||
assert(link->tc_messages > 0);
|
|
||||||
link->tc_messages--;
|
|
||||||
|
|
||||||
if (IN_SET(link->state, LINK_STATE_FAILED, LINK_STATE_LINGER))
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
r = sd_netlink_message_get_errno(m);
|
|
||||||
if (r < 0 && r != -EEXIST) {
|
|
||||||
log_link_message_error_errno(link, m, r, "Could not set TClass");
|
|
||||||
link_enter_failed(link);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (link->tc_messages == 0) {
|
|
||||||
log_link_debug(link, "Traffic control configured");
|
|
||||||
link->tc_configured = true;
|
|
||||||
link_check_ready(link);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int tclass_configure(Link *link, TClass *tclass) {
|
|
||||||
_cleanup_(sd_netlink_message_unrefp) sd_netlink_message *req = NULL;
|
|
||||||
int r;
|
|
||||||
|
|
||||||
assert(link);
|
|
||||||
assert(link->manager);
|
|
||||||
assert(link->manager->rtnl);
|
|
||||||
assert(link->ifindex > 0);
|
|
||||||
|
|
||||||
r = sd_rtnl_message_new_tclass(link->manager->rtnl, &req, RTM_NEWTCLASS, AF_UNSPEC, link->ifindex);
|
|
||||||
if (r < 0)
|
|
||||||
return log_link_error_errno(link, r, "Could not create RTM_NEWTCLASS message: %m");
|
|
||||||
|
|
||||||
r = sd_rtnl_message_set_tclass_parent(req, tclass->parent);
|
|
||||||
if (r < 0)
|
|
||||||
return log_link_error_errno(link, r, "Could not create tcm_parent message: %m");
|
|
||||||
|
|
||||||
if (tclass->classid != TC_H_UNSPEC) {
|
|
||||||
r = sd_rtnl_message_set_tclass_handle(req, tclass->classid);
|
|
||||||
if (r < 0)
|
|
||||||
return log_link_error_errno(link, r, "Could not set tcm_handle message: %m");
|
|
||||||
}
|
|
||||||
|
|
||||||
r = sd_netlink_message_append_string(req, TCA_KIND, TCLASS_VTABLE(tclass)->tca_kind);
|
|
||||||
if (r < 0)
|
|
||||||
return log_link_error_errno(link, r, "Could not append TCA_KIND attribute: %m");
|
|
||||||
|
|
||||||
if (TCLASS_VTABLE(tclass)->fill_message) {
|
|
||||||
r = TCLASS_VTABLE(tclass)->fill_message(link, tclass, req);
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
r = netlink_call_async(link->manager->rtnl, NULL, req, tclass_handler, link_netlink_destroy_callback, link);
|
|
||||||
if (r < 0)
|
|
||||||
return log_link_error_errno(link, r, "Could not send rtnetlink message: %m");
|
|
||||||
|
|
||||||
link_ref(link);
|
|
||||||
link->tc_messages++;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int tclass_section_verify(TClass *tclass) {
|
|
||||||
int r;
|
|
||||||
|
|
||||||
assert(tclass);
|
|
||||||
|
|
||||||
if (section_is_invalid(tclass->section))
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
if (TCLASS_VTABLE(tclass)->verify) {
|
|
||||||
r = TCLASS_VTABLE(tclass)->verify(tclass);
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int config_parse_tclass_parent(
|
|
||||||
const char *unit,
|
|
||||||
const char *filename,
|
|
||||||
unsigned line,
|
|
||||||
const char *section,
|
|
||||||
unsigned section_line,
|
|
||||||
const char *lvalue,
|
|
||||||
int ltype,
|
|
||||||
const char *rvalue,
|
|
||||||
void *data,
|
|
||||||
void *userdata) {
|
|
||||||
|
|
||||||
_cleanup_(tclass_free_or_set_invalidp) TClass *tclass = NULL;
|
|
||||||
Network *network = data;
|
|
||||||
int r;
|
|
||||||
|
|
||||||
assert(filename);
|
|
||||||
assert(lvalue);
|
|
||||||
assert(rvalue);
|
|
||||||
assert(data);
|
|
||||||
|
|
||||||
r = tclass_new_static(ltype, network, filename, section_line, &tclass);
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
|
|
||||||
if (streq(rvalue, "root"))
|
|
||||||
tclass->parent = TC_H_ROOT;
|
|
||||||
else {
|
|
||||||
r = parse_handle(rvalue, &tclass->parent);
|
|
||||||
if (r < 0) {
|
|
||||||
log_syntax(unit, LOG_ERR, filename, line, r,
|
|
||||||
"Failed to parse 'Parent=', ignoring assignment: %s",
|
|
||||||
rvalue);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tclass = NULL;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int config_parse_tclass_classid(
|
|
||||||
const char *unit,
|
|
||||||
const char *filename,
|
|
||||||
unsigned line,
|
|
||||||
const char *section,
|
|
||||||
unsigned section_line,
|
|
||||||
const char *lvalue,
|
|
||||||
int ltype,
|
|
||||||
const char *rvalue,
|
|
||||||
void *data,
|
|
||||||
void *userdata) {
|
|
||||||
|
|
||||||
_cleanup_(tclass_free_or_set_invalidp) TClass *tclass = NULL;
|
|
||||||
Network *network = data;
|
|
||||||
int r;
|
|
||||||
|
|
||||||
assert(filename);
|
|
||||||
assert(lvalue);
|
|
||||||
assert(rvalue);
|
|
||||||
assert(data);
|
|
||||||
|
|
||||||
r = tclass_new_static(ltype, network, filename, section_line, &tclass);
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
|
|
||||||
if (isempty(rvalue)) {
|
|
||||||
tclass->classid = TC_H_UNSPEC;
|
|
||||||
tclass = NULL;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
r = parse_handle(rvalue, &tclass->classid);
|
|
||||||
if (r < 0) {
|
|
||||||
log_syntax(unit, LOG_ERR, filename, line, r,
|
|
||||||
"Failed to parse 'ClassId=', ignoring assignment: %s",
|
|
||||||
rvalue);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
tclass = NULL;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,67 +0,0 @@
|
||||||
/* SPDX-License-Identifier: LGPL-2.1+
|
|
||||||
* Copyright © 2019 VMware, Inc. */
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "conf-parser.h"
|
|
||||||
#include "networkd-link.h"
|
|
||||||
#include "networkd-network.h"
|
|
||||||
#include "networkd-util.h"
|
|
||||||
#include "tc.h"
|
|
||||||
|
|
||||||
typedef enum TClassKind {
|
|
||||||
TCLASS_KIND_HTB,
|
|
||||||
_TCLASS_KIND_MAX,
|
|
||||||
_TCLASS_KIND_INVALID = -1,
|
|
||||||
} TClassKind;
|
|
||||||
|
|
||||||
typedef struct TClass {
|
|
||||||
TrafficControl meta;
|
|
||||||
|
|
||||||
NetworkConfigSection *section;
|
|
||||||
Network *network;
|
|
||||||
|
|
||||||
uint32_t classid;
|
|
||||||
uint32_t parent;
|
|
||||||
|
|
||||||
TClassKind kind;
|
|
||||||
} TClass;
|
|
||||||
|
|
||||||
typedef struct TClassVTable {
|
|
||||||
size_t object_size;
|
|
||||||
const char *tca_kind;
|
|
||||||
/* called in tclass_new() */
|
|
||||||
int (*init)(TClass *tclass);
|
|
||||||
int (*fill_message)(Link *link, TClass *tclass, sd_netlink_message *m);
|
|
||||||
int (*verify)(TClass *tclass);
|
|
||||||
} TClassVTable;
|
|
||||||
|
|
||||||
extern const TClassVTable * const tclass_vtable[_TCLASS_KIND_MAX];
|
|
||||||
|
|
||||||
#define TCLASS_VTABLE(t) ((t)->kind != _TCLASS_KIND_INVALID ? tclass_vtable[(t)->kind] : NULL)
|
|
||||||
|
|
||||||
/* For casting a tclass into the various tclass kinds */
|
|
||||||
#define DEFINE_TCLASS_CAST(UPPERCASE, MixedCase) \
|
|
||||||
static inline MixedCase* TCLASS_TO_##UPPERCASE(TClass *t) { \
|
|
||||||
if (_unlikely_(!t || t->kind != TCLASS_KIND_##UPPERCASE)) \
|
|
||||||
return NULL; \
|
|
||||||
\
|
|
||||||
return (MixedCase*) t; \
|
|
||||||
}
|
|
||||||
|
|
||||||
/* For casting the various tclass kinds into a tclass */
|
|
||||||
#define TCLASS(t) (&(t)->meta)
|
|
||||||
|
|
||||||
void tclass_free(TClass *tclass);
|
|
||||||
int tclass_new_static(TClassKind kind, Network *network, const char *filename, unsigned section_line, TClass **ret);
|
|
||||||
|
|
||||||
int tclass_configure(Link *link, TClass *tclass);
|
|
||||||
int tclass_section_verify(TClass *tclass);
|
|
||||||
|
|
||||||
DEFINE_NETWORK_SECTION_FUNCTIONS(TClass, tclass_free);
|
|
||||||
|
|
||||||
DEFINE_TC_CAST(TCLASS, TClass);
|
|
||||||
|
|
||||||
CONFIG_PARSER_PROTOTYPE(config_parse_tclass_parent);
|
|
||||||
CONFIG_PARSER_PROTOTYPE(config_parse_tclass_classid);
|
|
||||||
|
|
||||||
#include "htb.h"
|
|
|
@ -56,19 +56,15 @@ int dnstls_stream_connect_tls(DnsStream *stream, DnsServer *server) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (server->manager->dns_over_tls_mode == DNS_OVER_TLS_YES) {
|
if (server->manager->dns_over_tls_mode == DNS_OVER_TLS_YES) {
|
||||||
if (server->server_name)
|
stream->dnstls_data.validation.type = GNUTLS_DT_IP_ADDRESS;
|
||||||
gnutls_session_set_verify_cert(gs, server->server_name, 0);
|
if (server->family == AF_INET) {
|
||||||
else {
|
stream->dnstls_data.validation.data = (unsigned char*) &server->address.in.s_addr;
|
||||||
stream->dnstls_data.validation.type = GNUTLS_DT_IP_ADDRESS;
|
stream->dnstls_data.validation.size = 4;
|
||||||
if (server->family == AF_INET) {
|
} else {
|
||||||
stream->dnstls_data.validation.data = (unsigned char*) &server->address.in.s_addr;
|
stream->dnstls_data.validation.data = server->address.in6.s6_addr;
|
||||||
stream->dnstls_data.validation.size = 4;
|
stream->dnstls_data.validation.size = 16;
|
||||||
} else {
|
|
||||||
stream->dnstls_data.validation.data = server->address.in6.s6_addr;
|
|
||||||
stream->dnstls_data.validation.size = 16;
|
|
||||||
}
|
|
||||||
gnutls_session_set_verify_cert2(gs, &stream->dnstls_data.validation, 1, 0);
|
|
||||||
}
|
}
|
||||||
|
gnutls_session_set_verify_cert2(gs, &stream->dnstls_data.validation, 1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (server->server_name) {
|
if (server->server_name) {
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
|
|
||||||
#include <openssl/bio.h>
|
#include <openssl/bio.h>
|
||||||
#include <openssl/err.h>
|
#include <openssl/err.h>
|
||||||
#include <openssl/x509v3.h>
|
|
||||||
|
|
||||||
#include "io-util.h"
|
#include "io-util.h"
|
||||||
#include "resolved-dns-stream.h"
|
#include "resolved-dns-stream.h"
|
||||||
|
@ -81,19 +80,13 @@ int dnstls_stream_connect_tls(DnsStream *stream, DnsServer *server) {
|
||||||
|
|
||||||
if (server->manager->dns_over_tls_mode == DNS_OVER_TLS_YES) {
|
if (server->manager->dns_over_tls_mode == DNS_OVER_TLS_YES) {
|
||||||
X509_VERIFY_PARAM *v;
|
X509_VERIFY_PARAM *v;
|
||||||
|
const unsigned char *ip;
|
||||||
|
|
||||||
SSL_set_verify(s, SSL_VERIFY_PEER, NULL);
|
SSL_set_verify(s, SSL_VERIFY_PEER, NULL);
|
||||||
v = SSL_get0_param(s);
|
v = SSL_get0_param(s);
|
||||||
if (server->server_name) {
|
ip = server->family == AF_INET ? (const unsigned char*) &server->address.in.s_addr : server->address.in6.s6_addr;
|
||||||
X509_VERIFY_PARAM_set_hostflags(v, X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS);
|
if (X509_VERIFY_PARAM_set1_ip(v, ip, FAMILY_ADDRESS_SIZE(server->family)) == 0)
|
||||||
if (X509_VERIFY_PARAM_set1_host(v, server->server_name, 0) == 0)
|
return -ECONNREFUSED;
|
||||||
return -ECONNREFUSED;
|
|
||||||
} else {
|
|
||||||
const unsigned char *ip;
|
|
||||||
ip = server->family == AF_INET ? (const unsigned char*) &server->address.in.s_addr : server->address.in6.s6_addr;
|
|
||||||
if (X509_VERIFY_PARAM_set1_ip(v, ip, FAMILY_ADDRESS_SIZE(server->family)) == 0)
|
|
||||||
return -ECONNREFUSED;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (server->server_name) {
|
if (server->server_name) {
|
||||||
|
|
|
@ -851,55 +851,6 @@ int ethtool_set_channels(int *fd, const char *ifname, netdev_channels *channels)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ethtool_set_flow_control(int *fd, const char *ifname, int rx, int tx, int autoneg) {
|
|
||||||
struct ethtool_pauseparam ecmd = {
|
|
||||||
.cmd = ETHTOOL_GPAUSEPARAM
|
|
||||||
};
|
|
||||||
struct ifreq ifr = {
|
|
||||||
.ifr_data = (void*) &ecmd
|
|
||||||
};
|
|
||||||
|
|
||||||
bool need_update = false;
|
|
||||||
int r;
|
|
||||||
|
|
||||||
if (*fd < 0) {
|
|
||||||
r = ethtool_connect_or_warn(fd, true);
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
strscpy(ifr.ifr_name, IFNAMSIZ, ifname);
|
|
||||||
|
|
||||||
r = ioctl(*fd, SIOCETHTOOL, &ifr);
|
|
||||||
if (r < 0)
|
|
||||||
return -errno;
|
|
||||||
|
|
||||||
if (rx >= 0 && ecmd.rx_pause != (uint32_t) rx) {
|
|
||||||
ecmd.rx_pause = rx;
|
|
||||||
need_update = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tx >= 0 && ecmd.tx_pause != (uint32_t) tx) {
|
|
||||||
ecmd.tx_pause = tx;
|
|
||||||
need_update = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (autoneg >= 0 && ecmd.autoneg != (uint32_t) autoneg) {
|
|
||||||
ecmd.autoneg = autoneg;
|
|
||||||
need_update = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (need_update) {
|
|
||||||
ecmd.cmd = ETHTOOL_SPAUSEPARAM;
|
|
||||||
|
|
||||||
r = ioctl(*fd, SIOCETHTOOL, &ifr);
|
|
||||||
if (r < 0)
|
|
||||||
return -errno;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int config_parse_channel(const char *unit,
|
int config_parse_channel(const char *unit,
|
||||||
const char *filename,
|
const char *filename,
|
||||||
unsigned line,
|
unsigned line,
|
||||||
|
|
|
@ -103,7 +103,6 @@ int ethtool_set_glinksettings(int *ethtool_fd, const char *ifname,
|
||||||
int autonegotiation, uint32_t advertise[static N_ADVERTISE],
|
int autonegotiation, uint32_t advertise[static N_ADVERTISE],
|
||||||
uint64_t speed, Duplex duplex, NetDevPort port);
|
uint64_t speed, Duplex duplex, NetDevPort port);
|
||||||
int ethtool_set_channels(int *ethtool_fd, const char *ifname, netdev_channels *channels);
|
int ethtool_set_channels(int *ethtool_fd, const char *ifname, netdev_channels *channels);
|
||||||
int ethtool_set_flow_control(int *fd, const char *ifname, int rx, int tx, int autoneg);
|
|
||||||
|
|
||||||
const char *duplex_to_string(Duplex d) _const_;
|
const char *duplex_to_string(Duplex d) _const_;
|
||||||
Duplex duplex_from_string(const char *d) _pure_;
|
Duplex duplex_from_string(const char *d) _pure_;
|
||||||
|
|
|
@ -479,36 +479,6 @@ static int patch_root_prefix_strv(char **l, const char *root_dir) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int get_paths_from_environ(const char *var, char ***paths, bool *append) {
|
|
||||||
const char *e;
|
|
||||||
int r;
|
|
||||||
|
|
||||||
assert(var);
|
|
||||||
assert(paths);
|
|
||||||
assert(append);
|
|
||||||
|
|
||||||
*append = false;
|
|
||||||
|
|
||||||
e = getenv(var);
|
|
||||||
if (e) {
|
|
||||||
const char *k;
|
|
||||||
|
|
||||||
k = endswith(e, ":");
|
|
||||||
if (k) {
|
|
||||||
e = strndupa(e, k - e);
|
|
||||||
*append = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* FIXME: empty components in other places should be rejected. */
|
|
||||||
|
|
||||||
r = path_split_and_make_absolute(e, paths);
|
|
||||||
if (r < 0)
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int lookup_paths_init(
|
int lookup_paths_init(
|
||||||
LookupPaths *p,
|
LookupPaths *p,
|
||||||
UnitFileScope scope,
|
UnitFileScope scope,
|
||||||
|
@ -526,6 +496,7 @@ int lookup_paths_init(
|
||||||
*persistent_attached = NULL, *runtime_attached = NULL;
|
*persistent_attached = NULL, *runtime_attached = NULL;
|
||||||
bool append = false; /* Add items from SYSTEMD_UNIT_PATH before normal directories */
|
bool append = false; /* Add items from SYSTEMD_UNIT_PATH before normal directories */
|
||||||
_cleanup_strv_free_ char **paths = NULL;
|
_cleanup_strv_free_ char **paths = NULL;
|
||||||
|
const char *e;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
assert(p);
|
assert(p);
|
||||||
|
@ -591,9 +562,22 @@ int lookup_paths_init(
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
/* First priority is whatever has been passed to us via env vars */
|
/* First priority is whatever has been passed to us via env vars */
|
||||||
r = get_paths_from_environ("SYSTEMD_UNIT_PATH", &paths, &append);
|
e = getenv("SYSTEMD_UNIT_PATH");
|
||||||
if (r < 0)
|
if (e) {
|
||||||
return r;
|
const char *k;
|
||||||
|
|
||||||
|
k = endswith(e, ":");
|
||||||
|
if (k) {
|
||||||
|
e = strndupa(e, k - e);
|
||||||
|
append = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* FIXME: empty components in other places should be rejected. */
|
||||||
|
|
||||||
|
r = path_split_and_make_absolute(e, &paths);
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
if (!paths || append) {
|
if (!paths || append) {
|
||||||
/* Let's figure something out. */
|
/* Let's figure something out. */
|
||||||
|
@ -833,90 +817,23 @@ void lookup_paths_flush_generator(LookupPaths *p) {
|
||||||
}
|
}
|
||||||
|
|
||||||
char **generator_binary_paths(UnitFileScope scope) {
|
char **generator_binary_paths(UnitFileScope scope) {
|
||||||
bool append = false; /* Add items from SYSTEMD_GENERATOR_PATH before normal directories */
|
|
||||||
_cleanup_strv_free_ char **paths = NULL;
|
|
||||||
int r;
|
|
||||||
|
|
||||||
/* First priority is whatever has been passed to us via env vars */
|
switch (scope) {
|
||||||
r = get_paths_from_environ("SYSTEMD_GENERATOR_PATH", &paths, &append);
|
|
||||||
if (r < 0)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if (!paths || append) {
|
case UNIT_FILE_SYSTEM:
|
||||||
_cleanup_strv_free_ char **add = NULL;
|
return strv_new("/run/systemd/system-generators",
|
||||||
|
"/etc/systemd/system-generators",
|
||||||
|
"/usr/local/lib/systemd/system-generators",
|
||||||
|
SYSTEM_GENERATOR_PATH);
|
||||||
|
|
||||||
switch (scope) {
|
case UNIT_FILE_GLOBAL:
|
||||||
|
case UNIT_FILE_USER:
|
||||||
|
return strv_new("/run/systemd/user-generators",
|
||||||
|
"/etc/systemd/user-generators",
|
||||||
|
"/usr/local/lib/systemd/user-generators",
|
||||||
|
USER_GENERATOR_PATH);
|
||||||
|
|
||||||
case UNIT_FILE_SYSTEM:
|
default:
|
||||||
add = strv_new("/run/systemd/system-generators",
|
assert_not_reached("Hmm, unexpected scope.");
|
||||||
"/etc/systemd/system-generators",
|
|
||||||
"/usr/local/lib/systemd/system-generators",
|
|
||||||
SYSTEM_GENERATOR_PATH);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case UNIT_FILE_GLOBAL:
|
|
||||||
case UNIT_FILE_USER:
|
|
||||||
add = strv_new("/run/systemd/user-generators",
|
|
||||||
"/etc/systemd/user-generators",
|
|
||||||
"/usr/local/lib/systemd/user-generators",
|
|
||||||
USER_GENERATOR_PATH);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
assert_not_reached("Hmm, unexpected scope.");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!add)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if (paths) {
|
|
||||||
r = strv_extend_strv(&paths, add, true);
|
|
||||||
if (r < 0)
|
|
||||||
return NULL;
|
|
||||||
} else
|
|
||||||
/* Small optimization: if paths is NULL (and it usually is), we can simply assign 'add' to it,
|
|
||||||
* and don't have to copy anything */
|
|
||||||
paths = TAKE_PTR(add);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return TAKE_PTR(paths);
|
|
||||||
}
|
|
||||||
|
|
||||||
char **env_generator_binary_paths(bool is_system) {
|
|
||||||
bool append = false; /* Add items from SYSTEMD_ENVIRONMENT_GENERATOR_PATH before normal directories */
|
|
||||||
_cleanup_strv_free_ char **paths = NULL;
|
|
||||||
_cleanup_strv_free_ char **add = NULL;
|
|
||||||
int r;
|
|
||||||
|
|
||||||
/* First priority is whatever has been passed to us via env vars */
|
|
||||||
r = get_paths_from_environ("SYSTEMD_ENVIRONMENT_GENERATOR_PATH", &paths, &append);
|
|
||||||
if (r < 0)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if (!paths || append) {
|
|
||||||
if (is_system)
|
|
||||||
add = strv_new("/run/systemd/system-environment-generators",
|
|
||||||
"/etc/systemd/system-environment-generators",
|
|
||||||
"/usr/local/lib/systemd/system-environment-generators",
|
|
||||||
SYSTEM_ENV_GENERATOR_PATH);
|
|
||||||
else
|
|
||||||
add = strv_new("/run/systemd/user-environment-generators",
|
|
||||||
"/etc/systemd/user-environment-generators",
|
|
||||||
"/usr/local/lib/systemd/user-environment-generators",
|
|
||||||
USER_ENV_GENERATOR_PATH);
|
|
||||||
|
|
||||||
if (!add)
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (paths) {
|
|
||||||
r = strv_extend_strv(&paths, add, true);
|
|
||||||
if (r < 0)
|
|
||||||
return NULL;
|
|
||||||
} else
|
|
||||||
/* Small optimization: if paths is NULL (and it usually is), we can simply assign 'add' to it,
|
|
||||||
* and don't have to copy anything */
|
|
||||||
paths = TAKE_PTR(add);
|
|
||||||
|
|
||||||
return TAKE_PTR(paths);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,4 +72,3 @@ void lookup_paths_flush_generator(LookupPaths *p);
|
||||||
void lookup_paths_free(LookupPaths *p);
|
void lookup_paths_free(LookupPaths *p);
|
||||||
|
|
||||||
char **generator_binary_paths(UnitFileScope scope);
|
char **generator_binary_paths(UnitFileScope scope);
|
||||||
char **env_generator_binary_paths(bool is_system);
|
|
||||||
|
|
|
@ -86,10 +86,6 @@ int sd_netlink_message_append_u8(sd_netlink_message *m, unsigned short type, uin
|
||||||
int sd_netlink_message_append_u16(sd_netlink_message *m, unsigned short type, uint16_t data);
|
int sd_netlink_message_append_u16(sd_netlink_message *m, unsigned short type, uint16_t data);
|
||||||
int sd_netlink_message_append_u32(sd_netlink_message *m, unsigned short type, uint32_t data);
|
int sd_netlink_message_append_u32(sd_netlink_message *m, unsigned short type, uint32_t data);
|
||||||
int sd_netlink_message_append_u64(sd_netlink_message *m, unsigned short type, uint64_t data);
|
int sd_netlink_message_append_u64(sd_netlink_message *m, unsigned short type, uint64_t data);
|
||||||
int sd_netlink_message_append_s8(sd_netlink_message *m, unsigned short type, int8_t data);
|
|
||||||
int sd_netlink_message_append_s16(sd_netlink_message *m, unsigned short type, int16_t data);
|
|
||||||
int sd_netlink_message_append_s32(sd_netlink_message *m, unsigned short type, int32_t data);
|
|
||||||
int sd_netlink_message_append_s64(sd_netlink_message *m, unsigned short type, int64_t data);
|
|
||||||
int sd_netlink_message_append_data(sd_netlink_message *m, unsigned short type, const void *data, size_t len);
|
int sd_netlink_message_append_data(sd_netlink_message *m, unsigned short type, const void *data, size_t len);
|
||||||
int sd_netlink_message_append_in_addr(sd_netlink_message *m, unsigned short type, const struct in_addr *data);
|
int sd_netlink_message_append_in_addr(sd_netlink_message *m, unsigned short type, const struct in_addr *data);
|
||||||
int sd_netlink_message_append_in6_addr(sd_netlink_message *m, unsigned short type, const struct in6_addr *data);
|
int sd_netlink_message_append_in6_addr(sd_netlink_message *m, unsigned short type, const struct in6_addr *data);
|
||||||
|
@ -212,10 +208,6 @@ int sd_rtnl_message_new_qdisc(sd_netlink *rtnl, sd_netlink_message **ret, uint16
|
||||||
int sd_rtnl_message_set_qdisc_parent(sd_netlink_message *m, uint32_t parent);
|
int sd_rtnl_message_set_qdisc_parent(sd_netlink_message *m, uint32_t parent);
|
||||||
int sd_rtnl_message_set_qdisc_handle(sd_netlink_message *m, uint32_t handle);
|
int sd_rtnl_message_set_qdisc_handle(sd_netlink_message *m, uint32_t handle);
|
||||||
|
|
||||||
int sd_rtnl_message_new_tclass(sd_netlink *rtnl, sd_netlink_message **ret, uint16_t nlmsg_type, int tcm_family, int tcm_ifindex);
|
|
||||||
int sd_rtnl_message_set_tclass_parent(sd_netlink_message *m, uint32_t parent);
|
|
||||||
int sd_rtnl_message_set_tclass_handle(sd_netlink_message *m, uint32_t handle);
|
|
||||||
|
|
||||||
/* genl */
|
/* genl */
|
||||||
int sd_genl_socket_open(sd_netlink **nl);
|
int sd_genl_socket_open(sd_netlink **nl);
|
||||||
int sd_genl_message_new(sd_netlink *nl, sd_genl_family family, uint8_t cmd, sd_netlink_message **m);
|
int sd_genl_message_new(sd_netlink *nl, sd_genl_family family, uint8_t cmd, sd_netlink_message **m);
|
||||||
|
|
|
@ -74,8 +74,6 @@ sd_radv_prefix *sd_radv_prefix_unref(sd_radv_prefix *ra);
|
||||||
|
|
||||||
int sd_radv_prefix_set_prefix(sd_radv_prefix *p, const struct in6_addr *in6_addr,
|
int sd_radv_prefix_set_prefix(sd_radv_prefix *p, const struct in6_addr *in6_addr,
|
||||||
unsigned char prefixlen);
|
unsigned char prefixlen);
|
||||||
int sd_radv_prefix_get_prefix(sd_radv_prefix *p, struct in6_addr *ret_in6_addr,
|
|
||||||
unsigned char *ret_prefixlen);
|
|
||||||
int sd_radv_prefix_set_onlink(sd_radv_prefix *p, int onlink);
|
int sd_radv_prefix_set_onlink(sd_radv_prefix *p, int onlink);
|
||||||
int sd_radv_prefix_set_address_autoconfiguration(sd_radv_prefix *p,
|
int sd_radv_prefix_set_address_autoconfiguration(sd_radv_prefix *p,
|
||||||
int address_autoconfiguration);
|
int address_autoconfiguration);
|
||||||
|
|
|
@ -67,54 +67,15 @@ static void test_user_and_global_paths(void) {
|
||||||
log_info("+ %s", *p);
|
log_info("+ %s", *p);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_generator_binary_paths(UnitFileScope scope) {
|
static void print_generator_binary_paths(UnitFileScope scope) {
|
||||||
char template[] = "/tmp/test-path-lookup.XXXXXXX";
|
_cleanup_strv_free_ char **paths;
|
||||||
|
|
||||||
_cleanup_strv_free_ char **gp_without_env = NULL;
|
|
||||||
_cleanup_strv_free_ char **env_gp_without_env = NULL;
|
|
||||||
_cleanup_strv_free_ char **gp_with_env = NULL;
|
|
||||||
_cleanup_strv_free_ char **env_gp_with_env = NULL;
|
|
||||||
char *systemd_generator_path = NULL;
|
|
||||||
char *systemd_env_generator_path = NULL;
|
|
||||||
char **dir;
|
char **dir;
|
||||||
|
|
||||||
assert_se(mkdtemp(template));
|
|
||||||
|
|
||||||
assert_se(unsetenv("SYSTEMD_GENERATOR_PATH") == 0);
|
|
||||||
assert_se(unsetenv("SYSTEMD_ENVIRONMENT_GENERATOR_PATH") == 0);
|
|
||||||
|
|
||||||
gp_without_env = generator_binary_paths(scope);
|
|
||||||
env_gp_without_env = env_generator_binary_paths(scope == UNIT_FILE_SYSTEM ? true : false);
|
|
||||||
|
|
||||||
log_info("Generators dirs (%s):", scope == UNIT_FILE_SYSTEM ? "system" : "user");
|
log_info("Generators dirs (%s):", scope == UNIT_FILE_SYSTEM ? "system" : "user");
|
||||||
STRV_FOREACH(dir, gp_without_env)
|
|
||||||
|
paths = generator_binary_paths(scope);
|
||||||
|
STRV_FOREACH(dir, paths)
|
||||||
log_info(" %s", *dir);
|
log_info(" %s", *dir);
|
||||||
|
|
||||||
log_info("Environment generators dirs (%s):", scope == UNIT_FILE_SYSTEM ? "system" : "user");
|
|
||||||
STRV_FOREACH(dir, env_gp_without_env)
|
|
||||||
log_info(" %s", *dir);
|
|
||||||
|
|
||||||
assert_se(!strv_isempty(gp_without_env));
|
|
||||||
assert_se(!strv_isempty(env_gp_without_env));
|
|
||||||
|
|
||||||
systemd_generator_path = strjoina(template, "/systemd-generator-path");
|
|
||||||
systemd_env_generator_path = strjoina(template, "/systemd-environment-generator-path");
|
|
||||||
assert_se(setenv("SYSTEMD_GENERATOR_PATH", systemd_generator_path, 1) == 0);
|
|
||||||
assert_se(setenv("SYSTEMD_ENVIRONMENT_GENERATOR_PATH", systemd_env_generator_path, 1) == 0);
|
|
||||||
|
|
||||||
gp_with_env = generator_binary_paths(scope);
|
|
||||||
env_gp_with_env = env_generator_binary_paths(scope == UNIT_FILE_SYSTEM ? true : false);
|
|
||||||
|
|
||||||
log_info("Generators dirs (%s):", scope == UNIT_FILE_SYSTEM ? "system" : "user");
|
|
||||||
STRV_FOREACH(dir, gp_with_env)
|
|
||||||
log_info(" %s", *dir);
|
|
||||||
|
|
||||||
log_info("Environment generators dirs (%s):", scope == UNIT_FILE_SYSTEM ? "system" : "user");
|
|
||||||
STRV_FOREACH(dir, env_gp_with_env)
|
|
||||||
log_info(" %s", *dir);
|
|
||||||
|
|
||||||
assert_se(strv_equal(gp_with_env, STRV_MAKE(systemd_generator_path)));
|
|
||||||
assert_se(strv_equal(env_gp_with_env, STRV_MAKE(systemd_env_generator_path)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
|
@ -126,8 +87,8 @@ int main(int argc, char **argv) {
|
||||||
|
|
||||||
test_user_and_global_paths();
|
test_user_and_global_paths();
|
||||||
|
|
||||||
test_generator_binary_paths(UNIT_FILE_SYSTEM);
|
print_generator_binary_paths(UNIT_FILE_SYSTEM);
|
||||||
test_generator_binary_paths(UNIT_FILE_USER);
|
print_generator_binary_paths(UNIT_FILE_USER);
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,6 +60,3 @@ Link.CombinedChannels, config_parse_channel, 0,
|
||||||
Link.Advertise, config_parse_advertise, 0, offsetof(link_config, advertise)
|
Link.Advertise, config_parse_advertise, 0, offsetof(link_config, advertise)
|
||||||
Link.RxBufferSize, config_parse_nic_buffer_size, 0, offsetof(link_config, ring)
|
Link.RxBufferSize, config_parse_nic_buffer_size, 0, offsetof(link_config, ring)
|
||||||
Link.TxBufferSize, config_parse_nic_buffer_size, 0, offsetof(link_config, ring)
|
Link.TxBufferSize, config_parse_nic_buffer_size, 0, offsetof(link_config, ring)
|
||||||
Link.RxFlowControl, config_parse_tristate, 0, offsetof(link_config, rx_flow_control)
|
|
||||||
Link.TxFlowControl, config_parse_tristate, 0, offsetof(link_config, tx_flow_control)
|
|
||||||
Link.AutoNegotiationFlowControl, config_parse_tristate, 0, offsetof(link_config, autoneg_flow_control)
|
|
||||||
|
|
|
@ -148,9 +148,6 @@ int link_load_one(link_config_ctx *ctx, const char *filename) {
|
||||||
.duplex = _DUP_INVALID,
|
.duplex = _DUP_INVALID,
|
||||||
.port = _NET_DEV_PORT_INVALID,
|
.port = _NET_DEV_PORT_INVALID,
|
||||||
.autonegotiation = -1,
|
.autonegotiation = -1,
|
||||||
.rx_flow_control = -1,
|
|
||||||
.tx_flow_control = -1,
|
|
||||||
.autoneg_flow_control = -1,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
for (i = 0; i < ELEMENTSOF(link->features); i++)
|
for (i = 0; i < ELEMENTSOF(link->features); i++)
|
||||||
|
@ -412,10 +409,6 @@ int link_config_apply(link_config_ctx *ctx, link_config *config,
|
||||||
log_warning_errno(r, "Could not set ring buffer of %s: %m", old_name);
|
log_warning_errno(r, "Could not set ring buffer of %s: %m", old_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
r = ethtool_set_flow_control(&ctx->ethtool_fd, old_name, config->rx_flow_control, config->tx_flow_control, config->autoneg_flow_control);
|
|
||||||
if (r < 0)
|
|
||||||
log_warning_errno(r, "Could not set flow control of %s: %m", old_name);
|
|
||||||
|
|
||||||
r = sd_device_get_ifindex(device, &ifindex);
|
r = sd_device_get_ifindex(device, &ifindex);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_device_warning_errno(device, r, "Could not find ifindex: %m");
|
return log_device_warning_errno(device, r, "Could not find ifindex: %m");
|
||||||
|
|
|
@ -62,9 +62,6 @@ struct link_config {
|
||||||
int features[_NET_DEV_FEAT_MAX];
|
int features[_NET_DEV_FEAT_MAX];
|
||||||
netdev_channels channels;
|
netdev_channels channels;
|
||||||
netdev_ring_param ring;
|
netdev_ring_param ring;
|
||||||
int rx_flow_control;
|
|
||||||
int tx_flow_control;
|
|
||||||
int autoneg_flow_control;
|
|
||||||
|
|
||||||
LIST_FIELDS(link_config, links);
|
LIST_FIELDS(link_config, links);
|
||||||
};
|
};
|
||||||
|
|
|
@ -41,6 +41,3 @@ CombinedChannels=
|
||||||
Advertise=
|
Advertise=
|
||||||
RxBufferSize=
|
RxBufferSize=
|
||||||
TxBufferSize=
|
TxBufferSize=
|
||||||
RxFlowControl=
|
|
||||||
TxFlowControl=
|
|
||||||
AutoNegotiationFlowControl=
|
|
||||||
|
|
|
@ -107,7 +107,6 @@ UseDNS=
|
||||||
RapidCommit=
|
RapidCommit=
|
||||||
ForceDHCPv6PDOtherInformation=
|
ForceDHCPv6PDOtherInformation=
|
||||||
PrefixDelegationHint=
|
PrefixDelegationHint=
|
||||||
WithoutRA=
|
|
||||||
[Route]
|
[Route]
|
||||||
Destination=
|
Destination=
|
||||||
Protocol=
|
Protocol=
|
||||||
|
@ -187,7 +186,6 @@ OnLink=
|
||||||
PreferredLifetimeSec=
|
PreferredLifetimeSec=
|
||||||
AddressAutoconfiguration=
|
AddressAutoconfiguration=
|
||||||
ValidLifetimeSec=
|
ValidLifetimeSec=
|
||||||
Assign=
|
|
||||||
[IPv6RoutePrefix]
|
[IPv6RoutePrefix]
|
||||||
Route=
|
Route=
|
||||||
LifetimeSec=
|
LifetimeSec=
|
||||||
|
@ -251,7 +249,6 @@ Prefix=
|
||||||
UseDomains=
|
UseDomains=
|
||||||
RouteTable=
|
RouteTable=
|
||||||
UseDNS=
|
UseDNS=
|
||||||
DHCPv6Client=
|
|
||||||
UseAutonomousPrefix=
|
UseAutonomousPrefix=
|
||||||
UseOnLinkPrefix=
|
UseOnLinkPrefix=
|
||||||
BlackList=
|
BlackList=
|
||||||
|
@ -329,11 +326,6 @@ TargetSec=
|
||||||
IntervalSec=
|
IntervalSec=
|
||||||
CEThresholdSec=
|
CEThresholdSec=
|
||||||
ECN=
|
ECN=
|
||||||
[CAKE]
|
|
||||||
Parent=
|
|
||||||
Handle=
|
|
||||||
Bandwidth=
|
|
||||||
Overhead=
|
|
||||||
[TrafficControlQueueingDiscipline]
|
[TrafficControlQueueingDiscipline]
|
||||||
Parent=
|
Parent=
|
||||||
NetworkEmulatorDelaySec=
|
NetworkEmulatorDelaySec=
|
||||||
|
@ -345,27 +337,3 @@ NetworkEmulatorPacketLimit=
|
||||||
Parent=
|
Parent=
|
||||||
Handle=
|
Handle=
|
||||||
Id=
|
Id=
|
||||||
[HierarchyTokenBucket]
|
|
||||||
Parent=
|
|
||||||
Handle=
|
|
||||||
DefaultClass=
|
|
||||||
[HierarchyTokenBucketClass]
|
|
||||||
Parent=
|
|
||||||
ClassId=
|
|
||||||
Priority=
|
|
||||||
Rate=
|
|
||||||
CeilRate=
|
|
||||||
[PFIFO]
|
|
||||||
Parent=
|
|
||||||
Handle=
|
|
||||||
PacketLimit=
|
|
||||||
[GenericRandomEarlyDetection]
|
|
||||||
Parent=
|
|
||||||
Handle=
|
|
||||||
VirtualQueues=
|
|
||||||
DefaultVirtualQueue=
|
|
||||||
GenericRIO=
|
|
||||||
[StochasticFairBlue]
|
|
||||||
Parent=
|
|
||||||
Handle=
|
|
||||||
PacketLimit=
|
|
||||||
|
|
|
@ -1,162 +0,0 @@
|
||||||
[Match]
|
|
||||||
Name=dummy98
|
|
||||||
|
|
||||||
[Network]
|
|
||||||
IPv6AcceptRA=no
|
|
||||||
Address=10.1.2.3/16
|
|
||||||
|
|
||||||
[QDisc]
|
|
||||||
Parent=clsact
|
|
||||||
|
|
||||||
[HierarchyTokenBucket]
|
|
||||||
Parent=root
|
|
||||||
Handle=0002
|
|
||||||
DefaultClass=30
|
|
||||||
|
|
||||||
[HierarchyTokenBucketClass]
|
|
||||||
Parent=root
|
|
||||||
ClassId=0002:0030
|
|
||||||
Priority=1
|
|
||||||
Rate=1M
|
|
||||||
CeilRate=0.5M
|
|
||||||
|
|
||||||
[NetworkEmulator]
|
|
||||||
Parent=2:30
|
|
||||||
Handle=0030
|
|
||||||
DelaySec=50ms
|
|
||||||
DelayJitterSec=10ms
|
|
||||||
LossRate=20%
|
|
||||||
PacketLimit=100
|
|
||||||
|
|
||||||
[HierarchyTokenBucketClass]
|
|
||||||
Parent=root
|
|
||||||
ClassId=0002:0031
|
|
||||||
Priority=1
|
|
||||||
Rate=1M
|
|
||||||
CeilRate=0.5M
|
|
||||||
|
|
||||||
[TrivialLinkEqualizer]
|
|
||||||
Parent=2:31
|
|
||||||
Handle=0031
|
|
||||||
Id=1
|
|
||||||
|
|
||||||
[HierarchyTokenBucketClass]
|
|
||||||
Parent=root
|
|
||||||
ClassId=0002:0032
|
|
||||||
Priority=1
|
|
||||||
Rate=1M
|
|
||||||
CeilRate=0.5M
|
|
||||||
|
|
||||||
[FairQueueing]
|
|
||||||
Parent=2:32
|
|
||||||
Handle=0032
|
|
||||||
PacketLimit=1000
|
|
||||||
FlowLimit=200
|
|
||||||
Quantum=1500
|
|
||||||
InitialQuantum=13000
|
|
||||||
MaximumRate=1M
|
|
||||||
Buckets=512
|
|
||||||
OrphanMask=511
|
|
||||||
Pacing=yes
|
|
||||||
CEThresholdSec=100ms
|
|
||||||
|
|
||||||
[HierarchyTokenBucketClass]
|
|
||||||
Parent=root
|
|
||||||
ClassId=0002:0033
|
|
||||||
Priority=1
|
|
||||||
Rate=1M
|
|
||||||
CeilRate=0.5M
|
|
||||||
|
|
||||||
[ControlledDelay]
|
|
||||||
Parent=2:33
|
|
||||||
Handle=0033
|
|
||||||
PacketLimit=2000
|
|
||||||
TargetSec=10ms
|
|
||||||
IntervalSec=50ms
|
|
||||||
ECN=yes
|
|
||||||
CEThresholdSec=100ms
|
|
||||||
|
|
||||||
[HierarchyTokenBucketClass]
|
|
||||||
Parent=root
|
|
||||||
ClassId=0002:0034
|
|
||||||
Priority=1
|
|
||||||
Rate=1M
|
|
||||||
CeilRate=0.5M
|
|
||||||
|
|
||||||
[FairQueueingControlledDelay]
|
|
||||||
Parent=2:34
|
|
||||||
Handle=0034
|
|
||||||
PacketLimit=20480
|
|
||||||
MemoryLimit=64M
|
|
||||||
Flows=2048
|
|
||||||
TargetSec=10ms
|
|
||||||
IntervalSec=200ms
|
|
||||||
Quantum=1400
|
|
||||||
ECN=yes
|
|
||||||
CEThresholdSec=100ms
|
|
||||||
|
|
||||||
[HierarchyTokenBucketClass]
|
|
||||||
Parent=root
|
|
||||||
ClassId=0002:0035
|
|
||||||
Priority=1
|
|
||||||
Rate=1M
|
|
||||||
CeilRate=0.5M
|
|
||||||
|
|
||||||
[TokenBucketFilter]
|
|
||||||
Parent=2:35
|
|
||||||
Handle=0035
|
|
||||||
Rate=1G
|
|
||||||
Burst=5K
|
|
||||||
LatencySec=70msec
|
|
||||||
PeakRate=100G
|
|
||||||
MTUBytes=1M
|
|
||||||
|
|
||||||
[HierarchyTokenBucketClass]
|
|
||||||
Parent=root
|
|
||||||
ClassId=0002:0036
|
|
||||||
Priority=1
|
|
||||||
Rate=1M
|
|
||||||
CeilRate=0.5M
|
|
||||||
|
|
||||||
[StochasticFairnessQueueing]
|
|
||||||
Parent=2:36
|
|
||||||
Handle=0036
|
|
||||||
PerturbPeriodSec=5sec
|
|
||||||
|
|
||||||
[HierarchyTokenBucketClass]
|
|
||||||
Parent=root
|
|
||||||
ClassId=0002:0037
|
|
||||||
Priority=1
|
|
||||||
Rate=1M
|
|
||||||
CeilRate=0.5M
|
|
||||||
|
|
||||||
[PFIFO]
|
|
||||||
Parent=2:37
|
|
||||||
Handle=0037
|
|
||||||
PacketLimit=100000
|
|
||||||
|
|
||||||
[HierarchyTokenBucketClass]
|
|
||||||
Parent=root
|
|
||||||
ClassId=0002:0038
|
|
||||||
Priority=1
|
|
||||||
Rate=1M
|
|
||||||
CeilRate=0.5M
|
|
||||||
|
|
||||||
[GenericRandomEarlyDetection]
|
|
||||||
Parent=2:38
|
|
||||||
Handle=0038
|
|
||||||
VirtualQueues=12
|
|
||||||
DefaultVirtualQueue=10
|
|
||||||
GenericRIO=yes
|
|
||||||
|
|
||||||
[HierarchyTokenBucketClass]
|
|
||||||
Parent=root
|
|
||||||
ClassId=0002:0039
|
|
||||||
Priority=1
|
|
||||||
Rate=1M
|
|
||||||
CeilRate=0.5M
|
|
||||||
|
|
||||||
[StochasticFairBlue]
|
|
||||||
Parent=2:39
|
|
||||||
Handle=0039
|
|
||||||
PacketLimit=200000
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
[Match]
|
||||||
|
Name=dummy98
|
||||||
|
|
||||||
|
[Network]
|
||||||
|
IPv6AcceptRA=no
|
||||||
|
Address=10.1.2.3/16
|
||||||
|
|
||||||
|
#[TrafficControlQueueingDiscipline]
|
||||||
|
#Parent=root
|
||||||
|
|
||||||
|
[TrafficControlQueueingDiscipline]
|
||||||
|
Parent=clsact
|
|
@ -0,0 +1,27 @@
|
||||||
|
[Match]
|
||||||
|
Name=dummy98
|
||||||
|
|
||||||
|
[Network]
|
||||||
|
IPv6AcceptRA=no
|
||||||
|
Address=10.1.2.3/16
|
||||||
|
|
||||||
|
[FairQueueing]
|
||||||
|
Parent=root
|
||||||
|
Handle=0003
|
||||||
|
PacketLimit=1000
|
||||||
|
FlowLimit=200
|
||||||
|
Quantum=1500
|
||||||
|
InitialQuantum=13000
|
||||||
|
MaximumRate=1M
|
||||||
|
Buckets=512
|
||||||
|
OrphanMask=511
|
||||||
|
Pacing=yes
|
||||||
|
CEThresholdSec=100ms
|
||||||
|
|
||||||
|
[ControlledDelay]
|
||||||
|
Parent=clsact
|
||||||
|
PacketLimit=2000
|
||||||
|
TargetSec=10ms
|
||||||
|
IntervalSec=50ms
|
||||||
|
ECN=yes
|
||||||
|
CEThresholdSec=100ms
|
|
@ -0,0 +1,12 @@
|
||||||
|
[Match]
|
||||||
|
Name=test1
|
||||||
|
|
||||||
|
[Network]
|
||||||
|
IPv6AcceptRA=no
|
||||||
|
Address=10.1.2.4/16
|
||||||
|
|
||||||
|
#[QDisc]
|
||||||
|
#Parent=root
|
||||||
|
|
||||||
|
[QDisc]
|
||||||
|
Parent=ingress
|
|
@ -0,0 +1,25 @@
|
||||||
|
[Match]
|
||||||
|
Name=dummy98
|
||||||
|
|
||||||
|
[Network]
|
||||||
|
IPv6AcceptRA=no
|
||||||
|
Address=10.1.2.3/16
|
||||||
|
|
||||||
|
[NetworkEmulator]
|
||||||
|
Parent=root
|
||||||
|
Handle=001f
|
||||||
|
DelaySec=50ms
|
||||||
|
DelayJitterSec=10ms
|
||||||
|
LossRate=20%
|
||||||
|
PacketLimit=100
|
||||||
|
|
||||||
|
[FairQueueingControlledDelay]
|
||||||
|
Parent=ingress
|
||||||
|
PacketLimit=20480
|
||||||
|
MemoryLimit=64M
|
||||||
|
Flows=2048
|
||||||
|
TargetSec=10ms
|
||||||
|
IntervalSec=200ms
|
||||||
|
Quantum=1400
|
||||||
|
ECN=yes
|
||||||
|
CEThresholdSec=100ms
|
|
@ -0,0 +1,19 @@
|
||||||
|
[Match]
|
||||||
|
Name=test1
|
||||||
|
|
||||||
|
[Network]
|
||||||
|
IPv6AcceptRA=no
|
||||||
|
Address=10.1.2.4/16
|
||||||
|
|
||||||
|
[TokenBucketFilter]
|
||||||
|
Parent=root
|
||||||
|
Handle=003f
|
||||||
|
Rate=1G
|
||||||
|
Burst=5K
|
||||||
|
LatencySec=70msec
|
||||||
|
PeakRate=100G
|
||||||
|
MTUBytes=1M
|
||||||
|
|
||||||
|
[StochasticFairnessQueueing]
|
||||||
|
Parent=clsact
|
||||||
|
PerturbPeriodSec=5sec
|
|
@ -5,8 +5,7 @@ Name=dummy98
|
||||||
IPv6AcceptRA=no
|
IPv6AcceptRA=no
|
||||||
Address=10.1.2.3/16
|
Address=10.1.2.3/16
|
||||||
|
|
||||||
[CAKE]
|
[TrivialLinkEqualizer]
|
||||||
Parent=root
|
Parent=root
|
||||||
Handle=3a
|
Handle=0002
|
||||||
Overhead=128
|
Id=1
|
||||||
Bandwidth=500M
|
|
|
@ -4,13 +4,10 @@ Name=veth99
|
||||||
[Network]
|
[Network]
|
||||||
DHCP=no
|
DHCP=no
|
||||||
IPv6PrefixDelegation=yes
|
IPv6PrefixDelegation=yes
|
||||||
|
Address=2001:db8:0:1::1/64
|
||||||
|
|
||||||
[IPv6Prefix]
|
[IPv6Prefix]
|
||||||
Prefix=2001:db8:0:1::/64
|
Prefix=2001:db8:0:1::4/64
|
||||||
|
|
||||||
[IPv6Prefix]
|
|
||||||
Prefix=2001:db8:0:2::/64
|
|
||||||
Assign=yes
|
|
||||||
|
|
||||||
[IPv6RoutePrefix]
|
[IPv6RoutePrefix]
|
||||||
Route=2001:db0:fff::/64
|
Route=2001:db0:fff::/64
|
||||||
|
|
|
@ -157,18 +157,6 @@ def expectedFailureIfAlternativeNameIsNotAvailable():
|
||||||
|
|
||||||
return f
|
return f
|
||||||
|
|
||||||
def expectedFailureIfCAKEIsNotAvailable():
|
|
||||||
def f(func):
|
|
||||||
call('ip link add dummy98 type dummy', stderr=subprocess.DEVNULL)
|
|
||||||
rc = call('tc qdisc add dev dummy98 parent root cake', stderr=subprocess.DEVNULL)
|
|
||||||
call('ip link del dummy98', stderr=subprocess.DEVNULL)
|
|
||||||
if rc == 0:
|
|
||||||
return func
|
|
||||||
else:
|
|
||||||
return unittest.expectedFailure(func)
|
|
||||||
|
|
||||||
return f
|
|
||||||
|
|
||||||
def setUpModule():
|
def setUpModule():
|
||||||
global running_units
|
global running_units
|
||||||
|
|
||||||
|
@ -1633,9 +1621,13 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
|
||||||
'25-neighbor-ip-dummy.network',
|
'25-neighbor-ip-dummy.network',
|
||||||
'25-neighbor-ip.network',
|
'25-neighbor-ip.network',
|
||||||
'25-nexthop.network',
|
'25-nexthop.network',
|
||||||
'25-qdisc-cake.network',
|
'25-qdisc-clsact-root-compat.network',
|
||||||
'25-qdisc-clsact-and-htb.network',
|
'25-qdisc-fq-codel.network',
|
||||||
'25-qdisc-ingress-netem-compat.network',
|
'25-qdisc-ingress-netem-compat.network',
|
||||||
|
'25-qdisc-ingress-root.network',
|
||||||
|
'25-qdisc-netem-and-fqcodel.network',
|
||||||
|
'25-qdisc-tbf-and-sfq.network',
|
||||||
|
'25-qdisc-teql.network',
|
||||||
'25-route-ipv6-src.network',
|
'25-route-ipv6-src.network',
|
||||||
'25-route-static.network',
|
'25-route-static.network',
|
||||||
'25-route-vrf.network',
|
'25-route-vrf.network',
|
||||||
|
@ -2262,85 +2254,71 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
|
||||||
self.assertRegex(output, '192.168.5.1')
|
self.assertRegex(output, '192.168.5.1')
|
||||||
|
|
||||||
def test_qdisc(self):
|
def test_qdisc(self):
|
||||||
copy_unit_to_networkd_unit_path('25-qdisc-clsact-and-htb.network', '12-dummy.netdev',
|
copy_unit_to_networkd_unit_path('25-qdisc-netem-and-fqcodel.network', '12-dummy.netdev',
|
||||||
'25-qdisc-ingress-netem-compat.network', '11-dummy.netdev')
|
'25-qdisc-tbf-and-sfq.network', '11-dummy.netdev')
|
||||||
check_output('modprobe sch_teql max_equalizers=2')
|
|
||||||
start_networkd()
|
start_networkd()
|
||||||
|
|
||||||
self.wait_online(['dummy98:routable', 'test1:routable'])
|
self.wait_online(['dummy98:routable', 'test1:routable'])
|
||||||
|
|
||||||
|
output = check_output('tc qdisc show dev dummy98')
|
||||||
|
print(output)
|
||||||
|
self.assertRegex(output, 'qdisc netem 1f:')
|
||||||
|
self.assertRegex(output, 'limit 100 delay 50.0ms 10.0ms loss 20%')
|
||||||
|
self.assertRegex(output, 'qdisc fq_codel')
|
||||||
|
self.assertRegex(output, 'limit 20480p flows 2048 quantum 1400 target 10.0ms ce_threshold 100.0ms interval 200.0ms memory_limit 64Mb ecn')
|
||||||
|
output = check_output('tc qdisc show dev test1')
|
||||||
|
print(output)
|
||||||
|
self.assertRegex(output, 'qdisc tbf 3f:')
|
||||||
|
self.assertRegex(output, 'rate 1Gbit burst 5000b peakrate 100Gbit minburst 987500b lat 70.0ms')
|
||||||
|
self.assertRegex(output, 'qdisc sfq')
|
||||||
|
self.assertRegex(output, 'perturb 5sec')
|
||||||
|
|
||||||
|
def test_qdisc2(self):
|
||||||
|
copy_unit_to_networkd_unit_path('25-qdisc-fq-codel.network', '12-dummy.netdev',
|
||||||
|
'25-qdisc-ingress-root.network', '11-dummy.netdev')
|
||||||
|
start_networkd()
|
||||||
|
|
||||||
|
self.wait_online(['dummy98:routable', 'test1:routable'])
|
||||||
|
|
||||||
|
output = check_output('tc qdisc show dev dummy98')
|
||||||
|
print(output)
|
||||||
|
self.assertRegex(output, 'qdisc fq 3:')
|
||||||
|
self.assertRegex(output, 'limit 1000p flow_limit 200p buckets 512 orphan_mask 511')
|
||||||
|
self.assertRegex(output, 'quantum 1500')
|
||||||
|
self.assertRegex(output, 'initial_quantum 13000')
|
||||||
|
self.assertRegex(output, 'maxrate 1Mbit')
|
||||||
|
self.assertRegex(output, 'qdisc codel')
|
||||||
|
self.assertRegex(output, 'limit 2000p target 10.0ms ce_threshold 100.0ms interval 50.0ms ecn')
|
||||||
|
output = check_output('tc qdisc show dev test1')
|
||||||
|
print(output)
|
||||||
|
self.assertRegex(output, 'qdisc ingress')
|
||||||
|
|
||||||
|
def test_qdisc3(self):
|
||||||
|
copy_unit_to_networkd_unit_path('25-qdisc-clsact-root-compat.network', '12-dummy.netdev',
|
||||||
|
'25-qdisc-ingress-netem-compat.network', '11-dummy.netdev')
|
||||||
|
start_networkd()
|
||||||
|
|
||||||
|
self.wait_online(['dummy98:routable', 'test1:routable'])
|
||||||
|
|
||||||
|
output = check_output('tc qdisc show dev dummy98')
|
||||||
|
print(output)
|
||||||
|
self.assertRegex(output, 'qdisc clsact')
|
||||||
output = check_output('tc qdisc show dev test1')
|
output = check_output('tc qdisc show dev test1')
|
||||||
print(output)
|
print(output)
|
||||||
self.assertRegex(output, 'qdisc netem')
|
self.assertRegex(output, 'qdisc netem')
|
||||||
self.assertRegex(output, 'limit 100 delay 50.0ms 10.0ms loss 20%')
|
self.assertRegex(output, 'limit 100 delay 50.0ms 10.0ms loss 20%')
|
||||||
self.assertRegex(output, 'qdisc ingress')
|
self.assertRegex(output, 'qdisc ingress')
|
||||||
|
|
||||||
output = check_output('tc qdisc show dev dummy98')
|
def test_qdisc4(self):
|
||||||
print(output)
|
copy_unit_to_networkd_unit_path('25-qdisc-teql.network', '12-dummy.netdev')
|
||||||
self.assertRegex(output, 'qdisc clsact')
|
check_output('modprobe sch_teql max_equalizers=2')
|
||||||
|
|
||||||
self.assertRegex(output, 'qdisc htb 2: root')
|
|
||||||
self.assertRegex(output, r'default (0x30|30)')
|
|
||||||
|
|
||||||
self.assertRegex(output, 'qdisc netem 30: parent 2:30')
|
|
||||||
self.assertRegex(output, 'limit 100 delay 50.0ms 10.0ms loss 20%')
|
|
||||||
self.assertRegex(output, 'qdisc fq_codel')
|
|
||||||
self.assertRegex(output, 'limit 20480p flows 2048 quantum 1400 target 10.0ms ce_threshold 100.0ms interval 200.0ms memory_limit 64Mb ecn')
|
|
||||||
|
|
||||||
self.assertRegex(output, 'qdisc teql1 31: parent 2:31')
|
|
||||||
|
|
||||||
self.assertRegex(output, 'qdisc fq 32: parent 2:32')
|
|
||||||
self.assertRegex(output, 'limit 1000p flow_limit 200p buckets 512 orphan_mask 511')
|
|
||||||
self.assertRegex(output, 'quantum 1500')
|
|
||||||
self.assertRegex(output, 'initial_quantum 13000')
|
|
||||||
self.assertRegex(output, 'maxrate 1Mbit')
|
|
||||||
|
|
||||||
self.assertRegex(output, 'qdisc codel 33: parent 2:33')
|
|
||||||
self.assertRegex(output, 'limit 2000p target 10.0ms ce_threshold 100.0ms interval 50.0ms ecn')
|
|
||||||
|
|
||||||
self.assertRegex(output, 'qdisc fq_codel 34: parent 2:34')
|
|
||||||
self.assertRegex(output, 'limit 20480p flows 2048 quantum 1400 target 10.0ms ce_threshold 100.0ms interval 200.0ms memory_limit 64Mb ecn')
|
|
||||||
|
|
||||||
self.assertRegex(output, 'qdisc tbf 35: parent 2:35')
|
|
||||||
self.assertRegex(output, 'rate 1Gbit burst 5000b peakrate 100Gbit minburst 987500b lat 70.0ms')
|
|
||||||
|
|
||||||
self.assertRegex(output, 'qdisc sfq 36: parent 2:36')
|
|
||||||
self.assertRegex(output, 'perturb 5sec')
|
|
||||||
|
|
||||||
self.assertRegex(output, 'qdisc pfifo 37: parent 2:37')
|
|
||||||
self.assertRegex(output, 'limit 100000p')
|
|
||||||
|
|
||||||
self.assertRegex(output, 'qdisc gred 38: parent 2:38')
|
|
||||||
self.assertRegex(output, 'vqs 12 default 10 grio')
|
|
||||||
|
|
||||||
self.assertRegex(output, 'qdisc sfb 39: parent 2:39')
|
|
||||||
self.assertRegex(output, 'limit 200000')
|
|
||||||
|
|
||||||
output = check_output('tc class show dev dummy98')
|
|
||||||
print(output)
|
|
||||||
self.assertRegex(output, 'class htb 2:30 root leaf 30:')
|
|
||||||
self.assertRegex(output, 'class htb 2:31 root leaf 31:')
|
|
||||||
self.assertRegex(output, 'class htb 2:32 root leaf 32:')
|
|
||||||
self.assertRegex(output, 'class htb 2:33 root leaf 33:')
|
|
||||||
self.assertRegex(output, 'class htb 2:34 root leaf 34:')
|
|
||||||
self.assertRegex(output, 'class htb 2:35 root leaf 35:')
|
|
||||||
self.assertRegex(output, 'class htb 2:36 root leaf 36:')
|
|
||||||
self.assertRegex(output, 'class htb 2:37 root leaf 37:')
|
|
||||||
self.assertRegex(output, 'class htb 2:38 root leaf 38:')
|
|
||||||
self.assertRegex(output, 'class htb 2:39 root leaf 39:')
|
|
||||||
self.assertRegex(output, 'prio 1 rate 1Mbit ceil 500Kbit')
|
|
||||||
|
|
||||||
@expectedFailureIfCAKEIsNotAvailable()
|
|
||||||
def test_qdisc_cake(self):
|
|
||||||
copy_unit_to_networkd_unit_path('25-qdisc-cake.network', '12-dummy.netdev')
|
|
||||||
start_networkd()
|
start_networkd()
|
||||||
|
|
||||||
self.wait_online(['dummy98:routable'])
|
self.wait_online(['dummy98:routable'])
|
||||||
|
|
||||||
output = check_output('tc qdisc show dev dummy98')
|
output = check_output('tc qdisc show dev dummy98')
|
||||||
print(output)
|
print(output)
|
||||||
self.assertRegex(output, 'qdisc cake 3a: root')
|
self.assertRegex(output, 'qdisc teql1 2:')
|
||||||
self.assertRegex(output, 'bandwidth 500Mbit')
|
|
||||||
self.assertRegex(output, 'overhead 128')
|
|
||||||
|
|
||||||
class NetworkdStateFileTests(unittest.TestCase, Utilities):
|
class NetworkdStateFileTests(unittest.TestCase, Utilities):
|
||||||
links = [
|
links = [
|
||||||
|
@ -3613,15 +3591,10 @@ class NetworkdIPv6PrefixTests(unittest.TestCase, Utilities):
|
||||||
start_networkd()
|
start_networkd()
|
||||||
self.wait_online(['veth99:routable', 'veth-peer:routable'])
|
self.wait_online(['veth99:routable', 'veth-peer:routable'])
|
||||||
|
|
||||||
output = check_output('ip -6 route show dev veth-peer')
|
output = check_output('ip', '-6', 'route', 'show', 'dev', 'veth-peer')
|
||||||
print(output)
|
print(output)
|
||||||
self.assertRegex(output, '2001:db8:0:1::/64 proto ra')
|
self.assertRegex(output, '2001:db8:0:1::/64 proto ra')
|
||||||
|
|
||||||
output = check_output('ip addr show dev veth99')
|
|
||||||
print(output)
|
|
||||||
self.assertNotRegex(output, '2001:db8:0:1')
|
|
||||||
self.assertRegex(output, '2001:db8:0:2')
|
|
||||||
|
|
||||||
class NetworkdMTUTests(unittest.TestCase, Utilities):
|
class NetworkdMTUTests(unittest.TestCase, Utilities):
|
||||||
links = ['dummy98']
|
links = ['dummy98']
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue