]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: tc/cake: do not pass 0 if OverheadBytes= is not specified
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 2 Nov 2021 19:14:08 +0000 (04:14 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 9 Nov 2021 01:58:44 +0000 (10:58 +0900)
src/network/tc/cake.c
src/network/tc/cake.h

index 0f77036fd808f3c072d9f24b9a10b93571246ef7..813a679bf717b3739fcd12acc0a2a1e4b9cc6a4d 100644 (file)
@@ -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;
 }
index ba9dcb9a08011da9708458d3c18934787e422915..08fa3c266b547679bcd41bde59f228fe11595f19 100644 (file)
@@ -13,6 +13,7 @@ typedef struct CommonApplicationsKeptEnhanced {
         uint64_t bandwidth;
 
         /* Overhead compensation parameters */
+        bool overhead_set;
         int overhead;
 
 } CommonApplicationsKeptEnhanced;