1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-19 22:50:17 +03:00

Merge f620d26d87dedfa021ff8d63bbe4549228122c7c into fdab24bf6acc62d3011f9b5abdf834b4886642b2

This commit is contained in:
Susant Sahani 2025-03-13 06:42:52 +01:00 committed by GitHub
commit b8325c8cff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 53 additions and 0 deletions

View File

@ -4229,6 +4229,19 @@ ServerAddress=192.168.0.1/24</programlisting>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>MTUBytes=</varname></term>
<listitem>
<para>Specifies the size of the router advertisement MTU or one of the special
value <literal>auto</literal>. When suffixed with K, M, or G, the specified
size is parsed as Kilobytes, Megabytes, or Gigabytes, respectively, to the base of 1024.
When <literal>auto</literal>, is specified the MTU of the link is automatically taken as
router advertisement MTU. Defaults to<literal>auto</literal>.</para>
<xi:include href="version-info.xml" xpointer="v257"/>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>UplinkInterface=</varname></term>
<listitem><para>Specifies the name or the index of the uplink interface, or one of the special

View File

@ -2472,6 +2472,9 @@ static int link_update_mtu(Link *link, sd_netlink_message *message) {
}
if (link->radv) {
if (link->have_router_mtu)
return 0;
r = sd_radv_set_mtu(link->radv, link->mtu);
if (r < 0)
return log_link_debug_errno(link, r, "Could not set MTU for Router Advertisement: %m");

View File

@ -182,6 +182,7 @@ typedef struct Link {
bool ndisc_configured;
sd_radv *radv;
bool have_router_mtu:1;
sd_dhcp6_client *dhcp6_client;
sd_dhcp6_lease *dhcp6_lease;

View File

@ -412,6 +412,7 @@ IPv6SendRA.Managed, config_parse_bool,
IPv6SendRA.OtherInformation, config_parse_bool, 0, offsetof(Network, router_other_information)
IPv6SendRA.RouterPreference, config_parse_router_preference, 0, offsetof(Network, router_preference)
IPv6SendRA.HopLimit, config_parse_uint8, 0, offsetof(Network, router_hop_limit)
IPv6SendRA.MTUBytes, config_parse_router_mtu, AF_INET6, offsetof(Network, router_mtu)
IPv6SendRA.EmitDNS, config_parse_bool, 0, offsetof(Network, router_emit_dns)
IPv6SendRA.DNS, config_parse_radv_dns, 0, 0
IPv6SendRA.EmitDomains, config_parse_bool, 0, offsetof(Network, router_emit_domains)

View File

@ -253,6 +253,8 @@ struct Network {
usec_t router_reachable_usec;
usec_t router_retransmit_usec;
uint8_t router_hop_limit;
uint32_t router_mtu;
bool router_mtu_auto;
bool router_managed;
bool router_other_information;
bool router_emit_dns;

View File

@ -469,6 +469,15 @@ static int radv_configure(Link *link) {
if (r < 0)
return r;
if (link->network->router_mtu > 0 || link->network->router_mtu_auto) {
r = sd_radv_set_mtu(link->radv, link->network->router_mtu_auto ? link->mtu : link->network->router_mtu);
if (r < 0)
return r;
if (link->network->router_mtu > 0)
link->have_router_mtu = true;
}
r = sd_radv_set_preference(link->radv, link->network->router_preference);
if (r < 0)
return r;
@ -1597,3 +1606,26 @@ int config_parse_router_home_agent_lifetime(
*home_agent_lifetime_usec = usec;
return 0;
}
int config_parse_router_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;
assert(rvalue);
if (streq(rvalue, "auto"))
network->router_mtu_auto = true;
else
return config_parse_mtu(unit, filename, line, section, section_line, lvalue, ltype, rvalue, data, userdata);
return 1;
}

View File

@ -77,6 +77,7 @@ CONFIG_PARSER_PROTOTYPE(config_parse_router_prefix_delegation);
CONFIG_PARSER_PROTOTYPE(config_parse_router_lifetime);
CONFIG_PARSER_PROTOTYPE(config_parse_router_uint32_msec_usec);
CONFIG_PARSER_PROTOTYPE(config_parse_router_preference);
CONFIG_PARSER_PROTOTYPE(config_parse_router_mtu);
CONFIG_PARSER_PROTOTYPE(config_parse_prefix);
CONFIG_PARSER_PROTOTYPE(config_parse_prefix_boolean);
CONFIG_PARSER_PROTOTYPE(config_parse_prefix_lifetime);