git: c2c28c0fa2e4 - main - carp: fix unicast link-local

From: Kristof Provost <kp_at_FreeBSD.org>
Date: Thu, 18 May 2023 16:01:24 UTC
The branch main has been updated by kp:

URL: https://cgit.FreeBSD.org/src/commit/?id=c2c28c0fa2e44caf1671b4dbf94167f686c3c411

commit c2c28c0fa2e44caf1671b4dbf94167f686c3c411
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2023-05-18 15:30:39 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2023-05-18 15:47:03 +0000

    carp: fix unicast link-local
    
    If the peer6 address is a link-local address we have to embed the
    scopeid, much like we have to for IPv6 multicast as well.
    
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
---
 sys/netinet/ip_carp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys/netinet/ip_carp.c b/sys/netinet/ip_carp.c
index 5eb6e0bf5166..935e7eaf92f5 100644
--- a/sys/netinet/ip_carp.c
+++ b/sys/netinet/ip_carp.c
@@ -1065,7 +1065,8 @@ carp_send_ad_locked(struct carp_softc *sc)
 
 		/* Set the multicast destination. */
 		memcpy(&ip6->ip6_dst, &sc->sc_carpaddr6, sizeof(ip6->ip6_dst));
-		if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst)) {
+		if (IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst) ||
+		    IN6_IS_ADDR_LINKLOCAL(&ip6->ip6_dst)) {
 			if (in6_setscope(&ip6->ip6_dst, sc->sc_carpdev, NULL) != 0) {
 				m_freem(m);
 				CARP_DEBUG("%s: in6_setscope failed\n", __func__);