Skip to content

Commit 9475e23

Browse files
yuwatakeszybz
authored andcommitted
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 1412d4a. Closes systemd#28898.
1 parent b0edf3a commit 9475e23

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

man/systemd.network.xml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1728,11 +1728,11 @@ allow my_server_t localnet_peer_t:peer recv;</programlisting>
17281728
</varlistentry>
17291729

17301730
<varlistentry>
1731-
<term><varname>TCPRetransmissionTimeOutSec=</varname></term>
1731+
<term><varname>TCPRetransmissionTimeoutSec=</varname></term>
17321732
<listitem>
1733-
<para>Specifies the TCP Retransmission Time Out for the route. Takes time values in seconds.
1734-
This value specifies the timeout of an alive TCP connection, when RTO retransmissions remain unacknowledged.
1735-
When unset, the kernel's default will be used.</para>
1733+
<para>Specifies the TCP Retransmission Timeout (RTO) for the route. Takes time values in seconds.
1734+
This value specifies the timeout of an alive TCP connection, when retransmissions remain
1735+
unacknowledged. When unset, the kernel's default will be used.</para>
17361736
</listitem>
17371737
</varlistentry>
17381738

src/network/networkd-network-gperf.gperf

+1-1
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ Route.GatewayOnlink, config_parse_route_boolean,
196196
Route.IPv6Preference, config_parse_ipv6_route_preference, 0, 0
197197
Route.Protocol, config_parse_route_protocol, 0, 0
198198
Route.Type, config_parse_route_type, 0, 0
199-
Route.TCPRetransmissionTimeOutSec, config_parse_route_tcp_rto, 0, 0
199+
Route.TCPRetransmissionTimeoutSec, config_parse_route_tcp_rto, 0, 0
200200
Route.HopLimit, config_parse_route_hop_limit, 0, 0
201201
Route.InitialCongestionWindow, config_parse_route_tcp_window, 0, 0
202202
Route.InitialAdvertisedReceiveWindow, config_parse_route_tcp_window, 0, 0

src/network/networkd-route.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -1248,7 +1248,7 @@ static int route_configure(const Route *route, uint32_t lifetime_sec, Link *link
12481248
}
12491249

12501250
if (route->tcp_rto_usec > 0) {
1251-
r = sd_netlink_message_append_u32(m, RTAX_RTO_MIN, route->tcp_rto_usec / USEC_PER_MSEC);
1251+
r = sd_netlink_message_append_u32(m, RTAX_RTO_MIN, DIV_ROUND_UP(route->tcp_rto_usec, USEC_PER_MSEC));
12521252
if (r < 0)
12531253
return r;
12541254
}
@@ -2854,14 +2854,14 @@ int config_parse_route_tcp_rto(
28542854
r = parse_sec(rvalue, &usec);
28552855
if (r < 0) {
28562856
log_syntax(unit, LOG_WARNING, filename, line, r,
2857-
"Failed to parse route TCP retransmission time out (RTO) sec '%s', ignoring: %m", rvalue);
2857+
"Failed to parse route TCP retransmission timeout (RTO), ignoring assignment: %s", rvalue);
28582858
return 0;
28592859
}
28602860

2861-
if (usec != USEC_INFINITY &&
2862-
DIV_ROUND_UP(usec, USEC_PER_SEC) > UINT32_MAX) {
2861+
if (IN_SET(usec, 0, USEC_INFINITY) ||
2862+
DIV_ROUND_UP(usec, USEC_PER_MSEC) > UINT32_MAX) {
28632863
log_syntax(unit, LOG_WARNING, filename, line, 0,
2864-
"Route TCP retransmission time out (RTO) = must be in the range 0...%"PRIu32"ms, ignoring: %s", UINT32_MAX, rvalue);
2864+
"Route TCP retransmission timeout (RTO) must be in the range 0%"PRIu32"ms, ignoring assignment: %s", UINT32_MAX, rvalue);
28652865
return 0;
28662866
}
28672867

test/test-network/conf/25-route-congctl.network

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ Address=149.10.124.58/28
1010
[Route]
1111
Destination=2001:1234:5:8fff:ff:ff:ff:ff/128
1212
TCPCongestionControlAlgorithm=dctcp
13-
TCPRetransmissionTimeOutSec=300s
13+
TCPRetransmissionTimeoutSec=300s
1414

1515
[Route]
1616
Destination=149.10.124.66
1717
TCPCongestionControlAlgorithm=dctcp
18-
TCPRetransmissionTimeOutSec=300s
18+
TCPRetransmissionTimeoutSec=300s

0 commit comments

Comments
 (0)