]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
kernel-netlink: Ignore deprecated candidate source addresses
authorTobias Brunner <tobias@strongswan.org>
Mon, 20 Jul 2020 14:20:24 +0000 (16:20 +0200)
committerTobias Brunner <tobias@strongswan.org>
Thu, 29 Oct 2020 08:46:14 +0000 (09:46 +0100)
The currently used address may get deprecated e.g. if an IPv6 prefix changes.
In this case we should switch to another address.

Fixes #3511.

src/libcharon/plugins/kernel_netlink/kernel_netlink_net.c

index 57a26b7deb8a0246be3fd2b7454e138fb5822d89..8d53326ea015eb6f89ba5042715e439d2ea19048 100644 (file)
@@ -942,8 +942,9 @@ static host_t *get_matching_address(private_kernel_netlink_net_t *this,
                                {       /* optionally match a subnet */
                                        continue;
                                }
-                               if (candidate && candidate->ip_equals(candidate, addr->ip))
-                               {       /* stop if we find the candidate */
+                               if (candidate && candidate->ip_equals(candidate, addr->ip) &&
+                                       !(addr->flags & IFA_F_DEPRECATED))
+                               {       /* stop if we find the candidate and it's not deprecated */
                                        best = addr;
                                        candidate_matched = TRUE;
                                        break;