Hi -
I'm still working towards a pull request to handle private addresses better.
Currently, we've got a long standing bug in the FreeSWITCH address selection logic that always prefers an IP address on the local subnet over everything else. This means that if the server's private IP address space overlaps with the client's private IP address space, they won't be able to communicate. A client and a server both on
192.168.1.0/24 subnets (for example), but not the same subnet, rather the same numbers on two different private networks connected over the public network, won't work. They'll try to use their private addresses instead of their public addresses.
If the client and the server are actually on the same private network, then they can communicate either directly if they're on the same subnet, due to that same logic. If they're on different subnets of the same private network, they can communicate if their NAT device supports hairpin NAT, i.e, the NAT device relays the packets back and forth between two devices, both on its private network.
Also, if the user hasn't given permission to use the microphone, then it's likely that private IPv4 addresses will be suppressed in favor of mDNS ".local" domain names. This works best if the client, the server, and the mDNS server are all on the same subnet, since mDNS is a link local protocol. I've found a mdns-repeater that relays mDNS traffic between subnets, but this requires configuration, so mDNS is not totally reliable on more complicated private networks.
IPv6 clients have other issues. Web browsers are filtering out auto-configured IPv6 addresses (Stateless Address Auto-configuration, SLAAC) that expose MAC addresses embedded in the IPv6 addresses. This is the old way of doing SLAAC (RFC 4291). The new way (RFC 7217) obfuscates the MAC address, but the old way is still the default on Linux unless you specify "ipv6-address-generation: stable-privacy" in your netplan configuration, and I think you also need "renderer: NetworkManager" for that to work.
Based on all that, I'm proposing that we vary our address selection logic based on the source address of the client. Specifically,
- connections from private IPv4 addresses get the server's private IPv4 address and fall back on public IPv4 addresses (hoping for hairpin NAT)
- connections from public IPv4 addresses get the server's public IPv4 address and fall back on private IPv4 addresses (hoping for a miracle)
- connections from IPv6 addresses get the server's IPv6 address and fall back on public IPv4 addresses (there's no way to know if an IPv6 client shares a private IPv4 network with the server)
Maybe the IPv4 addresses should also fall back on IPv6 addresses.
I've gotten FreeSWITCH working by having it listen on different ports for different types of addresses (5066 for public addresses; 5068 for private addresses; 5070 for IPv6 addresses, and another set of ports 7443/7445/7447 for wss instead of ws), then having nginx route to these different ports depending on where the connection came in from.
I've figured out enough of bbb-webrtc-sfu to understand that we could either do it that way (have bbb-webrtc-sfu listen on different ports), or add an extra HTTP header (probably X-Forwarded-For) and let bbb-webrtc-sfu announce different IP addresses depending on what kind of address the connection came in on.
An extra HTTP header would probably be more in the spirit of how bbb-webrtc-sfu is written, since it already uses extra headers to get authentication data.
Any comments?
agape
brent