Commit 7458391a8c for strongswan.org

commit 7458391a8ceef6d246b2409c1e2f5a432e772a4d
Author: Tobias Brunner <tobias@strongswan.org>
Date:   Thu Sep 17 11:09:22 2026 +0200

    kernel-iph: Ignore addresses with unusable scope (loopback/linklocal)

    Similar to the previous commit, but we apply the filter when gathering
    the addresses, where IPv6 link-local addresses were already filtered.

diff --git a/src/libcharon/plugins/kernel_iph/kernel_iph_net.c b/src/libcharon/plugins/kernel_iph/kernel_iph_net.c
index 6530763443..fed5b8fa92 100644
--- a/src/libcharon/plugins/kernel_iph/kernel_iph_net.c
+++ b/src/libcharon/plugins/kernel_iph/kernel_iph_net.c
@@ -172,22 +172,17 @@ static void update_addrs(private_kernel_iph_net_t *this, iface_t *entry,

 	for (current = addr->FirstUnicastAddress; current; current = current->Next)
 	{
-		if (current->Address.lpSockaddr->sa_family == AF_INET6)
-		{
-			struct sockaddr_in6 *sin;
-
-			sin = (struct sockaddr_in6*)current->Address.lpSockaddr;
-			if (IN6_IS_ADDR_LINKLOCAL(&sin->sin6_addr))
-			{
-				continue;
-			}
-		}
-
 		host = host_create_from_sockaddr(current->Address.lpSockaddr);
 		if (host)
 		{
 			bool found = FALSE;

+			if (host_is_loopback(host) || host_is_linklocal(host))
+			{	/* skip loopback and link-local addresses */
+				host->destroy(host);
+				continue;
+			}
+
 			enumerator = list->create_enumerator(list);
 			while (enumerator->enumerate(enumerator, &old))
 			{