]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: wireguard: also accept negative boolean values to disable adding routes 22136/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 16 Jan 2022 06:59:45 +0000 (15:59 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 16 Jan 2022 10:25:28 +0000 (19:25 +0900)
RouteTable=off was introduced to provide consistency with wg-quick
command. This makes the RouteTable= settings accepts other negative
boolean values.

man/systemd.netdev.xml
src/network/netdev/wireguard.c

index 051c45c74852450c14e268c1656c469bf95e88d0..ee5b61a06848cf13b7e7a63617632e67b798d605 100644 (file)
         <term><varname>RouteTable=</varname></term>
         <listitem>
           <para>The table identifier for the routes to the addresses specified in the
-          <varname>AllowedIPs=</varname>. Takes the special value <literal>off</literal>, one of the
-          predefined names <literal>default</literal>, <literal>main</literal>, and
-          <literal>local</literal>, names defined in <varname>RouteTable=</varname> in
+          <varname>AllowedIPs=</varname>. Takes a negative boolean value, one of the predefined names
+          <literal>default</literal>, <literal>main</literal>, and <literal>local</literal>, names
+          defined in <varname>RouteTable=</varname> in
           <citerefentry><refentrytitle>networkd.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
           or a number in the range 1…4294967295. When <literal>off</literal> the routes to the
           addresses specified in the <varname>AllowedIPs=</varname> setting will not be configured.
-          Defaults to <literal>off</literal>. This setting will be ignored when the same setting is
-          specified in the [WireGuardPeer] section.</para>
+          Defaults to false. This setting will be ignored when the same setting is specified in the
+          [WireGuardPeer] section.</para>
         </listitem>
       </varlistentry>
       <varlistentry>
         <term><varname>RouteTable=</varname></term>
         <listitem>
           <para>The table identifier for the routes to the addresses specified in the
-          <varname>AllowedIPs=</varname>. Takes the special value <literal>off</literal>, one of the
-          predefined names <literal>default</literal>, <literal>main</literal>, and
-          <literal>local</literal>, names defined in <varname>RouteTable=</varname> in
+          <varname>AllowedIPs=</varname>. Takes a negative boolean value, one of the predefined names
+          <literal>default</literal>, <literal>main</literal>, and <literal>local</literal>, names
+          defined in <varname>RouteTable=</varname> in
           <citerefentry><refentrytitle>networkd.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
           or a number in the range 1…4294967295. Defaults to unset, and the value specified in the
           same setting in the [WireGuard] section will be used.</para>
index 2b26a92f5d9f235757b149c86abf4e7beb2b18be..88f668753a50b9d6978e46d842422ed787374455 100644 (file)
@@ -895,7 +895,7 @@ int config_parse_wireguard_route_table(
         assert(data);
         assert(userdata);
 
-        if (isempty(rvalue) || streq(rvalue, "off")) {
+        if (isempty(rvalue) || parse_boolean(rvalue) == 0) {
                 *table = 0; /* Disabled. */
                 return 0;
         }
@@ -947,7 +947,7 @@ int config_parse_wireguard_peer_route_table(
                 return 0;
         }
 
-        if (streq(rvalue, "off")) {
+        if (parse_boolean(rvalue) == 0) {
                 peer->route_table = 0; /* Disabled. */
                 peer->route_table_set = true;
                 TAKE_PTR(peer);