Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 87734 - mdnsresponder always binds to the loopback interface
Summary: mdnsresponder always binds to the loopback interface
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Server (show other bugs)
Hardware: AMD64 Linux
: High normal (vote)
Assignee: Gentoo KDE team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-02 18:01 UTC by Andrew de Quincey
Modified: 2005-07-14 10:14 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew de Quincey 2005-04-02 18:01:22 UTC
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.
Comment 1 Gregorio Guidi (RETIRED) gentoo-dev 2005-04-13 06:53:07 UTC
Thanks for the patch. Did you submit it to Apple?
Comment 2 Andrew de Quincey 2005-04-13 06:56:24 UTC
Yeah - they say they're going to add it and see if it breaks anything.
Comment 3 Caleb Tennis (RETIRED) gentoo-dev 2005-07-14 10:14:07 UTC
upstream bug.