networkd: initcwn/initwnd use the right parsers

Closes #7765
This commit is contained in:
Susant Sahani 2018-01-02 14:50:15 +05:30 committed by Lennart Poettering
parent 28da8a9f1e
commit 6b21ad33ab
2 changed files with 15 additions and 14 deletions

View File

@ -1070,19 +1070,20 @@
<varlistentry>
<term><varname>InitialCongestionWindow=</varname></term>
<listitem>
<para>The TCP initial congestion window or <literal>InitialCongestionWindow</literal> 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.
<para>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.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>InitialAdvertisedReceiveWindow=</varname></term>
<listitem>
<para>The TCP receive window size or <literal>InitialAdvertisedReceiveWindow</literal> 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.
<para>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.
</para>
</listitem>
</varlistentry>

View File

@ -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;
}