From d05dce95d87bc3070064e5a34486f8b2aff87d78 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Thu, 4 Nov 2021 05:32:44 +0900 Subject: [PATCH] network: tc/cake: introduce Wash= setting --- man/systemd.network.xml | 8 ++++++++ src/network/networkd-network-gperf.gperf | 1 + src/network/tc/cake.c | 9 +++++++++ src/network/tc/cake.h | 3 +++ 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 3cc9e8e7788..78c0f6cd57a 100644 --- a/man/systemd.network.xml +++ b/man/systemd.network.xml @@ -3669,6 +3669,14 @@ Token=prefixstable:2002:da8:1:: + + Wash= + + Takes a boolean value. When true, CAKE clears the DSCP fields, except for ECN bits, of + any packet passing through CAKE. Defaults to unset, and the kernel's default is used. + + + diff --git a/src/network/networkd-network-gperf.gperf b/src/network/networkd-network-gperf.gperf index f7866cbc14c..956d7b130e3 100644 --- a/src/network/networkd-network-gperf.gperf +++ b/src/network/networkd-network-gperf.gperf @@ -394,6 +394,7 @@ CAKE.FlowIsolationMode, config_parse_cake_flow_isolation_mo CAKE.NAT, config_parse_cake_tristate, QDISC_KIND_CAKE, 0 CAKE.PriorityQueueingPreset, config_parse_cake_priority_queueing_preset, QDISC_KIND_CAKE, 0 CAKE.FirewallMark, config_parse_cake_fwmark, QDISC_KIND_CAKE, 0 +CAKE.Wash, config_parse_cake_tristate, QDISC_KIND_CAKE, 0 ControlledDelay.Parent, config_parse_qdisc_parent, 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 diff --git a/src/network/tc/cake.c b/src/network/tc/cake.c index 598a019ac2c..cad36dc2375 100644 --- a/src/network/tc/cake.c +++ b/src/network/tc/cake.c @@ -24,6 +24,7 @@ static int cake_init(QDisc *qdisc) { c->flow_isolation_mode = _CAKE_FLOW_ISOLATION_MODE_INVALID; c->nat = -1; c->preset = _CAKE_PRESET_INVALID; + c->wash = -1; return 0; } @@ -96,6 +97,12 @@ 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_FWMARK attribute: %m"); } + if (c->wash >= 0) { + r = sd_netlink_message_append_u32(req, TCA_CAKE_WASH, c->wash); + if (r < 0) + return log_link_error_errno(link, r, "Could not append TCA_CAKE_WASH 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"); @@ -314,6 +321,8 @@ int config_parse_cake_tristate( dest = &c->autorate; else if (streq(lvalue, "NAT")) dest = &c->nat; + else if (streq(lvalue, "Wash")) + dest = &c->wash; else assert_not_reached(); diff --git a/src/network/tc/cake.h b/src/network/tc/cake.h index 8743d592ad6..a947f9cdc7d 100644 --- a/src/network/tc/cake.h +++ b/src/network/tc/cake.h @@ -59,6 +59,9 @@ typedef struct CommonApplicationsKeptEnhanced { CakePriorityQueueingPreset preset; uint32_t fwmark; + /* Other parameters */ + int wash; + } CommonApplicationsKeptEnhanced; DEFINE_QDISC_CAST(CAKE, CommonApplicationsKeptEnhanced); diff --git a/test/fuzz/fuzz-network-parser/directives.network b/test/fuzz/fuzz-network-parser/directives.network index de8bec2750d..92c942c7089 100644 --- a/test/fuzz/fuzz-network-parser/directives.network +++ b/test/fuzz/fuzz-network-parser/directives.network @@ -476,6 +476,7 @@ FlowIsolationMode= NAT= PriorityQueueingPreset= FirewallMark= +Wash= [TrafficControlQueueingDiscipline] Parent= NetworkEmulatorDelaySec=