networkd: add quickack option to route (#7896)

This patch adds quickack option to enable/disable TCP quick ack
mode for per-route.
This commit is contained in:
Susant Sahani 2018-01-20 05:19:15 +05:30 committed by Yu Watanabe
parent 877dce40cb
commit 09f5dfad2c
5 changed files with 55 additions and 0 deletions

View File

@ -1095,6 +1095,13 @@
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>QuickAck=</varname></term>
<listitem>
<para>Takes a boolean argument. When true enables TCP quick ack mode for the route. Defaults to unset.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>

View File

@ -553,6 +553,7 @@ static const NLType rtnl_route_metrics_types[] = {
[RTAX_FEATURES] = { .type = NETLINK_TYPE_U32 },
[RTAX_RTO_MIN] = { .type = NETLINK_TYPE_U32 },
[RTAX_INITRWND] = { .type = NETLINK_TYPE_U32 },
[RTAX_QUICKACK] = { .type = NETLINK_TYPE_U32 },
};
static const NLTypeSystem rtnl_route_metrics_type_system = {

View File

@ -110,6 +110,7 @@ Route.Protocol, config_parse_route_protocol,
Route.Type, config_parse_route_type, 0, 0
Route.InitialCongestionWindow, config_parse_tcp_window, 0, 0
Route.InitialAdvertisedReceiveWindow, config_parse_tcp_window, 0, 0
Route.QuickAck, config_parse_quickack, 0, 0
DHCP.ClientIdentifier, config_parse_dhcp_client_identifier, 0, offsetof(Network, dhcp_client_identifier)
DHCP.UseDNS, config_parse_bool, 0, offsetof(Network, dhcp_use_dns)
DHCP.UseNTP, config_parse_bool, 0, offsetof(Network, dhcp_use_ntp)

View File

@ -74,6 +74,7 @@ int route_new(Route **ret) {
route->type = RTN_UNICAST;
route->table = RT_TABLE_MAIN;
route->lifetime = USEC_INFINITY;
route->quickack = -1;
*ret = route;
route = NULL;
@ -648,6 +649,12 @@ int route_configure(
return log_error_errno(r, "Could not append RTAX_INITRWND attribute: %m");
}
if (route->quickack != -1) {
r = sd_netlink_message_append_u32(req, RTAX_QUICKACK, route->quickack);
if (r < 0)
return log_error_errno(r, "Could not append RTAX_QUICKACK attribute: %m");
}
r = sd_netlink_message_close_container(req);
if (r < 0)
return log_error_errno(r, "Could not append RTA_METRICS attribute: %m");
@ -1127,3 +1134,39 @@ int config_parse_tcp_window(const char *unit,
return 0;
}
int config_parse_quickack(const char *unit,
const char *filename,
unsigned line,
const char *section,
unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
void *data,
void *userdata) {
_cleanup_route_free_ Route *n = NULL;
Network *network = userdata;
int k, r;
assert(filename);
assert(section);
assert(lvalue);
assert(rvalue);
assert(data);
r = route_new_static(network, filename, section_line, &n);
if (r < 0)
return r;
k = parse_boolean(rvalue);
if (k < 0) {
log_syntax(unit, LOG_ERR, filename, line, k, "Failed to parse TCP quickack, ignoring: %s", rvalue);
return 0;
}
n->quickack = !!k;
n = NULL;
return 0;
}

View File

@ -33,6 +33,8 @@ struct Route {
Link *link;
int family;
int quickack;
unsigned char dst_prefixlen;
unsigned char src_prefixlen;
unsigned char scope;
@ -85,3 +87,4 @@ int config_parse_ipv6_route_preference(const char *unit, const char *filename, u
int config_parse_route_protocol(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
int config_parse_route_type(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
int config_parse_tcp_window(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
int config_parse_quickack(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);