Azure/azure-relay-bridge

MacOS - Unable to use loopback addresses other than 127.0.0.1

neil-119 opened this issue · 4 comments

For some reason, I'm unable to use any address other than 127.0.0.1 on Macs. For example:

sudo ifconfig lo0 alias 127.0.0.2 up

When I debug the library, I am able to bind to this address, and in fact I even get a reply preamble in BridgeSocketConnectionAsync() in TcpLocalForwardBridge.cs with values [1, 0, 0]. The part where it fails is StreamPump.cs -- the source ReadAsync() on the stream returns zero bytes read after a minute and timing out, and this happens to both the hybrid connection stream and the tcp stream as source.

However, if I switch it back to 127.0.0.1, it gets back a positive value for the bytes read immediately and works fine.

@clemensv I noticed you wrote the original docs for Macs -- would you have any ideas?

Since 127.0.0.1 works, this sounds like a configuration issue in the Mac networking stack. I'm skeptical there's anything we can fix in this repo to make that work. Since you can bind to the address, setting up the alias has apparently worked, but the timeout with zero bytes read basically says that an existing connection broke.

I don't have a Mac myself at the moment to test/verify.

@clemensv Interestingly, we are able to bind to the alias IP from other applications fine (e.g. I can spin up an ASP.NET web API and bind it to that alias and serve requests through it fine). It only errors out with the Relay. Is there any possibility to get on a screen share session?

Works verifiably in the macOS test phase for the tests we run; calls https://github.com/Azure/azure-relay-bridge/blob/master/test/unit/macos_unblock_testip.sh beforehand