From: Susant Sahani Date: Thu, 19 Dec 2019 10:05:16 +0000 (+0100) Subject: network: Add support to configure DHCPv4 route MTU X-Git-Tag: v245-rc1~214 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c695dcf929bca064221761d95860cdf4940b3951;p=thirdparty%2Fsystemd.git network: Add support to configure DHCPv4 route MTU This is useful for transitioning systems from small frames to jumbo frames. Closes #14302 --- diff --git a/man/systemd.network.xml b/man/systemd.network.xml index 45b976305b8..0549c02968a 100644 --- a/man/systemd.network.xml +++ b/man/systemd.network.xml @@ -1618,6 +1618,13 @@ + + RouteMTUBytes= + + Specifies the MTU for the DHCP routes. Please see the [Route] section for further details. + + + ListenPort= diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c index fc8f44d6aaa..66d83e76bfa 100644 --- a/src/network/networkd-dhcp4.c +++ b/src/network/networkd-dhcp4.c @@ -310,6 +310,7 @@ static int link_set_dhcp_routes(Link *link) { assert_se(sd_dhcp_route_get_destination_prefix_length(static_routes[i], &route->dst_prefixlen) >= 0); route->priority = link->network->dhcp_route_metric; route->table = table; + route->mtu = link->network->dhcp_route_mtu; route->scope = route_scope_from_address(route, &address); if (IN_SET(route->scope, RT_SCOPE_LINK, RT_SCOPE_UNIVERSE)) route->prefsrc.in = address; @@ -353,6 +354,7 @@ static int link_set_dhcp_routes(Link *link) { route_gw->protocol = RTPROT_DHCP; route_gw->priority = link->network->dhcp_route_metric; route_gw->table = table; + route_gw->mtu = link->network->dhcp_route_mtu; r = dhcp_route_configure(&route_gw, link); if (r < 0) @@ -368,6 +370,7 @@ static int link_set_dhcp_routes(Link *link) { route->protocol = RTPROT_DHCP; route->priority = link->network->dhcp_route_metric; route->table = table; + route->mtu = link->network->dhcp_route_mtu; r = dhcp_route_configure(&route, link); if (r < 0) diff --git a/src/network/networkd-network-gperf.gperf b/src/network/networkd-network-gperf.gperf index 7c13973f908..4912b5e8149 100644 --- a/src/network/networkd-network-gperf.gperf +++ b/src/network/networkd-network-gperf.gperf @@ -178,6 +178,7 @@ DHCPv4.SendDecline, config_parse_bool, DHCPv4.BlackList, config_parse_dhcp_black_listed_ip_address, 0, 0 DHCPv4.IPServiceType, config_parse_ip_service_type, 0, offsetof(Network, ip_service_type) DHCPv4.SendOption, config_parse_dhcp_send_option, 0, offsetof(Network, dhcp_client_send_options) +DHCPv4.RouteMTUBytes, config_parse_mtu, AF_INET, offsetof(Network, dhcp_route_mtu) DHCPv6.UseDNS, config_parse_bool, 0, offsetof(Network, dhcp6_use_dns) DHCPv6.UseNTP, config_parse_bool, 0, offsetof(Network, dhcp6_use_ntp) DHCPv6.RapidCommit, config_parse_bool, 0, offsetof(Network, rapid_commit) diff --git a/src/network/networkd-network.h b/src/network/networkd-network.h index 4f229103a7b..783f23c5dd0 100644 --- a/src/network/networkd-network.h +++ b/src/network/networkd-network.h @@ -95,6 +95,7 @@ struct Network { uint64_t dhcp_max_attempts; unsigned dhcp_route_metric; uint32_t dhcp_route_table; + uint32_t dhcp_route_mtu; uint16_t dhcp_client_port; int dhcp_critical; int ip_service_type; diff --git a/test/fuzz/fuzz-network-parser/directives.network b/test/fuzz/fuzz-network-parser/directives.network index 76939b15d3a..6c306d6dd5d 100644 --- a/test/fuzz/fuzz-network-parser/directives.network +++ b/test/fuzz/fuzz-network-parser/directives.network @@ -99,6 +99,7 @@ MaxAttempts= IPServiceType= SendOption= SendDecline= +RouteMTUBytes= [DHCPv6] UseNTP= UseDNS=