summaryrefslogtreecommitdiff
path: root/source3/nmbd/nmbd.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1997-10-22 11:02:00 +0000
committerAndrew Tridgell <tridge@samba.org>1997-10-22 11:02:00 +0000
commite5c319186d079eeef55a7ee62fac2a993e932938 (patch)
treec8f01f398f801ecfa5a3a97ff5ca45ece501f459 /source3/nmbd/nmbd.c
parentbda8cac802414eb15122cc7ad2f0082bcca177d5 (diff)
downloadsamba-e5c319186d079eeef55a7ee62fac2a993e932938.tar.gz
samba-e5c319186d079eeef55a7ee62fac2a993e932938.tar.bz2
samba-e5c319186d079eeef55a7ee62fac2a993e932938.zip
Implemented asynchronous DNS lookups in nmbd.
I realised this afternoon just how easy it is to add this, so I thought I'd implement it while the idea was fresh. nmbd forks at startup and uses a pipe to talk to its child. The child does the DNS lookups and the file descriptor of the child is added to the main select loop. While I was doing this I discovered a bug in nmbd that explains why the dns proxy option has been so expensive. The DNS cache entries in the WINS list were never being checked, which means we always did a DNS lookup even if we have done it before and it is in cache. I'm sure this used to work (I tested the DNS cache when I added it) so someone broke it :-( Anyway, the async DNS gets rid of the problem completely. I'll commit just the fix to the DNS cache bug to the 1.9.17 tree. You can disable async DNS by adding -DSYNC_DNS to the compile flags. (This used to be commit 178e27de0791c1ff3268cb456ed5c5efc9ac2a01)
Diffstat (limited to 'source3/nmbd/nmbd.c')
-rw-r--r--source3/nmbd/nmbd.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c
index 047284832f..5feeb07c90 100644
--- a/source3/nmbd/nmbd.c
+++ b/source3/nmbd/nmbd.c
@@ -332,14 +332,6 @@ static void process(void)
****************************************************************************/
static BOOL open_sockets(BOOL isdaemon, int port)
{
- struct hostent *hp;
-
- /* get host info */
- if ((hp = Get_Hostbyname(myhostname)) == 0) {
- DEBUG(0,( "Get_Hostbyname: Unknown host. %s\n",myhostname));
- return False;
- }
-
/* The sockets opened here will be used to receive broadcast
packets *only*. Interface specific sockets are opened in
make_subnet() in namedbsubnet.c. Thus we bind to the
@@ -598,6 +590,10 @@ static void usage(char *pname)
become_daemon();
}
+#ifndef SYNC_DNS
+ start_async_dns();
+#endif
+
if (*pidFile)
{
int fd;
@@ -653,6 +649,7 @@ static void usage(char *pname)
/* We can only take sigterm signals in the select. */
BlockSignals(True,SIGTERM);
+
process();
close_sockets();