Fix #18: accept audio from all of a multi-homed sender's source IPs

A sender reachable at more than one IP at once (e.g. LAN + Tailscale/VPN) picks its own
egress interface per packet, so its audio can arrive from a different IP than the single
address we discovered/dialled and allow-listed. The receiver then silently dropped every
Format/Audio packet (packetsRejectedNotAllowed climbing) while heartbeats — which skip the
allow-list — kept the peer showing connected: connected but silent. (Reported by
Jonathans859 building the RemSoundApple client; receiver-side, affects any multi-homed
sender incl. Windows<->Windows over a VPN.)

Discovery now remembers ALL source IPs per peer InstanceId (PeerDiscoveryService
.addressesById, expired on the same 8 s window; GetKnownAddresses). PushAllowedReceiveSenders
unions each selected peer's endpoint address with every address that peer has announced from,
so audio from any of the peer's interfaces is accepted. The SEND targets are unchanged
(still single-address) — only the accept-list widens, and only to other addresses the SAME
peer (by InstanceId) announced from, so it can't accept an unrelated machine.

Held for next release.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Ednunp
2026-07-04 14:26:42 +01:00
co-authored by Claude Opus 4.8
parent 1c1bf5a5cb
commit 703e6a022d
2 changed files with 48 additions and 1 deletions
+15 -1
View File
@@ -5682,7 +5682,21 @@ public sealed class MainForm : Form
/// </summary>
private void PushAllowedReceiveSenders()
{
receiver.SetAllowedSenders(SelectedSendEndpoints());
// Accept audio from ANY source IP a selected peer is known to use, not only the single address
// we currently target. A multi-homed sender (on a LAN and a VPN at once) can egress audio from a
// different interface than the one we discovered or dialled; allow-listing just the one made the
// receiver silently drop that audio while heartbeats (which skip this check) kept the peer
// looking connected — connected but silent (#18). The SEND targets stay single-address; only the
// accept-list widens, and only to other addresses the SAME peer (by InstanceId) announced from.
var allowed = new List<IPEndPoint>();
var seen = new HashSet<IPAddress>();
foreach (var (id, ep) in selectedPeerEndpoints)
{
if (seen.Add(ep.Address)) allowed.Add(new IPEndPoint(ep.Address, 0));
foreach (var addr in discovery.GetKnownAddresses(id))
if (seen.Add(addr)) allowed.Add(new IPEndPoint(addr, 0));
}
receiver.SetAllowedSenders(allowed);
}
/// <summary>True if the heartbeat currently considers <paramref name="endpoint"/> healthy —