mdnsd has a bugin the code to retrieve interfaces under linux that (on my machine) makes it miss all the normal interfaces, and bind to lo as a failsafe. Needless to say, only being able to see the mdns entries from my own machine is not useful :) It turns out the problem is the call to SIOCGIFCONF. The issue is that the structure filled out by this call is larger on 64 bit machines than on 32 bit machines. It is in fact larger than a struct sockaddr, so when processing the list of interfaces, the current code doesn't advance far enough, and you end up with a corrupted list. Attached is a patch which fixes this behaviour. I'm afraid I do not know if this is portable beyond linux. There is another report about this very issue here: https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=113637 Here is my patch to fix the problem: diff -Naur mDNSResponder-98.orig/mDNSPosix/mDNSUNP.c mDNSResponder-98/mDNSPosix/mDNSUNP.c --- mDNSResponder-98.orig/mDNSPosix/mDNSUNP.c 2004-12-01 04:25:05.000000000 +0000 +++ mDNSResponder-98/mDNSPosix/mDNSUNP.c 2005-04-01 00:03:01.000000000 +0100 @@ -190,8 +190,7 @@ for (ptr = buf; ptr < buf + ifc.ifc_len; ) { ifr = (struct ifreq *) ptr; - len = GET_SA_LEN(ifr->ifr_addr); - ptr += sizeof(ifr->ifr_name) + len; /* for next one in buffer */ + ptr += sizeof(struct ifreq); /* for next one in buffer */ // fprintf(stderr, "intf %d name=%s AF=%d\n", index, ifr->ifr_name, ifr->ifr_addr.sa_family); Reproducible: Always Steps to Reproduce: 1. 2. 3.
Thanks for the patch. Did you submit it to Apple?
Yeah - they say they're going to add it and see if it breaks anything.
upstream bug.