mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-22 22:03:43 +03:00
network: radv: add RouteMetric= setting in [IPv6Prefix]
This commit is contained in:
parent
9fe0b7b493
commit
0e1fb1d09a
@ -2582,6 +2582,15 @@ IPv6Token=prefixstable:2002:da8:1::</programlisting></para>
|
||||
<listitem><para>Takes a boolean. When true, adds an address from the prefix. Default to false.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><varname>RouteMetric=</varname></term>
|
||||
<listitem>
|
||||
<para>The metric of the prefix route. Takes an unsigned integer in the range 0…4294967295.
|
||||
When unset or set to 0, the kernel's default value is used. This setting is ignored when
|
||||
<varname>Assign=</varname> is false.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
|
||||
|
@ -1095,6 +1095,7 @@ int link_set_addresses(Link *link) {
|
||||
return log_link_warning_errno(link, r, "Could not generate EUI64 address: %m");
|
||||
|
||||
address->family = AF_INET6;
|
||||
address->route_metric = p->route_metric;
|
||||
r = static_address_configure(address, link);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
@ -325,6 +325,7 @@ IPv6Prefix.AddressAutoconfiguration, config_parse_prefix_flags,
|
||||
IPv6Prefix.ValidLifetimeSec, config_parse_prefix_lifetime, 0, 0
|
||||
IPv6Prefix.PreferredLifetimeSec, config_parse_prefix_lifetime, 0, 0
|
||||
IPv6Prefix.Assign, config_parse_prefix_assign, 0, 0
|
||||
IPv6Prefix.RouteMetric, config_parse_prefix_metric, 0, 0
|
||||
IPv6RoutePrefix.Route, config_parse_route_prefix, 0, 0
|
||||
IPv6RoutePrefix.LifetimeSec, config_parse_route_prefix_lifetime, 0, 0
|
||||
LLDP.MUDURL, config_parse_lldp_mud, 0, 0
|
||||
|
@ -382,6 +382,45 @@ int config_parse_prefix_assign(
|
||||
return 0;
|
||||
}
|
||||
|
||||
int config_parse_prefix_metric(
|
||||
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_(prefix_free_or_set_invalidp) Prefix *p = NULL;
|
||||
int r;
|
||||
|
||||
assert(filename);
|
||||
assert(section);
|
||||
assert(lvalue);
|
||||
assert(rvalue);
|
||||
assert(data);
|
||||
|
||||
r = prefix_new_static(network, filename, section_line, &p);
|
||||
if (r < 0)
|
||||
return log_oom();
|
||||
|
||||
r = safe_atou32(rvalue, &p->route_metric);
|
||||
if (r < 0) {
|
||||
log_syntax(unit, LOG_WARNING, filename, line, r,
|
||||
"Failed to parse %s=, ignoring assignment: %s",
|
||||
lvalue, rvalue);
|
||||
return 0;
|
||||
}
|
||||
|
||||
TAKE_PTR(p);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int config_parse_route_prefix(
|
||||
const char *unit,
|
||||
const char *filename,
|
||||
|
@ -33,6 +33,7 @@ typedef struct Prefix {
|
||||
sd_radv_prefix *radv_prefix;
|
||||
|
||||
bool assign;
|
||||
uint32_t route_metric;
|
||||
} Prefix;
|
||||
|
||||
typedef struct RoutePrefix {
|
||||
@ -64,6 +65,7 @@ CONFIG_PARSER_PROTOTYPE(config_parse_prefix);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_prefix_flags);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_prefix_lifetime);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_prefix_assign);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_prefix_metric);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_radv_dns);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_radv_search_domains);
|
||||
CONFIG_PARSER_PROTOTYPE(config_parse_route_prefix);
|
||||
|
@ -237,6 +237,7 @@ PreferredLifetimeSec=
|
||||
AddressAutoconfiguration=
|
||||
ValidLifetimeSec=
|
||||
Assign=
|
||||
RouteMetric=
|
||||
[IPv6RoutePrefix]
|
||||
Route=
|
||||
LifetimeSec=
|
||||
|
Loading…
x
Reference in New Issue
Block a user