1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-22 13:33:56 +03:00

network: make RouteTable= also accept route table name

This commit is contained in:
Yu Watanabe 2022-10-28 11:06:27 +09:00
parent 513bed294e
commit 7db98bc938
2 changed files with 15 additions and 8 deletions

View File

@ -2008,9 +2008,11 @@ allow my_server_t localnet_peer_t:peer recv;</programlisting>
<varlistentry>
<term><varname>RouteTable=<replaceable>num</replaceable></varname></term>
<listitem>
<para>The table identifier for DHCP routes (a number between 1 and 4294967295, or 0 to
unset). The table can be retrieved using
<command>ip route show table <replaceable>num</replaceable></command>.</para>
<para>The table identifier for DHCP routes. Takes one of predefined names
<literal>default</literal>, <literal>main</literal>, and <literal>local</literal>, and names
defined in <varname>RouteTable=</varname> in
<citerefentry><refentrytitle>networkd.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
or a number between 1…4294967295.</para>
<para>When used in combination with <varname>VRF=</varname>, the VRF's routing table is
used when this parameter is not specified.</para>
@ -2502,10 +2504,14 @@ Token=prefixstable:2002:da8:1::</programlisting></para>
<varlistentry>
<term><varname>RouteTable=<replaceable>num</replaceable></varname></term>
<listitem>
<para>The table identifier for the routes received in the Router Advertisement
(a number between 1 and 4294967295, or 0 to unset).
The table can be retrieved using <command>ip route show table <replaceable>num</replaceable></command>.
</para>
<para>The table identifier for the routes received in the Router Advertisement. Takes one of
predefined names <literal>default</literal>, <literal>main</literal>, and <literal>local</literal>,
and names defined in <varname>RouteTable=</varname> in
<citerefentry><refentrytitle>networkd.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
or a number between 1…4294967295.</para>
<para>When used in combination with <varname>VRF=</varname>, the VRF's routing table is
used when this parameter is not specified.</para>
</listitem>
</varlistentry>

View File

@ -15,6 +15,7 @@
#include "networkd-link.h"
#include "networkd-manager.h"
#include "networkd-network.h"
#include "networkd-route-util.h"
#include "parse-util.h"
#include "socket-util.h"
#include "string-table.h"
@ -529,7 +530,7 @@ int config_parse_dhcp_or_ra_route_table(
assert(IN_SET(ltype, AF_INET, AF_INET6));
assert(rvalue);
r = safe_atou32(rvalue, &rt);
r = manager_get_route_table_from_string(network->manager, rvalue, &rt);
if (r < 0) {
log_syntax(unit, LOG_WARNING, filename, line, r,
"Failed to parse RouteTable=%s, ignoring assignment: %m", rvalue);