Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests failing on OS X #2

Closed
richtr opened this issue May 21, 2014 · 6 comments
Closed

Tests failing on OS X #2

richtr opened this issue May 21, 2014 · 6 comments

Comments

@richtr
Copy link
Contributor

richtr commented May 21, 2014

Hi,

I'm unable to both lookup or register new mDNS services on my local network. Running go test *.go in the root folder of this package consistently outputs the following:

2014/05/21 15:47:48 [ERR] mdns: Failed to start IPv6 listener: listen udp6 ff02::fb: setsockopt: can't assign requested address
2014/05/21 15:47:48 [ERR] mdns: Failed to start IPv6 listener: listen udp6 ff02::fb: setsockopt: can't assign requested address
--- FAIL: TestServer_Lookup (0.05 seconds)
server_test.go:63: record not found
FAIL
FAIL    command-line-arguments  0.067s

I'm running OS X 10.9.2 and Go version 1.2 (darwin/amd64).

Any ideas on why the tests would be failing on my setup?

@armon
Copy link
Member

armon commented May 21, 2014

Looks like you are getting an IPv6 binding error. Do you have an IPv6 address available?

@richtr
Copy link
Contributor Author

richtr commented May 21, 2014

I have an IPv6 address available on my interface. Actually, if I (temporarily) remove all IPv6 references in the library code I still get:

--- FAIL: TestServer_Lookup (0.05 seconds)
server_test.go:63: record not found
FAIL
FAIL    command-line-arguments  0.068s

Is there anything else that could be causing this issue?

@armon
Copy link
Member

armon commented May 21, 2014

Can you dump ifconfig? Maybe multicast is disabled?

@richtr
Copy link
Contributor Author

richtr commented May 21, 2014

Here is my full ifconfig:

lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
    options=3<RXCSUM,TXCSUM>
    inet6 ::1 prefixlen 128 
    inet 127.0.0.1 netmask 0xff000000 
    inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1 
    nd6 options=1<PERFORMNUD>
gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280
stf0: flags=0<> mtu 1280
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    options=b<RXCSUM,TXCSUM,VLAN_HWTAGGING>
    ether c4:2c:03:3d:06:09 
    nd6 options=1<PERFORMNUD>
    media: autoselect (none)
    status: inactive
en1: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    ether 78:ca:39:b4:42:c1 
    inet6 fe80::7aca:39ff:feb4:42c1%en1 prefixlen 64 scopeid 0x5 
    inet 192.168.0.14 netmask 0xffffff00 broadcast 192.168.0.255
    nd6 options=1<PERFORMNUD>
    media: autoselect
    status: active
fw0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 4078
    lladdr 78:ca:39:ff:fe:0b:f2:06 
    nd6 options=1<PERFORMNUD>
    media: autoselect <full-duplex>
    status: inactive
p2p0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 2304
    ether 0a:ca:39:b4:42:c1 
    media: autoselect
    status: inactive
utun0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1380
    inet6 fe80::7937:1221:1f28:5b3%utun0 prefixlen 64 scopeid 0x8 
    inet6 fda5:8b64:8f3a:20d7:7937:1221:1f28:5b3 prefixlen 64 
    nd6 options=1<PERFORMNUD>

Thanks for your help!

FWIW, I am hoping to replace my project's discovery code with your lib to remove the dependency I currently have on cgo so I can cross-compile this project. All help is appreciated so thanks for looking in to this :)

@richtr
Copy link
Contributor Author

richtr commented May 21, 2014

After much debugging it seems the problem is related to the OS X Firewall being on.

When the Firewall is turned off the tests pass as expected.

When the Firewall is turned on and unsigned programs are run they trigger an OSX Firewall warning. The program is hitting the relatively short timeouts before the user gets a chance to click 'Allow' on the Firewall Warning Dialog that pops up and thus the program times out. There seems to be no way to allow a go program permanent access through the OSX Firewall if it is not signed.

As a workaround for when the Firewall is turned on, it seems changing the mDNS timeouts included at server_test.go:L47 and server_test.go:L55 to e.g. 10 * time.Second gives the user enough time to click 'Allow' on the Firewall Warning Dialog, thus allowing the tests to pass without tripping up the library's timeout behaviour.

@armon
Copy link
Member

armon commented May 21, 2014

Huh, glad you were able to resolve it! I'm going to close this then, since it's an issue with the firewall and not the lib. Reopen if you have issues!

@armon armon closed this as completed May 21, 2014
@richtr richtr changed the title Tests failing Tests failing on OS X May 21, 2014
gonzojive pushed a commit to gonzojive/mdns that referenced this issue Feb 20, 2017
Clean up probe goroutine when shutting down
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants