]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: limit InitialCongestionWindow= and InitialAdvertisedReceiveWindow= value
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 29 Sep 2020 04:55:14 +0000 (13:55 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 29 Sep 2020 04:55:17 +0000 (13:55 +0900)
Strivtly speaking, this breaks backward compatibility. But setting
too large value into them, then their networking easily breaks.
Note that typically 100 for them is event too large. So, ommiting the
values equal or higher than 1024, and dropping support of k, M, and G
suffixes is OK for normal appropriate use cases.

See discussion in #16643.

src/network/networkd-route.c

index b82c4e7f79e2b07b68af557719d5e0f87e794428..2610b24c82a787d4f62389dc2a52fa3110b904d6 100644 (file)
@@ -1465,7 +1465,7 @@ int config_parse_tcp_window(
 
         _cleanup_(route_free_or_set_invalidp) Route *n = NULL;
         Network *network = userdata;
-        uint64_t k;
+        uint32_t k;
         int r;
 
         assert(filename);
@@ -1483,13 +1483,13 @@ int config_parse_tcp_window(
                 return 0;
         }
 
-        r = parse_size(rvalue, 1024, &k);
+        r = safe_atou32(rvalue, &k);
         if (r < 0) {
                 log_syntax(unit, LOG_WARNING, filename, line, r,
                            "Could not parse TCP %s \"%s\", ignoring assignment: %m", lvalue, rvalue);
                 return 0;
         }
-        if (k > UINT32_MAX) {
+        if (k >= 1024) {
                 log_syntax(unit, LOG_WARNING, filename, line, 0,
                            "Specified TCP %s \"%s\" is too large, ignoring assignment: %m", lvalue, rvalue);
                 return 0;