diff options
author | dm <> | 1996-02-19 19:53:30 +0000 |
---|---|---|
committer | dm <> | 1996-02-19 19:53:30 +0000 |
commit | 543eeae2382e5de0b9518bdd9f7a75e5686fd056 (patch) | |
tree | 094165ba891a348ad41b10f58ccb57f1a01f8e74 /src/lib/libc/net/res_init.c | |
parent | 4a12c1341f3a7e10bd98cebfe52fc96867f82baf (diff) | |
download | openbsd-543eeae2382e5de0b9518bdd9f7a75e5686fd056.tar.gz openbsd-543eeae2382e5de0b9518bdd9f7a75e5686fd056.tar.bz2 openbsd-543eeae2382e5de0b9518bdd9f7a75e5686fd056.zip |
netbsd: bind 4.9.3
Diffstat (limited to 'src/lib/libc/net/res_init.c')
-rw-r--r-- | src/lib/libc/net/res_init.c | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/src/lib/libc/net/res_init.c b/src/lib/libc/net/res_init.c index 33cc8d39f1..ff8e1b1e5e 100644 --- a/src/lib/libc/net/res_init.c +++ b/src/lib/libc/net/res_init.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $NetBSD: res_init.c,v 1.8 1995/06/03 22:33:36 mycroft Exp $ */ | 1 | /* $NetBSD: res_init.c,v 1.9 1996/02/02 15:22:30 mrg Exp $ */ |
2 | 2 | ||
3 | /*- | 3 | /*- |
4 | * Copyright (c) 1985, 1989, 1993 | 4 | * Copyright (c) 1985, 1989, 1993 |
@@ -56,9 +56,9 @@ | |||
56 | #if defined(LIBC_SCCS) && !defined(lint) | 56 | #if defined(LIBC_SCCS) && !defined(lint) |
57 | #if 0 | 57 | #if 0 |
58 | static char sccsid[] = "@(#)res_init.c 8.1 (Berkeley) 6/7/93"; | 58 | static char sccsid[] = "@(#)res_init.c 8.1 (Berkeley) 6/7/93"; |
59 | static char rcsid[] = "$Id: res_init.c,v 4.9.1.1 1993/05/02 22:43:03 vixie Rel "; | 59 | static char rcsid[] = "$Id: res_init.c,v 8.3 1995/06/29 09:26:28 vixie Exp "; |
60 | #else | 60 | #else |
61 | static char rcsid[] = "$NetBSD: res_init.c,v 1.8 1995/06/03 22:33:36 mycroft Exp $"; | 61 | static char rcsid[] = "$NetBSD: res_init.c,v 1.9 1996/02/02 15:22:30 mrg Exp $"; |
62 | #endif | 62 | #endif |
63 | #endif /* LIBC_SCCS and not lint */ | 63 | #endif /* LIBC_SCCS and not lint */ |
64 | 64 | ||
@@ -92,11 +92,23 @@ struct __res_state _res = { | |||
92 | * there will have precedence. Otherwise, the server address is set to | 92 | * there will have precedence. Otherwise, the server address is set to |
93 | * INADDR_ANY and the default domain name comes from the gethostname(). | 93 | * INADDR_ANY and the default domain name comes from the gethostname(). |
94 | * | 94 | * |
95 | * The configuration file should only be used if you want to redefine your | 95 | * An interrim version of this code (BIND 4.9, pre-4.4BSD) used 127.0.0.1 |
96 | * domain or run without a server on your machine. | 96 | * rather than INADDR_ANY ("0.0.0.0") as the default name server address |
97 | * since it was noted that INADDR_ANY actually meant ``the first interface | ||
98 | * you "ifconfig"'d at boot time'' and if this was a SLIP or PPP interface, | ||
99 | * it had to be "up" in order for you to reach your own name server. It | ||
100 | * was later decided that since the recommended practice is to always | ||
101 | * install local static routes through 127.0.0.1 for all your network | ||
102 | * interfaces, that we could solve this problem without a code change. | ||
103 | * | ||
104 | * The configuration file should always be used, since it is the only way | ||
105 | * to specify a default domain. If you are running a server on your local | ||
106 | * machine, you should say "nameserver 0.0.0.0" or "nameserver 127.0.0.1" | ||
107 | * in the configuration file. | ||
97 | * | 108 | * |
98 | * Return 0 if completes successfully, -1 on error | 109 | * Return 0 if completes successfully, -1 on error |
99 | */ | 110 | */ |
111 | int | ||
100 | res_init() | 112 | res_init() |
101 | { | 113 | { |
102 | register FILE *fp; | 114 | register FILE *fp; |
@@ -107,6 +119,7 @@ res_init() | |||
107 | int haveenv = 0; | 119 | int haveenv = 0; |
108 | int havesearch = 0; | 120 | int havesearch = 0; |
109 | int nsort = 0; | 121 | int nsort = 0; |
122 | int dots; | ||
110 | u_long mask; | 123 | u_long mask; |
111 | 124 | ||
112 | _res.nsaddr.sin_len = sizeof(struct sockaddr_in); | 125 | _res.nsaddr.sin_len = sizeof(struct sockaddr_in); |
@@ -392,3 +405,12 @@ net_mask(in) /* XXX - should really use system's version of this */ | |||
392 | return (htonl(IN_CLASSB_NET)); | 405 | return (htonl(IN_CLASSB_NET)); |
393 | return (htonl(IN_CLASSC_NET)); | 406 | return (htonl(IN_CLASSC_NET)); |
394 | } | 407 | } |
408 | |||
409 | u_int16_t | ||
410 | res_randomid() | ||
411 | { | ||
412 | struct timeval now; | ||
413 | |||
414 | gettimeofday(&now, NULL); | ||
415 | return (0xffff & (now.tv_sec ^ now.tv_usec ^ getpid())); | ||
416 | } | ||