From: Susant Sahani Date: Mon, 21 May 2018 11:33:36 +0000 (+0530) Subject: networkd: Support the ability to set MTU in [Route] sections X-Git-Tag: v239~211 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=cea79e664394d4ca89016919cef36a55dc51a369;p=thirdparty%2Fsystemd.git networkd: Support the ability to set MTU in [Route] sections Add support to set the route MTU. Closes #9047 --- diff --git a/man/systemd.network.xml b/man/systemd.network.xml index b52c1ff7e4f..82629b91725 100644 --- a/man/systemd.network.xml +++ b/man/systemd.network.xml @@ -1099,7 +1099,16 @@ - + + MTUBytes= + + 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. + 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. + + diff --git a/src/network/networkd-network-gperf.gperf b/src/network/networkd-network-gperf.gperf index e3d84a365d0..23f57ca2f00 100644 --- a/src/network/networkd-network-gperf.gperf +++ b/src/network/networkd-network-gperf.gperf @@ -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 diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c index 63a6b9c2e0b..a5303dafa1a 100644 --- a/src/network/networkd-route.c +++ b/src/network/networkd-route.c @@ -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; +} diff --git a/src/network/networkd-route.h b/src/network/networkd-route.h index 138bad7a1a1..61a81b4150f 100644 --- a/src/network/networkd-route.h +++ b/src/network/networkd-route.h @@ -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);