]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: make RouteTable= also accept route table name
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 28 Oct 2022 02:06:27 +0000 (11:06 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 28 Oct 2022 02:35:17 +0000 (11:35 +0900)
man/systemd.network.xml
src/network/networkd-dhcp-common.c

index e35da7bd4ce37c0283878054cdcae7329e9b306f..ffed2ee066e9434f0f98b5ef8587e3ad9773960d 100644 (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>
 
index 6526d3378fae25f65c945049a87fa3bd743b2bc5..7b0b2dea857ba567577c340194168b2101efa57c 100644 (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);