]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
networkd: Support the ability to set MTU in [Route] sections
authorSusant Sahani <susant@redhat.com>
Mon, 21 May 2018 11:33:36 +0000 (17:03 +0530)
committerLennart Poettering <lennart@poettering.net>
Thu, 24 May 2018 14:42:40 +0000 (16:42 +0200)
Add support to set the route MTU.

Closes #9047

man/systemd.network.xml
src/network/networkd-network-gperf.gperf
src/network/networkd-route.c
src/network/networkd-route.h

index b52c1ff7e4f02e76a19a1bb924275ace4a7cd9c5..82629b917252ba2ac782da7654ad0b4aa3f00aae 100644 (file)
             </para>
           </listitem>
         </varlistentry>
-
+        <varlistentry>
+        <term><varname>MTUBytes=</varname></term>
+        <listitem>
+          <para>The maximum transmission unit in bytes to set for the
+          route. The usual suffixes K, M, G, are supported and are
+          understood to the base of 1024.</para>
+          <para>Note that if IPv6 is enabled on the interface, and the MTU is chosen
+          below 1280 (the minimum MTU for IPv6) it will automatically be increased to this value.</para>
+        </listitem>
+      </varlistentry>
       </variablelist>
   </refsect1>
 
index e3d84a365d01dedf1c24a81c66a515a11b71f16f..23f57ca2f0051d6e152aa2dc72c2c61ff2801ec9 100644 (file)
@@ -105,6 +105,7 @@ Route.Metric,                           config_parse_route_priority,
 Route.Scope,                            config_parse_route_scope,                       0,                             0
 Route.PreferredSource,                  config_parse_preferred_src,                     0,                             0
 Route.Table,                            config_parse_route_table,                       0,                             0
+Route.MTUBytes,                         config_parse_route_mtu,                         AF_UNSPEC,                     0
 Route.GatewayOnlink,                    config_parse_gateway_onlink,                    0,                             0
 Route.IPv6Preference,                   config_parse_ipv6_route_preference,             0,                             0
 Route.Protocol,                         config_parse_route_protocol,                    0,                             0
index 63a6b9c2e0b5954bec39beba92aebf8d8941be75..a5303dafa1a7d8df04a2fd08c32f9a093cac6026 100644 (file)
@@ -1177,3 +1177,38 @@ int config_parse_quickack(
 
         return 0;
 }
+
+int config_parse_route_mtu(
+                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) {
+
+        Network *network = userdata;
+        _cleanup_(route_freep) Route *n = NULL;
+        int 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;
+
+        r = config_parse_mtu(unit, filename, line, section, section_line, lvalue, ltype, rvalue, &n->mtu, userdata);
+        if (r < 0)
+                return r;
+
+        n = NULL;
+
+        return 0;
+}
index 138bad7a1a1eb8ce0e36aaebc5a82fc2cfa5afa3..61a81b4150f313c6fe8bc593b313cbed133c752a 100644 (file)
@@ -75,3 +75,4 @@ CONFIG_PARSER_PROTOTYPE(config_parse_route_protocol);
 CONFIG_PARSER_PROTOTYPE(config_parse_route_type);
 CONFIG_PARSER_PROTOTYPE(config_parse_tcp_window);
 CONFIG_PARSER_PROTOTYPE(config_parse_quickack);
+CONFIG_PARSER_PROTOTYPE(config_parse_route_mtu);