summaryrefslogtreecommitdiffstats
path: root/src/network
diff options
context:
space:
mode:
authorSusant Sahani <susant@redhat.com>2018-05-21 13:33:36 +0200
committerLennart Poettering <lennart@poettering.net>2018-05-24 16:42:40 +0200
commitcea79e664394d4ca89016919cef36a55dc51a369 (patch)
treedbbdbac7861674fa6fa81b9af289187c79e8938b /src/network
parentMerge pull request #9020 from poettering/physical-memory-cgroupsv2 (diff)
downloadsystemd-cea79e664394d4ca89016919cef36a55dc51a369.tar.xz
systemd-cea79e664394d4ca89016919cef36a55dc51a369.zip
networkd: Support the ability to set MTU in [Route] sections
Add support to set the route MTU. Closes #9047
Diffstat (limited to 'src/network')
-rw-r--r--src/network/networkd-network-gperf.gperf1
-rw-r--r--src/network/networkd-route.c35
-rw-r--r--src/network/networkd-route.h1
3 files changed, 37 insertions, 0 deletions
diff --git a/src/network/networkd-network-gperf.gperf b/src/network/networkd-network-gperf.gperf
index e3d84a365d..23f57ca2f0 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 63a6b9c2e0..a5303dafa1 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 138bad7a1a..61a81b4150 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);