From b5945b7aff94e4617ce7a2e2fd6c42102c86f934 Mon Sep 17 00:00:00 2001 From: Jon Franklin Date: Mon, 7 Oct 2024 10:14:42 -0500 Subject: [PATCH] Don't configure an IPv6 link-local address if noipv6rs is set --- src/if-linux.c | 10 +++++----- src/ipv6.c | 3 ++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/if-linux.c b/src/if-linux.c index ef73b305..56d37f45 100644 --- a/src/if-linux.c +++ b/src/if-linux.c @@ -2173,6 +2173,11 @@ if_setup_inet6(const struct interface *ifp) int ra; char path[256]; + /* If not doing autoconf, don't disable the kernel from doing it. + * If we need to, we should have another option actively disable it. */ + if (!(ifp->options->options & DHCPCD_IPV6RS)) + return; + /* Modern linux kernels can make a stable private address. * However, a lot of distros ship newer kernel headers than * the kernel itself so we sweep that error under the table @@ -2181,11 +2186,6 @@ if_setup_inet6(const struct interface *ifp) errno != ENODEV && errno != ENOTSUP && errno != EINVAL) logdebug("%s: if_disable_autolinklocal", ifp->name); - /* If not doing autoconf, don't disable the kernel from doing it. - * If we need to, we should have another option actively disable it. */ - if (!(ifp->options->options & DHCPCD_IPV6RS)) - return; - snprintf(path, sizeof(path), "%s/%s/autoconf", p_conf, ifp->name); ra = check_proc_int(ctx, path); if (ra == -1) { diff --git a/src/ipv6.c b/src/ipv6.c index 576c63d9..bacf93b7 100644 --- a/src/ipv6.c +++ b/src/ipv6.c @@ -1428,7 +1428,8 @@ ipv6_addlinklocal(struct interface *ifp) struct ipv6_addr *ap, *ap2; int dadcounter; - if (!(ifp->options->options & DHCPCD_CONFIGURE)) + if (!(ifp->options->options & DHCPCD_CONFIGURE) || + !(ifp->options->options & DHCPCD_IPV6RS)) return 0; /* Check sanity before malloc */