kernel-netlink: Ignore deprecated candidate source addresses

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.
This commit is contained in:
Tobias Brunner 2020-07-20 16:20:24 +02:00
parent 2eb43ca405
commit a689e358e5
1 changed files with 3 additions and 2 deletions

View 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;