From 9475e23c90c111e6a97b2ea2253c3c11e912a2eb Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Tue, 22 Aug 2023 16:06:01 +0900 Subject: [PATCH] network: several follow-ups for TCP-RTO setting - rename TCPRetransmissionTimeOutSec= -> TCPRetransmissionTimeoutSec, - refuse infinity, - fix the input value verifier (USEC_PER_SEC -> USEC_PER_MSEC), - use DIV_ROUND_UP() when assigning the value. Follow-ups for 1412d4a4fea234fd2afda26b1241cd700246a672. Closes #28898. --- man/systemd.network.xml | 8 ++++---- src/network/networkd-network-gperf.gperf | 2 +- src/network/networkd-route.c | 10 +++++----- test/test-network/conf/25-route-congctl.network | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/man/systemd.network.xml b/man/systemd.network.xml index 47b7d7b1d1f..38a0173cf09 100644 --- a/man/systemd.network.xml +++ b/man/systemd.network.xml @@ -1728,11 +1728,11 @@ allow my_server_t localnet_peer_t:peer recv; - TCPRetransmissionTimeOutSec= + TCPRetransmissionTimeoutSec= - Specifies the TCP Retransmission Time Out for the route. Takes time values in seconds. - This value specifies the timeout of an alive TCP connection, when RTO retransmissions remain unacknowledged. - When unset, the kernel's default will be used. + Specifies the TCP Retransmission Timeout (RTO) for the route. Takes time values in seconds. + This value specifies the timeout of an alive TCP connection, when retransmissions remain + unacknowledged. When unset, the kernel's default will be used. diff --git a/src/network/networkd-network-gperf.gperf b/src/network/networkd-network-gperf.gperf index 69db429fcdd..2e062ce3197 100644 --- a/src/network/networkd-network-gperf.gperf +++ b/src/network/networkd-network-gperf.gperf @@ -196,7 +196,7 @@ Route.GatewayOnlink, config_parse_route_boolean, Route.IPv6Preference, config_parse_ipv6_route_preference, 0, 0 Route.Protocol, config_parse_route_protocol, 0, 0 Route.Type, config_parse_route_type, 0, 0 -Route.TCPRetransmissionTimeOutSec, config_parse_route_tcp_rto, 0, 0 +Route.TCPRetransmissionTimeoutSec, config_parse_route_tcp_rto, 0, 0 Route.HopLimit, config_parse_route_hop_limit, 0, 0 Route.InitialCongestionWindow, config_parse_route_tcp_window, 0, 0 Route.InitialAdvertisedReceiveWindow, config_parse_route_tcp_window, 0, 0 diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c index 99c9a135395..587bca2b266 100644 --- a/src/network/networkd-route.c +++ b/src/network/networkd-route.c @@ -1248,7 +1248,7 @@ static int route_configure(const Route *route, uint32_t lifetime_sec, Link *link } if (route->tcp_rto_usec > 0) { - r = sd_netlink_message_append_u32(m, RTAX_RTO_MIN, route->tcp_rto_usec / USEC_PER_MSEC); + r = sd_netlink_message_append_u32(m, RTAX_RTO_MIN, DIV_ROUND_UP(route->tcp_rto_usec, USEC_PER_MSEC)); if (r < 0) return r; } @@ -2854,14 +2854,14 @@ int config_parse_route_tcp_rto( r = parse_sec(rvalue, &usec); if (r < 0) { log_syntax(unit, LOG_WARNING, filename, line, r, - "Failed to parse route TCP retransmission time out (RTO) sec '%s', ignoring: %m", rvalue); + "Failed to parse route TCP retransmission timeout (RTO), ignoring assignment: %s", rvalue); return 0; } - if (usec != USEC_INFINITY && - DIV_ROUND_UP(usec, USEC_PER_SEC) > UINT32_MAX) { + if (IN_SET(usec, 0, USEC_INFINITY) || + DIV_ROUND_UP(usec, USEC_PER_MSEC) > UINT32_MAX) { log_syntax(unit, LOG_WARNING, filename, line, 0, - "Route TCP retransmission time out (RTO) = must be in the range 0...%"PRIu32"ms, ignoring: %s", UINT32_MAX, rvalue); + "Route TCP retransmission timeout (RTO) must be in the range 0…%"PRIu32"ms, ignoring assignment: %s", UINT32_MAX, rvalue); return 0; } diff --git a/test/test-network/conf/25-route-congctl.network b/test/test-network/conf/25-route-congctl.network index 2af783ad14e..44db736d010 100644 --- a/test/test-network/conf/25-route-congctl.network +++ b/test/test-network/conf/25-route-congctl.network @@ -10,9 +10,9 @@ Address=149.10.124.58/28 [Route] Destination=2001:1234:5:8fff:ff:ff:ff:ff/128 TCPCongestionControlAlgorithm=dctcp -TCPRetransmissionTimeOutSec=300s +TCPRetransmissionTimeoutSec=300s [Route] Destination=149.10.124.66 TCPCongestionControlAlgorithm=dctcp -TCPRetransmissionTimeOutSec=300s +TCPRetransmissionTimeoutSec=300s