From 1c7a81e6266688a0078defcd1957eccbbe834d07 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Thu, 4 Nov 2021 10:04:47 +0900 Subject: [PATCH] network: tc/cake: introduce UseRawPacketSize= setting --- man/systemd.network.xml | 9 +++++++++ src/network/networkd-network-gperf.gperf | 1 + src/network/tc/cake.c | 10 ++++++++++ src/network/tc/cake.h | 1 + test/fuzz/fuzz-network-parser/directives.network | 1 + 5 files changed, 22 insertions(+) diff --git a/man/systemd.network.xml b/man/systemd.network.xml index d844b205d4..e5e3fd0ba3 100644 --- a/man/systemd.network.xml +++ b/man/systemd.network.xml @@ -3511,6 +3511,15 @@ Token=prefixstable:2002:da8:1:: + + UseRawPacketSize= + + 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. + + + FlowIsolationMode= diff --git a/src/network/networkd-network-gperf.gperf b/src/network/networkd-network-gperf.gperf index 33a2f296d6..901608beb4 100644 --- a/src/network/networkd-network-gperf.gperf +++ b/src/network/networkd-network-gperf.gperf @@ -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 diff --git a/src/network/tc/cake.c b/src/network/tc/cake.c index 34e89c847b..27b7f8d9f6 100644 --- a/src/network/tc/cake.c +++ b/src/network/tc/cake.c @@ -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")) diff --git a/src/network/tc/cake.h b/src/network/tc/cake.h index 165a17f53f..ff68cedabf 100644 --- a/src/network/tc/cake.h +++ b/src/network/tc/cake.h @@ -50,6 +50,7 @@ typedef struct CommonApplicationsKeptEnhanced { int overhead; uint32_t mpu; CakeCompensationMode compensation_mode; + int raw; /* Flow isolation parameters */ CakeFlowIsolationMode flow_isolation_mode; diff --git a/test/fuzz/fuzz-network-parser/directives.network b/test/fuzz/fuzz-network-parser/directives.network index d6efeacd42..fb8befe730 100644 --- a/test/fuzz/fuzz-network-parser/directives.network +++ b/test/fuzz/fuzz-network-parser/directives.network @@ -472,6 +472,7 @@ AutoRateIngress= OverheadBytes= MPUBytes= CompensationMode= +UseRawPacketSize= FlowIsolationMode= NAT= PriorityQueueingPreset=