RAOP: also support link-local addresses for IPv4

Patch by Lairton Lelis da Fonseca Junior (@lairton)

Remove the hard skip for IPv4 link-local addresses and add an interface
binding (matching the existing IPv6 link-local behavior).

The host needs a link-local address on the interface (ip addr add
169.254.x.x/16 dev wlan0 or via NetworkManager +ipv4.addresses).

Fixes #4830
This commit is contained in:
Wim Taymans 2026-02-17 13:02:03 +01:00
parent ab70dae0a8
commit 0e80287625

View file

@ -384,10 +384,8 @@ static void resolver_cb(AvahiServiceResolver *r, AvahiIfIndex interface, AvahiPr
}
avahi_address_snprint(at, sizeof(at), a);
if (spa_strstartswith(at, link_local_range)) {
pw_log_info("found link-local ip address %s - skipping tunnel creation", at);
goto done;
}
if (spa_strstartswith(at, link_local_range))
pw_log_info("found link-local ip address %s for '%s'", at, name);
tinfo = TUNNEL_INFO(.name = name);
@ -414,6 +412,11 @@ static void resolver_cb(AvahiServiceResolver *r, AvahiIfIndex interface, AvahiPr
(a->data.ipv6.address[1] & 0xc0) == 0x80)
snprintf(if_suffix, sizeof(if_suffix), "%%%d", interface);
/* For IPv4 link-local, bind to the discovery interface */
if (a->proto == AVAHI_PROTO_INET &&
spa_strstartswith(at, link_local_range))
snprintf(if_suffix, sizeof(if_suffix), "%%%d", interface);
pw_properties_setf(props, "raop.ip", "%s%s", at, if_suffix);
pw_properties_setf(props, "raop.ifindex", "%d", interface);
pw_properties_setf(props, "raop.port", "%u", port);