Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: OpenBSD mdnsd missing or delayed service discovery




found the problem, not related to select() but HAVE_BROKEN_RECVDSTADDR, which is still needed with OpenBSD 4.0 but requires a small patch to compile properly.


In addition, some packets made it out of recvfrom_flags() with sa_family not properly set in pktp (second last argument of that function). I most likely fixed this in the wrong place by pre-setting sa_family in pktp when zero'd for OpenBSD, but it looks like a safe place:


Index: mDNSUNP.c
===================================================================
--- mDNSUNP.c (revision 19)
+++ mDNSUNP.c (working copy)
@@ -600,7 +600,16 @@
set the value to 0, but I'm concerned that 0
might be a valid interface value.
*/
+
+#if HAVE_BROKEN_RECVDSTADDR
+ /* similar to the issue with OpenBSD in mDNSPosix.c, we need
+ to preset sin_family to IF_NET, because of broken IP_RECVDSTADDR
+ */
+ struct in_pktinfo *tmp;
+ struct sockaddr_in *sin = (struct sockaddr_in*)&pktp->ipi_addr;
memset(pktp, 0, sizeof(struct my_in_pktinfo));
+ sin->sin_family = AF_INET;
+#endif
pktp->ipi_ifindex = -1;
}
/* end recvfrom_flags1 */
Index: mDNSPosix.c
===================================================================
--- mDNSPosix.c (revision 19)
+++ mDNSPosix.c (working copy)
@@ -514,7 +514,7 @@
// so all we can do is just assume it's a multicast
#if HAVE_BROKEN_RECVDSTADDR || (!defined(IP_PKTINFO) && !defined(IP_RECVDSTADDR))
- if ( (destAddr.NotAnInteger == 0) && (flags & MSG_MCAST) )
+ if ( (destAddr.ip.v4.NotAnInteger == 0) && (flags & MSG_MCAST) )
{
destAddr.type = senderAddr.type;
if (senderAddr.type == mDNSAddrType_IPv4) destAddr.ip.v4 = AllDNSLinkGroupv4;





On Jan 14, 2007, at 7:00 PM, Marcel Wiget wrote:

Hi,

I'm writing a multi-threaded networking application using mDNSResponder-107.6 on OpenBSD 4.0 and have some intermittent problem with some service announcements not been reported (e.g. when using dns-sd -B). Same application works fine on OS/X Tiger and FreeBSD 4.1. It might be related to a problem with OpenBSD, as discovered with pcap (pcap_loop blocking threads) and related select (), see below.

I tested this on OpenBSD 3.8 and 4.0. Both OS have the same problem.

I did apply the patch recently shown on this mailing list about getting old/stale records delivered. That fix helped me with that problem.

Is this by any chance a known issue and is there a fix, ev in the CVS tree?

Thanks

Marcel

http://www.mail-archive.com/email@hidden/ msg02646.html

"Note that in some systems with BPF (older versions of {Free,Net,Open,Dragonfly}BSD, current versions of Mac OS X), select () (and poll()) don't work correctly on BPF devices, and so you have to work around that. (Note also that poll() doesn't work on *ANY* character special file, including BPF devices but also including ttys/ ptys, in OS X 10.4[.x], i.e. Tiger.)"




_______________________________________________ Do not post admin requests to the list. They will be ignored. Bonjour-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/bonjour-dev/email@hidden

This email sent to email@hidden
References: 
 >OpenBSD mdnsd missing or delayed service discovery (From: Marcel Wiget <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.