network: make link_get_address() provide matching address with peer

As all callers do not care if the address has peer address.
This also drops prefixlen argument as it is always zero.

Fixes a bug introduced by 42f8b6a808.
Fixes #31950.
This commit is contained in:
Yu Watanabe
2024-07-31 05:36:14 +09:00
parent d9ef1cc407
commit 56f91e2d0b
6 changed files with 63 additions and 37 deletions
+1 -1
View File
@@ -1382,7 +1382,7 @@ static int ndisc_router_process_route(Link *link, sd_ndisc_router *rt) {
if (r < 0)
return log_link_warning_errno(link, r, "Failed to get gateway address from RA: %m");
if (link_get_ipv6_address(link, &gateway, 0, NULL) >= 0) {
if (link_get_ipv6_address(link, &gateway, NULL) >= 0) {
if (DEBUG_LOGGING)
log_link_debug(link, "Advertised route gateway %s is local to the link, ignoring route",
IN6_ADDR_TO_STRING(&gateway));