]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network/radv: add [IPv6RoutePrefix] Preference= setting
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 18 Nov 2024 05:48:35 +0000 (14:48 +0900)
committerLuca Boccassi <bluca@debian.org>
Wed, 22 Jan 2025 20:48:31 +0000 (20:48 +0000)
man/systemd.network.xml
src/network/networkd-network-gperf.gperf
src/network/networkd-radv.c
src/network/networkd-radv.h

index 1c26609917e24082e90a1add788f587ef653282c..126accaca9ba822e18e7dad22c2338b01a3885e5 100644 (file)
@@ -4420,6 +4420,15 @@ ServerAddress=192.168.0.1/24</programlisting>
         <xi:include href="version-info.xml" xpointer="v244"/></listitem>
       </varlistentry>
 
+      <varlistentry>
+        <term><varname>Preference=</varname></term>
+
+        <listitem><para>Specifies the preference of the route option. Takes one of <literal>high</literal>,
+        <literal>medium</literal>, or <literal>low</literal>. Defaults to <literal>medium</literal>.</para>
+
+        <xi:include href="version-info.xml" xpointer="v258"/></listitem>
+      </varlistentry>
+
     </variablelist>
   </refsect1>
 
index 09a718efdad9a88c7a56e214619d2c5ab223e224..bf91f2c4c142b48e963049bbe700fc9a19a7b26b 100644 (file)
@@ -429,6 +429,7 @@ IPv6Prefix.RouteMetric,                      config_parse_prefix_metric,
 IPv6Prefix.Token,                            config_parse_prefix_token,                                0,                             0
 IPv6RoutePrefix.Route,                       config_parse_route_prefix,                                0,                             0
 IPv6RoutePrefix.LifetimeSec,                 config_parse_route_prefix_lifetime,                       0,                             0
+IPv6RoutePrefix.Preference,                  config_parse_route_prefix_preference,                     0,                             0
 IPv6PREF64Prefix.Prefix,                     config_parse_pref64_prefix,                               0,                             0
 IPv6PREF64Prefix.LifetimeSec,                config_parse_pref64_prefix_lifetime,                      0,                             0
 LLDP.MUDURL,                                 config_parse_mud_url,                                     0,                             offsetof(Network, lldp_mudurl)
index 9b1bd1287ad2124f86183b4cc581d2d612d8525d..fbf87091a369b51929ed21a86b0dde8ce19628f9 100644 (file)
@@ -1134,6 +1134,37 @@ int config_parse_route_prefix_lifetime(
         return 0;
 }
 
+int config_parse_route_prefix_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) {
+
+        _cleanup_(route_prefix_free_or_set_invalidp) RoutePrefix *p = NULL;
+        Network *network = ASSERT_PTR(userdata);
+        int r;
+
+        assert(filename);
+
+        r = route_prefix_new_static(network, filename, section_line, &p);
+        if (r < 0)
+                return log_oom();
+
+        r = config_parse_router_preference(unit, filename, line, section, section_line,
+                                           lvalue, ltype, rvalue, &p->route.preference, NULL);
+        if (r <= 0)
+                return r;
+
+        TAKE_PTR(p);
+        return 0;
+}
+
 int config_parse_pref64_prefix(
                 const char *unit,
                 const char *filename,
index afde1fcfe2364e02627d80ff60e3b3f473db96d2..3f0a374632afc26482333558fadc0d2864bd801f 100644 (file)
@@ -86,6 +86,7 @@ CONFIG_PARSER_PROTOTYPE(config_parse_radv_dns);
 CONFIG_PARSER_PROTOTYPE(config_parse_radv_search_domains);
 CONFIG_PARSER_PROTOTYPE(config_parse_route_prefix);
 CONFIG_PARSER_PROTOTYPE(config_parse_route_prefix_lifetime);
+CONFIG_PARSER_PROTOTYPE(config_parse_route_prefix_preference);
 CONFIG_PARSER_PROTOTYPE(config_parse_pref64_prefix);
 CONFIG_PARSER_PROTOTYPE(config_parse_pref64_prefix_lifetime);
 CONFIG_PARSER_PROTOTYPE(config_parse_router_home_agent_lifetime);