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 1412d4a4fe.
Closes #28898.
This commit is contained in:
Yu Watanabe 2023-08-22 16:06:01 +09:00 committed by Zbigniew Jędrzejewski-Szmek
parent b0edf3a303
commit 9475e23c90
4 changed files with 12 additions and 12 deletions

View File

@ -1728,11 +1728,11 @@ allow my_server_t localnet_peer_t:peer recv;</programlisting>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><varname>TCPRetransmissionTimeOutSec=</varname></term> <term><varname>TCPRetransmissionTimeoutSec=</varname></term>
<listitem> <listitem>
<para>Specifies the TCP Retransmission Time Out for the route. Takes time values in seconds. <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 RTO retransmissions remain unacknowledged. This value specifies the timeout of an alive TCP connection, when retransmissions remain
When unset, the kernel's default will be used.</para> unacknowledged. When unset, the kernel's default will be used.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>

View File

@ -196,7 +196,7 @@ Route.GatewayOnlink, config_parse_route_boolean,
Route.IPv6Preference, config_parse_ipv6_route_preference, 0, 0 Route.IPv6Preference, config_parse_ipv6_route_preference, 0, 0
Route.Protocol, config_parse_route_protocol, 0, 0 Route.Protocol, config_parse_route_protocol, 0, 0
Route.Type, config_parse_route_type, 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.HopLimit, config_parse_route_hop_limit, 0, 0
Route.InitialCongestionWindow, config_parse_route_tcp_window, 0, 0 Route.InitialCongestionWindow, config_parse_route_tcp_window, 0, 0
Route.InitialAdvertisedReceiveWindow, config_parse_route_tcp_window, 0, 0 Route.InitialAdvertisedReceiveWindow, config_parse_route_tcp_window, 0, 0

View File

@ -1248,7 +1248,7 @@ static int route_configure(const Route *route, uint32_t lifetime_sec, Link *link
} }
if (route->tcp_rto_usec > 0) { 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) if (r < 0)
return r; return r;
} }
@ -2854,14 +2854,14 @@ int config_parse_route_tcp_rto(
r = parse_sec(rvalue, &usec); r = parse_sec(rvalue, &usec);
if (r < 0) { if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r, 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; return 0;
} }
if (usec != USEC_INFINITY && if (IN_SET(usec, 0, USEC_INFINITY) ||
DIV_ROUND_UP(usec, USEC_PER_SEC) > UINT32_MAX) { DIV_ROUND_UP(usec, USEC_PER_MSEC) > UINT32_MAX) {
log_syntax(unit, LOG_WARNING, filename, line, 0, 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; return 0;
} }

View File

@ -10,9 +10,9 @@ Address=149.10.124.58/28
[Route] [Route]
Destination=2001:1234:5:8fff:ff:ff:ff:ff/128 Destination=2001:1234:5:8fff:ff:ff:ff:ff/128
TCPCongestionControlAlgorithm=dctcp TCPCongestionControlAlgorithm=dctcp
TCPRetransmissionTimeOutSec=300s TCPRetransmissionTimeoutSec=300s
[Route] [Route]
Destination=149.10.124.66 Destination=149.10.124.66
TCPCongestionControlAlgorithm=dctcp TCPCongestionControlAlgorithm=dctcp
TCPRetransmissionTimeOutSec=300s TCPRetransmissionTimeoutSec=300s