diff --git a/man/systemd.network.xml b/man/systemd.network.xml index bdf8d9e0d9..f1bd751348 100644 --- a/man/systemd.network.xml +++ b/man/systemd.network.xml @@ -1070,19 +1070,20 @@ InitialCongestionWindow= - The TCP initial congestion window or InitialCongestionWindow is used during the start - of a TCP connection. During the start of a TCP session, when a client requests for a resource, the server's initial congestion window - determines how many data packets will be sent during the initial burst of data. Takes a number between between 1 and 4294967295 (2^32 - 1). - Defaults to unset. + The TCP initial congestion window is used during the start of a TCP connection. During the start of a TCP + session, when a client requests a resource, the server's initial congestion window determines how many data bytes + will be sent during the initial burst of data. Takes a size in bytes between 1 and 4294967295 (2^32 - 1). The usual + suffixes K, M, G are supported and are understood to the base of 1024. Defaults to unset. InitialAdvertisedReceiveWindow= - The TCP receive window size or InitialAdvertisedReceiveWindow is the amount of receive data (in bytes) - that can be buffered at one time on a connection. The sending host can send only that amount of data before waiting for - an acknowledgment and window update from the receiving host. Takes a number between 1 and 4294967295 (2^32 - 1). Defaults to unset. + The TCP initial advertised receive window is the amount of receive data (in bytes) that can initally be buffered at one time + on a connection. The sending host can send only that amount of data before waiting for an acknowledgment and window update + from the receiving host. Takes a size in bytes between 1 and 4294967295 (2^32 - 1). The usual suffixes K, M, G are supported + and are understood to the base of 1024. Defaults to unset. diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c index f06cc82717..87a92b6cdb 100644 --- a/src/network/networkd-route.c +++ b/src/network/networkd-route.c @@ -636,13 +636,13 @@ int route_configure( return log_error_errno(r, "Could not append RTAX_MTU attribute: %m"); } - if (route->initcwnd) { + if (route->initcwnd > 0) { r = sd_netlink_message_append_u32(req, RTAX_INITCWND, route->initcwnd); if (r < 0) return log_error_errno(r, "Could not append RTAX_INITCWND attribute: %m"); } - if (route->initrwnd) { + if (route->initrwnd > 0) { r = sd_netlink_message_append_u32(req, RTAX_INITRWND, route->initrwnd); if (r < 0) return log_error_errno(r, "Could not append RTAX_INITRWND attribute: %m"); @@ -1092,9 +1092,9 @@ int config_parse_tcp_window(const char *unit, const char *rvalue, void *data, void *userdata) { - Network *network = userdata; _cleanup_route_free_ Route *n = NULL; - uint32_t k; + Network *network = userdata; + uint64_t k; int r; assert(filename); @@ -1107,10 +1107,10 @@ int config_parse_tcp_window(const char *unit, if (r < 0) return r; - r = safe_atou32(rvalue, &k); - if (r < 0) { + r = parse_size(rvalue, 1024, &k); + if (r < 0 || k > UINT32_MAX) { log_syntax(unit, LOG_ERR, filename, line, r, - "Could not parse TCP %s \"%s\", ignoring assignment: %m", rvalue, lvalue); + "Could not parse TCP %s \"%s\" bytes, ignoring assignment: %m", rvalue, lvalue); return 0; }