From: Susant Sahani <145210+ssahani@users.noreply.github.com> Date: Fri, 19 Jan 2018 23:49:15 +0000 (+0530) Subject: networkd: add quickack option to route (#7896) X-Git-Tag: v237~74 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=09f5dfad2c0b1a0abf13b618dba99f449a22cfea;p=thirdparty%2Fsystemd.git networkd: add quickack option to route (#7896) This patch adds quickack option to enable/disable TCP quick ack mode for per-route. --- diff --git a/man/systemd.network.xml b/man/systemd.network.xml index 75c90c4e738..dfd9ea25695 100644 --- a/man/systemd.network.xml +++ b/man/systemd.network.xml @@ -1095,6 +1095,13 @@ + + QuickAck= + + Takes a boolean argument. When true enables TCP quick ack mode for the route. Defaults to unset. + + + diff --git a/src/libsystemd/sd-netlink/netlink-types.c b/src/libsystemd/sd-netlink/netlink-types.c index 65af5cd43d1..0ee7d6f0dcc 100644 --- a/src/libsystemd/sd-netlink/netlink-types.c +++ b/src/libsystemd/sd-netlink/netlink-types.c @@ -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 = { diff --git a/src/network/networkd-network-gperf.gperf b/src/network/networkd-network-gperf.gperf index 816dbaf7096..6181f35a2aa 100644 --- a/src/network/networkd-network-gperf.gperf +++ b/src/network/networkd-network-gperf.gperf @@ -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) diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c index 87a92b6cdbc..70dca5219ba 100644 --- a/src/network/networkd-route.c +++ b/src/network/networkd-route.c @@ -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; +} diff --git a/src/network/networkd-route.h b/src/network/networkd-route.h index f856b62406f..334cb1666b6 100644 --- a/src/network/networkd-route.h +++ b/src/network/networkd-route.h @@ -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);