Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 4 Oct 2025 22:03:22 -0700
From:      Gleb Smirnoff <glebius@freebsd.org>
To:        "Andrey V. Elsukov" <ae@freebsd.org>, kp@freebsd.org
Cc:        src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org
Subject:   Re: git: 716acd9367df - main - carp6: revise the generation of ND6 NA
Message-ID:  <aOH8GsUlC3kqMXEj@cell.glebi.us>
In-Reply-To: <202510030802.59382PmL063849@gitrepo.freebsd.org>
References:  <202510030802.59382PmL063849@gitrepo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Oct 03, 2025 at 08:02:25AM +0000, Andrey V. Elsukov wrote:
A>  static void
A>  carp_send_na(struct carp_softc *sc)
A>  {
A> -	static struct in6_addr mcast = IN6ADDR_LINKLOCAL_ALLNODES_INIT;
A>  	struct ifaddr *ifa;
A> -	struct in6_addr *in6;
A> +	int flags;
A>  
A> +	/*
A> +	 * Sending Unsolicited Neighbor Advertisements
A> +	 *
A> +	 * If the node is a router, we MUST set the Router flag to one.
A> +	 * We set Override flag to one and send link-layer address option,
A> +	 * thus neighboring nodes will install the new link-layer address.
A> +	 */
A> +	flags = ND_NA_FLAG_OVERRIDE;
A> +	if (V_ip6_forwarding)
A> +		flags |= ND_NA_FLAG_ROUTER;
A>  	CARP_FOREACH_IFA(sc, ifa) {
A>  		if (ifa->ifa_addr->sa_family != AF_INET6)
A>  			continue;
A> -
A> -		in6 = IFA_IN6(ifa);
A> -		nd6_na_output(sc->sc_carpdev, &mcast, in6,
A> -		    ND_NA_FLAG_OVERRIDE, 1, NULL);
A> -		DELAY(1000);	/* XXX */
A> +		/*
A> +		 * We use unspecified address as destination here to avoid
A> +		 * scope initialization for each call.
A> +		 * nd6_na_output() will use all nodes multicast address if
A> +		 * destinaion address is unspecified.
A> +		 */
A> +		nd6_na_output(sc->sc_carpdev, &in6addr_any, IFA_IN6(ifa),
A> +		    flags, ND6_NA_OPT_LLA | ND6_NA_CARP_MASTER, NULL);
A> +		DELAY(1000);	/* RetransTimer */
A>  	}
A>  }

Not really related to the change, but since the change
preserved the DELAY(), asking as a reply to the change.

This function is executed in callout(9) context, so we are stopping the
callout thread, that otherwise could be servicing other tasks, for 1000
microseconds per address that is being redundant under same VHID.  This
DELAY() comes all the way from original import from OpenBSD.  Is there
any specification in IPv6 that prevents us from quickly sending a bunch
of different NAs? I see that nd6_na_output_fib() has comments above:
 
 * Based on RFC 2461
 *
 * the following items are not implemented yet:
 * - proxy advertisement delay rule (RFC2461 7.2.8, last paragraph, SHOULD)
 * - anycast advertisement delay rule (RFC2461 7.2.7, SHOULD)
 
Is this related to that or not?

-- 
Gleb Smirnoff



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?aOH8GsUlC3kqMXEj>