Created attachment 169123 [details]
Patch to fix interface binding & error messages on FreeBSD.
The net/mdns-repeater port is supposed to read one mDNS multicast packet from one interface, and forward it to one or more interfaces.
On FreeBSD it does not properly bind each sending socket to their corresponding interface, instead it just sends to multi-cast IP 244.0.0.251, which is emitted on the interface found via the default route (at least that was the case here). In my case this was my internet interface, resulting in all packets getting blocked by my firewall (and not sent at all to the proper interfaces).
Not sure if this have ever worked on a multi-homed machine, but perhaps all the users have wanted it to forward to the interface with the default route, and assumed it was fine.
The existing code solves this with the Linux-specific SO_BINDTODEVICE opt, if it exists. It doesn't on FreeBSD.
The attached patch fixes this by using the IP_MULTICAST_IF socket option instead.
The patch also replaces the use of GNU-specific %m formatter (expands to strerror(errno)). While this works on FreeBSD syslog(3), it does not work on FreeBSD printf(3).
Patch built with make makepatch.
A commit references this bug:
Date: Sun Apr 10 23:10:50 UTC 2016
New revision: 412989
Fix interface binding & error messages.
Submitted by: johan
Thank you very much for this fine patch. I've just committed it.