diff options
author | dm <dm@cvs.openbsd.org> | 1996-02-19 19:54:44 +0000 |
---|---|---|
committer | dm <dm@cvs.openbsd.org> | 1996-02-19 19:54:44 +0000 |
commit | 34dfcd3c571a64de57872aa758d1b228d7b22a02 (patch) | |
tree | 22b14dd50dff4fc41ec5c5f2ee3e20f4b7f1d141 /lib/libc/net/res_init.c | |
parent | d134390523f594c4e7f1b453b8026b993a1aeebb (diff) |
netbsd: bind 4.9.3
Diffstat (limited to 'lib/libc/net/res_init.c')
-rw-r--r-- | lib/libc/net/res_init.c | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/lib/libc/net/res_init.c b/lib/libc/net/res_init.c index 33cc8d39f1d..ff8e1b1e5e6 100644 --- a/lib/libc/net/res_init.c +++ b/lib/libc/net/res_init.c @@ -1,4 +1,4 @@ -/* $NetBSD: res_init.c,v 1.8 1995/06/03 22:33:36 mycroft Exp $ */ +/* $NetBSD: res_init.c,v 1.9 1996/02/02 15:22:30 mrg Exp $ */ /*- * Copyright (c) 1985, 1989, 1993 @@ -56,9 +56,9 @@ #if defined(LIBC_SCCS) && !defined(lint) #if 0 static char sccsid[] = "@(#)res_init.c 8.1 (Berkeley) 6/7/93"; -static char rcsid[] = "$Id: res_init.c,v 4.9.1.1 1993/05/02 22:43:03 vixie Rel "; +static char rcsid[] = "$Id: res_init.c,v 8.3 1995/06/29 09:26:28 vixie Exp "; #else -static char rcsid[] = "$NetBSD: res_init.c,v 1.8 1995/06/03 22:33:36 mycroft Exp $"; +static char rcsid[] = "$NetBSD: res_init.c,v 1.9 1996/02/02 15:22:30 mrg Exp $"; #endif #endif /* LIBC_SCCS and not lint */ @@ -92,11 +92,23 @@ struct __res_state _res = { * there will have precedence. Otherwise, the server address is set to * INADDR_ANY and the default domain name comes from the gethostname(). * - * The configuration file should only be used if you want to redefine your - * domain or run without a server on your machine. + * An interrim version of this code (BIND 4.9, pre-4.4BSD) used 127.0.0.1 + * rather than INADDR_ANY ("0.0.0.0") as the default name server address + * since it was noted that INADDR_ANY actually meant ``the first interface + * you "ifconfig"'d at boot time'' and if this was a SLIP or PPP interface, + * it had to be "up" in order for you to reach your own name server. It + * was later decided that since the recommended practice is to always + * install local static routes through 127.0.0.1 for all your network + * interfaces, that we could solve this problem without a code change. + * + * The configuration file should always be used, since it is the only way + * to specify a default domain. If you are running a server on your local + * machine, you should say "nameserver 0.0.0.0" or "nameserver 127.0.0.1" + * in the configuration file. * * Return 0 if completes successfully, -1 on error */ +int res_init() { register FILE *fp; @@ -107,6 +119,7 @@ res_init() int haveenv = 0; int havesearch = 0; int nsort = 0; + int dots; u_long mask; _res.nsaddr.sin_len = sizeof(struct sockaddr_in); @@ -392,3 +405,12 @@ net_mask(in) /* XXX - should really use system's version of this */ return (htonl(IN_CLASSB_NET)); return (htonl(IN_CLASSC_NET)); } + +u_int16_t +res_randomid() +{ + struct timeval now; + + gettimeofday(&now, NULL); + return (0xffff & (now.tv_sec ^ now.tv_usec ^ getpid())); +} |