network: Add support to configure DHCPv4 route MTU

This is useful for transitioning systems from small frames to jumbo frames.

Closes #14302
This commit is contained in:
Susant Sahani 2019-12-19 11:05:16 +01:00 committed by Yu Watanabe
parent a9a5d632da
commit c695dcf929
5 changed files with 13 additions and 0 deletions

View file

@ -1618,6 +1618,13 @@
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term><varname>RouteMTUBytes=</varname></term>
<listitem>
<para>Specifies the MTU for the DHCP routes. Please see the [Route] section for further details.</para>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term><varname>ListenPort=</varname></term> <term><varname>ListenPort=</varname></term>
<listitem> <listitem>

View file

@ -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); assert_se(sd_dhcp_route_get_destination_prefix_length(static_routes[i], &route->dst_prefixlen) >= 0);
route->priority = link->network->dhcp_route_metric; route->priority = link->network->dhcp_route_metric;
route->table = table; route->table = table;
route->mtu = link->network->dhcp_route_mtu;
route->scope = route_scope_from_address(route, &address); route->scope = route_scope_from_address(route, &address);
if (IN_SET(route->scope, RT_SCOPE_LINK, RT_SCOPE_UNIVERSE)) if (IN_SET(route->scope, RT_SCOPE_LINK, RT_SCOPE_UNIVERSE))
route->prefsrc.in = address; route->prefsrc.in = address;
@ -353,6 +354,7 @@ static int link_set_dhcp_routes(Link *link) {
route_gw->protocol = RTPROT_DHCP; route_gw->protocol = RTPROT_DHCP;
route_gw->priority = link->network->dhcp_route_metric; route_gw->priority = link->network->dhcp_route_metric;
route_gw->table = table; route_gw->table = table;
route_gw->mtu = link->network->dhcp_route_mtu;
r = dhcp_route_configure(&route_gw, link); r = dhcp_route_configure(&route_gw, link);
if (r < 0) if (r < 0)
@ -368,6 +370,7 @@ static int link_set_dhcp_routes(Link *link) {
route->protocol = RTPROT_DHCP; route->protocol = RTPROT_DHCP;
route->priority = link->network->dhcp_route_metric; route->priority = link->network->dhcp_route_metric;
route->table = table; route->table = table;
route->mtu = link->network->dhcp_route_mtu;
r = dhcp_route_configure(&route, link); r = dhcp_route_configure(&route, link);
if (r < 0) if (r < 0)

View file

@ -178,6 +178,7 @@ DHCPv4.SendDecline, config_parse_bool,
DHCPv4.BlackList, config_parse_dhcp_black_listed_ip_address, 0, 0 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.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.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.UseDNS, config_parse_bool, 0, offsetof(Network, dhcp6_use_dns)
DHCPv6.UseNTP, config_parse_bool, 0, offsetof(Network, dhcp6_use_ntp) DHCPv6.UseNTP, config_parse_bool, 0, offsetof(Network, dhcp6_use_ntp)
DHCPv6.RapidCommit, config_parse_bool, 0, offsetof(Network, rapid_commit) DHCPv6.RapidCommit, config_parse_bool, 0, offsetof(Network, rapid_commit)

View file

@ -95,6 +95,7 @@ struct Network {
uint64_t dhcp_max_attempts; uint64_t dhcp_max_attempts;
unsigned dhcp_route_metric; unsigned dhcp_route_metric;
uint32_t dhcp_route_table; uint32_t dhcp_route_table;
uint32_t dhcp_route_mtu;
uint16_t dhcp_client_port; uint16_t dhcp_client_port;
int dhcp_critical; int dhcp_critical;
int ip_service_type; int ip_service_type;

View file

@ -99,6 +99,7 @@ MaxAttempts=
IPServiceType= IPServiceType=
SendOption= SendOption=
SendDecline= SendDecline=
RouteMTUBytes=
[DHCPv6] [DHCPv6]
UseNTP= UseNTP=
UseDNS= UseDNS=