]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: tc: refuse to set 0 for FlowQueuePIE.PacketLimit=
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 17 Sep 2020 08:16:49 +0000 (17:16 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 17 Sep 2020 08:16:49 +0000 (17:16 +0900)
src/network/tc/fq-pie.c

index 47fa86b450cf6bb9eb20a59c6795429d6fe8a143..3065ac0150a78272dee39054557402a642ed0f37 100644 (file)
@@ -52,6 +52,7 @@ int config_parse_fq_pie_packet_limit(
         _cleanup_(qdisc_free_or_set_invalidp) QDisc *qdisc = NULL;
         FlowQueuePIE *fq_pie;
         Network *network = data;
+        uint32_t val;
         int r;
 
         assert(filename);
@@ -75,14 +76,21 @@ int config_parse_fq_pie_packet_limit(
                 return 0;
         }
 
-        r = safe_atou32(rvalue, &fq_pie->packet_limit);
+        r = safe_atou32(rvalue, &val);
         if (r < 0) {
                 log_syntax(unit, LOG_WARNING, filename, line, r,
                            "Failed to parse '%s=', ignoring assignment: %s",
                            lvalue, rvalue);
                 return 0;
         }
+        if (val == 0) {
+                log_syntax(unit, LOG_WARNING, filename, line, 0,
+                           "Invalid '%s=', ignoring assignment: %s",
+                           lvalue, rvalue);
+                return 0;
+        }
 
+        fq_pie->packet_limit = val;
         qdisc = NULL;
 
         return 0;