homebridge / ciao

RFC 6762 and RFC 6763 compliant mdns service discovery library written in Typescript
MIT License
79 stars 6 forks source link

MacOS socket with MDNS group membership added is unable to receive MDNS multicast packets #35

Closed amydevs closed 8 months ago

amydevs commented 11 months ago

Analysis

The sockets on MacOS bound by Ciao not able to receive incoming multicast packets despite having addMembership called. Despite this, these sockets are still able to receive the multicast packets sent on the same interface with IP_MULTICAST_LOOP enabled.

This behavior is not exhibited with Linux hosts.

The MacOS system dns-sd command is able to find registered services from Ciao. This means that the only explanation that Avahi stack on a separate Linux host not finding the Ciao registered service is that the the socket.addMembership is silently failing, or that are passing it incorrect parameters on MacOS specifically.

Expected Behavior

Incoming multicast packets should be correctly received by the the multicast sockets bound by MDNS.

Steps To Reproduce

  1. Run the following example code on a MacOS Host
    
    import ciao, { Protocol } from './src';

const responder = ciao.getResponder();

// create a service defining a web server running on port 3000 responder.createService({ name: 'My Web Server', type: 'http', port: 3000, // optional, can also be set via updatePort() before advertising txt: { // optional key: "value", } })

// it must not be advertised, so that a query packet sent by Avahi on another host must be sent to trigger a response packet by Ciao

2. Run `avahi-browse -d local _http._tcp --resolve -t` on a separate Linux host.
3. Expect `enp0s31f6 IPv4 My Web Server                _http._tcp           local` to be an entry.

### Logs

```markdown
No logs emitted from Ciao or Avahi.

Configuration

No Configuration.

Environment

MacOS Host: Macmini9,1

Process Supervisor

not applicable

Additional Context

I was developing my own JS MDNS responder when I came across this behavior. I've written an issue about it here:

https://github.com/MatrixAI/js-mdns/issues/29

Bartel-C8 commented 11 months ago

Which ethernet dongle are you using?

Can you try if it's fixed when you start Wireshark on that interface in promiscuous mode? I have similar problems (with other multicast traffic) with an AX88178A dongle...

github-actions[bot] commented 10 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Bartel-C8 commented 10 months ago

If it's an AX88179A based dongle (you can find this info in the System Info, under the Apple logo), ping me. I contacted ASIX for this, and they have an updated FW for the dongles, which fixes my multicast issue on macOS!

github-actions[bot] commented 9 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] commented 8 months ago

This issue has been closed as no further activity has occurred.