summaryrefslogtreecommitdiffstats
path: root/src/network/networkd-ndisc.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2022-10-03 03:12:23 +0200
committerYu Watanabe <watanabe.yu+github@gmail.com>2022-10-03 17:25:14 +0200
commita115c60e0de034c81d10f9ecad3045aa663884b7 (patch)
tree9b8e8739ae39ea21d5dd354da9df762dd117ac82 /src/network/networkd-ndisc.c
parentnetwork: ndisc: read prefix earlier (diff)
downloadsystemd-a115c60e0de034c81d10f9ecad3045aa663884b7.tar.xz
systemd-a115c60e0de034c81d10f9ecad3045aa663884b7.zip
network: ndisc: ignore prefix option with link-local prefix
See https://www.rfc-editor.org/rfc/rfc4861#section-4.6.2.
Diffstat (limited to '')
-rw-r--r--src/network/networkd-ndisc.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/network/networkd-ndisc.c b/src/network/networkd-ndisc.c
index b1201eb00b..e992ebd1a9 100644
--- a/src/network/networkd-ndisc.c
+++ b/src/network/networkd-ndisc.c
@@ -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");