]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
networkd: add quickack option to route (#7896)
authorSusant Sahani <145210+ssahani@users.noreply.github.com>
Fri, 19 Jan 2018 23:49:15 +0000 (05:19 +0530)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 19 Jan 2018 23:49:15 +0000 (08:49 +0900)
This patch adds quickack option to enable/disable TCP quick ack
mode for per-route.

man/systemd.network.xml
src/libsystemd/sd-netlink/netlink-types.c
src/network/networkd-network-gperf.gperf
src/network/networkd-route.c
src/network/networkd-route.h

index 75c90c4e738c743a1e99147d9644c34a6c2c3f8a..dfd9ea25695652e4fa90b9a963e8c99a79115446 100644 (file)
             </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>
index 65af5cd43d13bd77846e53172507157f8dd37948..0ee7d6f0dcc0d7b25ec75c31b180f39301bc91c0 100644 (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 = {
index 816dbaf7096f4d87b97495a3aebb245b3d64fb66..6181f35a2aa4c9c234f5e860c7cb46d51baf880c 100644 (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)
index 87a92b6cdbc22f5314c8b4d97c2629ea2f4ce2e1..70dca5219baea67c61ca6378d0e5a9c7e9ea3740 100644 (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;
+}
index f856b62406fb3e10f7a52e477a75470920fbbbdf..334cb1666b6642ede10ad501308668a64d3d00a7 100644 (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);