Hello,
I am currently working on Rendezvous extension for KDE (mainly Linux, also
BSD) with Apple's mDNSResponder as its foundation. Multicast DNS part is
already working well with one exception: resolving hostnames containing
non-latin1 characters with nss_mdns. Reason: all IDN-aware applications send
ACE-encoded queries (see RFC 3490) to resolver. It has to decode them into
UTF-8 before resolving.
Unicast (wide area) DNS-SD is much worse because Posix daemon is severely
limited compared to MacOSX version:
1) it doesn't read list of unicast DNS servers - because of this whole
uDNS-based service discovery is inactive. Attached patch adds this
functionality - it reads dns-sd.resolv.conf (format matching resolv.conf)
and sets server list. SIGHUP causes daemon to reread configuration file
(important for GUI-based configurator). Simpler version of this patch was
posted here earlier, but it haven't got any responses or comments.
2) it doesn't read list of zones and keys for DynDNS updates. This seems easy
to fix by just copying (with minor fixes) relevant functions from MacOSX
daemon.
3) how you can set default browsing domains? on MacOSX it is read from system
configuration. In Posix daemon it probably should be read from config file.
4) IDN problems again. You cannot just send UTF-8 encoded domain names to DNS
server. It has to be encoded according to RFC 3490.
I would be grateful for information if and how are you going to fix these
issues. Or if enhancing Posix daemon is not a priority will you accept
patches for it?
Thanks in advance.
diff -urd mDNSResponder/mDNSPosix/PosixDaemon.c mDNSResponder-mod/mDNSPosix/PosixDaemon.c
--- mDNSResponder/mDNSPosix/PosixDaemon.c 2004-09-21 23:05:12.000000000 +0200
+++ mDNSResponder-mod/mDNSPosix/PosixDaemon.c 2004-11-15 18:00:12.000000000 +0100
@@ -89,6 +89,7 @@
#include <unistd.h>
#include <stdlib.h>
#include <signal.h>
+#include <arpa/inet.h>
#include <errno.h>
#include <fcntl.h>
#include <pwd.h>
@@ -102,9 +103,10 @@
static void ParseCmdLinArgs( int argc, char **argv);
static void DumpStateLog( mDNS *m);
+static void Reconfigure( mDNS *m);
static mStatus MainLoop( mDNS *m);
-
+#define uDNS_SERVERS_FILE "/etc/dns-sd.resolv.conf"
#define RR_CACHE_SIZE 500
static CacheRecord gRRCache[RR_CACHE_SIZE];
@@ -126,6 +128,8 @@
if ( mStatus_NoError == err)
err = udsserver_init();
+
+ Reconfigure( &mDNSRecord);
// Now that we're finished with anything privileged, switch over to running as "nobody"
if ( mStatus_NoError == err)
@@ -235,6 +239,38 @@
}
}
+static int ParseDNSServers( mDNS *m, const char *filePath)
+{
+ char line[256];
+ char nameserver[16];
+ char keyword[10];
+ int numOfServers = 0;
+ FILE * fp = fopen(filePath, "r");
+
+ if (fp == NULL) {
+ return -1;
+ }
+ while (fgets(line,sizeof(line),fp)) {
+ mDNSv4Addr DNSAddr;
+ line[255]='\0'; // just to be safe
+ if (sscanf(line,"%10s %15s",keyword,nameserver) != 2) { // it will skip whitespaces
+ continue;
+ }
+ if (strncmp(keyword,"nameserver",10)) continue;
+ if (inet_aton(nameserver,&DNSAddr) != 0) {
+ mDNS_RegisterDNS(m,&DNSAddr);
+ numOfServers++;
+ }
+ }
+ return (numOfServers > 0) ? 0 : -1;
+}
+
+static void Reconfigure( mDNS *m)
+{
+ mDNS_DeregisterDNSList(m);
+ if (ParseDNSServers( m, uDNS_SERVERS_FILE) < 0)
+ LogMsg("Unable to parse DNS server list. Unicast DNS-SD unavailable");
+}
static void DumpStateLog(mDNS *const m)
// Dump a little log of what we've been up to.
@@ -254,6 +290,7 @@
mDNSPosixListenForSignalInEventLoop( SIGTERM);
mDNSPosixListenForSignalInEventLoop( SIGUSR1);
mDNSPosixListenForSignalInEventLoop( SIGPIPE);
+ mDNSPosixListenForSignalInEventLoop( SIGHUP) ;
for ( ; ;)
{
@@ -279,6 +316,8 @@
(void) mDNSPosixRunEventLoopOnce( m, &timeout, &signals, &gotData);
+ if ( sigismember( &signals, SIGHUP))
+ Reconfigure( m);
if ( sigismember( &signals, SIGUSR1))
DumpStateLog( m);
if ( sigismember( &signals, SIGPIPE)) // happens when we try to write to a dead client; death should be detected soon in request_callback() and cleaned up.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Rendezvous-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/rendezvous-dev/email@hidden
This email sent to email@hidden