mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-03-08 20:58:20 +03:00
networkd: add support to configure route protocol. (#5890)
Closes: #5889
This commit is contained in:
parent
2f64b5d043
commit
c83ecc04d9
@ -902,6 +902,15 @@
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><varname>Protocol=</varname></term>
|
||||
<listitem>
|
||||
<para>The Protocol identifier for the route. Takes a number between 0 and 255 or the special values
|
||||
<literal>kernel</literal>, <literal>boot</literal> and <literal>static</literal>. Defaults to
|
||||
<literal>static</literal>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
|
||||
|
@ -90,6 +90,7 @@ Route.PreferredSource, config_parse_preferred_src,
|
||||
Route.Table, config_parse_route_table, 0, 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
|
||||
DHCP.ClientIdentifier, config_parse_dhcp_client_identifier, 0, offsetof(Network, dhcp_client_identifier)
|
||||
DHCP.UseDNS, config_parse_bool, 0, offsetof(Network, dhcp_use_dns)
|
||||
DHCP.UseNTP, config_parse_bool, 0, offsetof(Network, dhcp_use_ntp)
|
||||
|
@ -1012,3 +1012,40 @@ int config_parse_ipv6_route_preference(const char *unit,
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int config_parse_route_protocol(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_free_ Route *n = NULL;
|
||||
int r;
|
||||
|
||||
r = route_new_static(network, filename, section_line, &n);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
if (streq(rvalue, "kernel"))
|
||||
n->protocol = RTPROT_KERNEL;
|
||||
else if (streq(rvalue, "boot"))
|
||||
n->protocol = RTPROT_BOOT;
|
||||
else if (streq(rvalue, "static"))
|
||||
n->protocol = RTPROT_STATIC;
|
||||
else {
|
||||
r = safe_atou8(rvalue , &n->protocol);
|
||||
if (r < 0) {
|
||||
log_syntax(unit, LOG_ERR, filename, line, r, "Could not parse route protocol \"%s\", ignoring assignment: %m", rvalue);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
n = NULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -77,3 +77,4 @@ int config_parse_route_scope(const char *unit, const char *filename, unsigned li
|
||||
int config_parse_route_table(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);
|
||||
int config_parse_gateway_onlink(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);
|
||||
int config_parse_ipv6_route_preference(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);
|
||||
int config_parse_route_protocol(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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user