]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: several follow-ups for TCP-RTO setting
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 22 Aug 2023 07:06:01 +0000 (16:06 +0900)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 22 Aug 2023 13:02:59 +0000 (15:02 +0200)
- 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
src/network/networkd-network-gperf.gperf
src/network/networkd-route.c
test/test-network/conf/25-route-congctl.network

index 47b7d7b1d1f0c7845fe5039f2f2666fd33d451c3..38a0173cf0916b48abc8ba1a90dbea13225dc042 100644 (file)
@@ -1728,11 +1728,11 @@ allow my_server_t localnet_peer_t:peer recv;</programlisting>
       </varlistentry>
 
       <varlistentry>
-        <term><varname>TCPRetransmissionTimeOutSec=</varname></term>
+        <term><varname>TCPRetransmissionTimeoutSec=</varname></term>
         <listitem>
-          <para>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.</para>
+          <para>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.</para>
         </listitem>
       </varlistentry>
 
index 69db429fcdd0c6b4147383e31138e0407c983868..2e062ce3197f15dd2f4eced125df31c1f12c4b29 100644 (file)
@@ -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
index 99c9a13539536d9a7a7008fb963c6f153063aa74..587bca2b26695b4f5e0a484472e518c7b674b4f8 100644 (file)
@@ -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;
         }
 
index 2af783ad14e267604743d6b6cb0e9207196dda6b..44db736d0107db41a5d2546952cd6a14f9eefed5 100644 (file)
@@ -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