]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: ndisc: ignore prefix option with link-local prefix
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 3 Oct 2022 01:12:23 +0000 (10:12 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 3 Oct 2022 15:25:14 +0000 (00:25 +0900)
See https://www.rfc-editor.org/rfc/rfc4861#section-4.6.2.

src/network/networkd-ndisc.c

index b1201eb00be092907efb14b95b94a694eb0ae919..e992ebd1a9f407ccdbe8a8829914c47a4401c925 100644 (file)
@@ -469,6 +469,14 @@ static int ndisc_router_process_prefix(Link *link, sd_ndisc_router *rt) {
         if (r < 0)
                 return log_link_error_errno(link, r, "Failed to get prefix address: %m");
 
+        /* RFC 4861 Section 4.6.2:
+         * A router SHOULD NOT send a prefix option for the link-local prefix and a host SHOULD ignore such
+         * a prefix option. */
+        if (in6_addr_is_link_local(&a)) {
+                log_link_debug(link, "Received link-local prefix, ignoring autonomous prefix.");
+                return 0;
+        }
+
         r = sd_ndisc_router_prefix_get_prefixlen(rt, &prefixlen);
         if (r < 0)
                 return log_link_error_errno(link, r, "Failed to get prefix length: %m");