]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network/radv: warn about non-zero preference with zero lifetime
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 20 Apr 2024 05:36:40 +0000 (14:36 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 22 Apr 2024 17:05:41 +0000 (02:05 +0900)
Note that the misconfiguration will be handled gracefully. So it is not
necessary to adjust value here. Let's only warn about that.

src/network/networkd-radv.c

index 01e1a0102a4ba2c4a75c72899b6fa30c037928d7..9ca20e1d51bf814a9190c702aa8471574c5006fd 100644 (file)
@@ -859,6 +859,15 @@ void network_adjust_radv(Network *network) {
 
         /* Below, let's verify router settings, if enabled. */
 
+        if (network->router_lifetime_usec == 0 && network->router_preference != SD_NDISC_PREFERENCE_MEDIUM)
+                /* RFC 4191, Section 2.2,
+                 * If the Router Lifetime is zero, the preference value MUST be set to (00) by the sender.
+                 *
+                 * Note, radv_send_router() gracefully handle that. So, it is not necessary to refuse, but
+                 * let's warn about that. */
+                log_notice("%s: RouterPreference=%s specified with RouterLifetimeSec=0, ignoring RouterPreference= setting.",
+                           network->filename, ndisc_router_preference_to_string(network->router_preference));
+
         Prefix *prefix;
         HASHMAP_FOREACH(prefix, network->prefixes_by_section)
                 if (prefix_section_verify(prefix) < 0)