]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: tc/cake: introduce UseRawPacketSize= setting
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 4 Nov 2021 01:04:47 +0000 (10:04 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 9 Nov 2021 01:58:44 +0000 (10:58 +0900)
man/systemd.network.xml
src/network/networkd-network-gperf.gperf
src/network/tc/cake.c
src/network/tc/cake.h
test/fuzz/fuzz-network-parser/directives.network

index d844b205d44d074ed9c36a8bc35d2a34ae11b0a2..e5e3fd0ba3888ead15a2a78e6237db5eff695239 100644 (file)
@@ -3511,6 +3511,15 @@ Token=prefixstable:2002:da8:1::</programlisting></para>
         </listitem>
       </varlistentry>
 
+      <varlistentry>
+        <term><varname>UseRawPacketSize=</varname></term>
+        <listitem>
+          <para>Takes a boolean value. When true, the packet size reported by the Linux kernel will be
+          used, instead of the underlying IP packet size. Defaults to unset, and the kernel's default
+          is used.</para>
+        </listitem>
+      </varlistentry>
+
       <varlistentry>
         <term><varname>FlowIsolationMode=</varname></term>
         <listitem>
index 33a2f296d6f04b4a11b495b4d3be94706bfa495f..901608beb46be83fc6dc10e5815d5f0900b720f6 100644 (file)
@@ -390,6 +390,7 @@ CAKE.AutoRateIngress,                        config_parse_cake_tristate,
 CAKE.OverheadBytes,                          config_parse_cake_overhead,                               QDISC_KIND_CAKE,               0
 CAKE.MPUBytes,                               config_parse_cake_mpu,                                    QDISC_KIND_CAKE,               0
 CAKE.CompensationMode,                       config_parse_cake_compensation_mode,                      QDISC_KIND_CAKE,               0
+CAKE.UseRawPacketSize,                       config_parse_cake_tristate,                               QDISC_KIND_CAKE,               0
 CAKE.FlowIsolationMode,                      config_parse_cake_flow_isolation_mode,                    QDISC_KIND_CAKE,               0
 CAKE.NAT,                                    config_parse_cake_tristate,                               QDISC_KIND_CAKE,               0
 CAKE.PriorityQueueingPreset,                 config_parse_cake_priority_queueing_preset,               QDISC_KIND_CAKE,               0
index 34e89c847b0babc1a2b44a6916079c2e39f6a2d0..27b7f8d9f66d2325c25cbfadafcb09ff40076c9e 100644 (file)
@@ -21,6 +21,7 @@ static int cake_init(QDisc *qdisc) {
 
         c->autorate = -1;
         c->compensation_mode = _CAKE_COMPENSATION_MODE_INVALID;
+        c->raw = -1;
         c->flow_isolation_mode = _CAKE_FLOW_ISOLATION_MODE_INVALID;
         c->nat = -1;
         c->preset = _CAKE_PRESET_INVALID;
@@ -74,6 +75,13 @@ static int cake_fill_message(Link *link, QDisc *qdisc, sd_netlink_message *req)
                         return log_link_error_errno(link, r, "Could not append TCA_CAKE_ATM attribute: %m");
         }
 
+        if (c->raw > 0) {
+                /* TCA_CAKE_RAW attribute is mostly a flag, not boolean. */
+                r = sd_netlink_message_append_u32(req, TCA_CAKE_RAW, 0);
+                if (r < 0)
+                        return log_link_error_errno(link, r, "Could not append TCA_CAKE_RAW attribute: %m");
+        }
+
         if (c->flow_isolation_mode >= 0) {
                 r = sd_netlink_message_append_u32(req, TCA_CAKE_FLOW_MODE, c->flow_isolation_mode);
                 if (r < 0)
@@ -326,6 +334,8 @@ int config_parse_cake_tristate(
 
         if (streq(lvalue, "AutoRateIngress"))
                 dest = &c->autorate;
+        else if (streq(lvalue, "UseRawPacketSize"))
+                dest = &c->raw;
         else if (streq(lvalue, "NAT"))
                 dest = &c->nat;
         else if (streq(lvalue, "Wash"))
index 165a17f53f90be1a74aa4e2f1eaa11ca51e479d3..ff68cedabf4e3f5cded8d04a25757dfc0253e02d 100644 (file)
@@ -50,6 +50,7 @@ typedef struct CommonApplicationsKeptEnhanced {
         int overhead;
         uint32_t mpu;
         CakeCompensationMode compensation_mode;
+        int raw;
 
         /* Flow isolation parameters */
         CakeFlowIsolationMode flow_isolation_mode;
index d6efeacd428027d35f230fef4c36eb9008cc0f35..fb8befe730e0b64c33c75d94837c52ee7994ea7b 100644 (file)
@@ -472,6 +472,7 @@ AutoRateIngress=
 OverheadBytes=
 MPUBytes=
 CompensationMode=
+UseRawPacketSize=
 FlowIsolationMode=
 NAT=
 PriorityQueueingPreset=