From 3a86a31e0c1d650ac6c5ca37d3b799f5b6692a4b Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Wed, 3 Nov 2021 04:14:08 +0900 Subject: [PATCH] network: tc/cake: do not pass 0 if OverheadBytes= is not specified --- src/network/tc/cake.c | 11 +++++++---- src/network/tc/cake.h | 1 + 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/network/tc/cake.c b/src/network/tc/cake.c index 0f77036fd8..813a679bf7 100644 --- a/src/network/tc/cake.c +++ b/src/network/tc/cake.c @@ -49,9 +49,11 @@ 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_AUTORATE 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"); + if (c->overhead_set) { + 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) @@ -150,7 +152,7 @@ int config_parse_cake_overhead( c = CAKE(qdisc); if (isempty(rvalue)) { - c->overhead = 0; + c->overhead_set = false; TAKE_PTR(qdisc); return 0; } @@ -170,6 +172,7 @@ int config_parse_cake_overhead( } c->overhead = v; + c->overhead_set = true; TAKE_PTR(qdisc); return 0; } diff --git a/src/network/tc/cake.h b/src/network/tc/cake.h index ba9dcb9a08..08fa3c266b 100644 --- a/src/network/tc/cake.h +++ b/src/network/tc/cake.h @@ -13,6 +13,7 @@ typedef struct CommonApplicationsKeptEnhanced { uint64_t bandwidth; /* Overhead compensation parameters */ + bool overhead_set; int overhead; } CommonApplicationsKeptEnhanced;