[Dnsmasq-discuss] Zeroing lifetime of ULA router advertisements

Chris Webb chris at arachsys.com
Sat Dec 17 16:37:12 UTC 2022


Chris Webb <chris at arachsys.com> writes:

> The lan-facing interface br0 always has a v6 ULA address, but may sometimes
> also have a global v6 address with a default v6 route available.
[...] 
> Is there an easy way to have non-zero lifetime for advertisements for the
> global prefix, but drop the route lifetime to zero for advertisements for
> the ULA prefix?

I dug into this a bit. radv.c already has a special case which sets the
router lifetime to zero when only old prefixes are being advertised. This
is nice because it does something sensible out-of-the-box, without special
config wrangling.

I wonder if we should also set the router lifetime to zero when there
are no globally-routable addresses to advertise, e.g. something like the
following which I'm running locally:

diff --git a/src/radv.c b/src/radv.c
index 5820f4a..16737c4 100644
--- a/src/radv.c
+++ b/src/radv.c
@@ -402,8 +402,8 @@ static void send_ra_alias(time_t now, int iface, char *iface_name, struct in6_ad
 	up = &context->next;
     }
     
-  /* If we're advertising only old prefixes, set router lifetime to zero. */
-  if (old_prefix && !parm.found_context)
+  /* If we're advertising only local or old prefixes, set router lifetime to zero. */
+  if ((old_prefix && !parm.found_context) || parm.glob_pref_time == 0)
     ra->lifetime = htons(0);
 
   /* No prefixes to advertise. */




More information about the Dnsmasq-discuss mailing list