From 732a90b2903efb539c2bbf11a545cfe7314e689c Mon Sep 17 00:00:00 2001 From: Ted Lemon Date: Sun, 8 Jun 1997 04:05:21 +0000 Subject: [PATCH] Make it a warning rather than an error if resolv.conf is missing. --- CHANGES | 2 ++ common/dns.c | 8 ++++- common/resolv.c | 15 +++++--- server/dhcpd.cat8 | 90 +++++++++++++++++++++++------------------------ 4 files changed, 64 insertions(+), 51 deletions(-) diff --git a/CHANGES b/CHANGES index 6973d7c7..f99203db 100644 --- a/CHANGES +++ b/CHANGES @@ -16,6 +16,8 @@ address and the lease corresponding to that address is available to that client. +- Make it a warning rather than an error if resolv.conf is missing. + 970605 - Add client-hostname token to lexer so that the parser can use it. diff --git a/common/dns.c b/common/dns.c index 06442d7f..a56679bc 100644 --- a/common/dns.c +++ b/common/dns.c @@ -48,7 +48,7 @@ #ifndef lint static char copyright[] = -"$Id: dns.c,v 1.3 1997/05/09 08:02:33 mellon Exp $ Copyright (c) 1997 The Internet Software Consortium. All rights reserved.\n"; +"$Id: dns.c,v 1.4 1997/06/08 04:05:20 mellon Exp $ Copyright (c) 1997 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -198,6 +198,9 @@ static int nslookup (id, qname, namelen, qtype, qclass) int i, status; struct sockaddr_in *server = pick_name_server (); + if (!server) + return 0; + /* Construct a header... */ hdr = (HEADER *)query; memset (hdr, 0, sizeof *hdr); @@ -255,6 +258,9 @@ static int zonelookup (id, qname, namelen, qclass) int i, status, count; struct sockaddr_in *server = pick_name_server (); + if (!server) + return 0; + /* Construct a header... */ hdr = (HEADER *)query; memset (hdr, 0, sizeof *hdr); diff --git a/common/resolv.c b/common/resolv.c index c0a0147f..7aa99d1d 100644 --- a/common/resolv.c +++ b/common/resolv.c @@ -42,7 +42,7 @@ #ifndef lint static char copyright[] = -"$Id: resolv.c,v 1.3 1997/06/03 00:47:40 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; +"$Id: resolv.c,v 1.4 1997/06/08 04:05:20 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -66,8 +66,11 @@ void read_resolv_conf (parse_time) new_parse (path_resolv_conf); eol_token = 1; - if ((cfile = fopen (path_resolv_conf, "r")) == NULL) - error ("Can't open %s: %m", path_resolv_conf); + if ((cfile = fopen (path_resolv_conf, "r")) == NULL) { + warn ("Can't open %s: %m", path_resolv_conf); + return; + } + do { token = next_token (&val, cfile); if (token == EOF) @@ -184,8 +187,10 @@ struct sockaddr_in *pick_name_server () /* Check /etc/resolv.conf and reload it if it's changed. */ if (cur_time > rcdate) { - if (stat (path_resolv_conf, &st) < 0) - error ("Can't stat %s", path_resolv_conf); + if (stat (path_resolv_conf, &st) < 0) { + warn ("Can't stat %s", path_resolv_conf); + return (struct sockaddr_in *)0; + } if (st.st_mtime > rcdate) { char rcbuf [512]; char *s, *t, *u; diff --git a/server/dhcpd.cat8 b/server/dhcpd.cat8 index f6adf2ae..735b4d15 100644 --- a/server/dhcpd.cat8 +++ b/server/dhcpd.cat8 @@ -98,6 +98,16 @@ dhcpd(8) dhcpd(8) database, dhcpd does not automatically restart itself when it sees a change to the dhcpd.conf file. + Note: We get a lot of complaints about this. We realize + that it would be nice if one could send a SIGHUP to the + server and have it reload the database. This is not + technically impossible, but it would require a great deal + of work, our resources are extremely limited, and they can + be better spent elsewhere. So please don't complain + about this on the mailing list unless you're prepared to + fund a project to implement this feature, or prepared to + do it yourself. + CCOOMMMMAANNDD LLIINNEE The names of the network interfaces on which dhcpd should listen for broadcasts may be specified on the command @@ -114,16 +124,6 @@ CCOOMMMMAANNDD LLIINNEE the udp port number on which dhcpd should listen. This is mostly useful for debugging purposes. - To run dhcpd as a foreground process, rather than allowing - it to run as a daemon in the background, the --ff flag - should be specified. This is useful when running dhcpd - under a debugger, or when running it out of inittab on - System V systems. - - To have dhcpd log to the standard error descriptor, spec- - ify the --dd flag. This can be useful for debugging, and - also at sites where a complete log of all dhcp activity - must be kept but syslogd is not reliable or otherwise @@ -136,8 +136,18 @@ CCOOMMMMAANNDD LLIINNEE dhcpd(8) dhcpd(8) - cannot be used. Normally, dhcpd will log all output - using the syslog(3) function with the log facility set to + To run dhcpd as a foreground process, rather than allowing + it to run as a daemon in the background, the --ff flag + should be specified. This is useful when running dhcpd + under a debugger, or when running it out of inittab on + System V systems. + + To have dhcpd log to the standard error descriptor, spec- + ify the --dd flag. This can be useful for debugging, and + also at sites where a complete log of all dhcp activity + must be kept but syslogd is not reliable or otherwise can- + not be used. Normally, dhcpd will log all output using + the syslog(3) function with the log facility set to LOG_DAEMON. Dhcpd can be made to use an alternate configuration file @@ -179,17 +189,7 @@ SSuubbnneettss left out entirely, but the subnet statement must appear. -LLeeaassee LLeennggtthhss - DHCP leases can be assigned almost any length from zero - seconds to infinity. What lease length makes sense for - any given subnet, or for any given installation, will vary - depending on the kinds of hosts being served. - For example, in an office environment where systems are - added from time to time and removed from time to time, but - move relatively infrequently, it might make sense to allow - lease times of a month of more. In a final test environ- - ment on a manufacturing floor, it may make more sense to @@ -202,6 +202,17 @@ LLeeaassee LLeennggtthhss dhcpd(8) dhcpd(8) +LLeeaassee LLeennggtthhss + DHCP leases can be assigned almost any length from zero + seconds to infinity. What lease length makes sense for + any given subnet, or for any given installation, will vary + depending on the kinds of hosts being served. + + For example, in an office environment where systems are + added from time to time and removed from time to time, but + move relatively infrequently, it might make sense to allow + lease times of a month of more. In a final test environ- + ment on a manufacturing floor, it may make more sense to assign a maximum lease length of 30 minutes - enough time to go through a simple test procedure on a network appli- ance before packaging it up for delivery. @@ -244,18 +255,7 @@ BBOOOOTTPP SSuuppppoorrtt filename "/tftpboot/haagen.boot"; } -OOppttiioonnss - DHCP (and also BOOTP with Vendor Extensions) provide a - mechanism whereby the server can provide the client with - information about how to configure its network interface - (e.g., subnet mask), and also how the client can access - various network services (e.g., DNS, IP routers, and so - on). - These options can be specified on a per-subnet basis, and, - for BOOTP clients, also on a per-client basis. In the - event that a BOOTP client declaration specifies options - that are also specified in its subnet declaration, the @@ -268,6 +268,18 @@ OOppttiioonnss dhcpd(8) dhcpd(8) +OOppttiioonnss + DHCP (and also BOOTP with Vendor Extensions) provide a + mechanism whereby the server can provide the client with + information about how to configure its network interface + (e.g., subnet mask), and also how the client can access + various network services (e.g., DNS, IP routers, and so + on). + + These options can be specified on a per-subnet basis, and, + for BOOTP clients, also on a per-client basis. In the + event that a BOOTP client declaration specifies options + that are also specified in its subnet declaration, the options specified in the client declaration take prece- dence. An reasonably complete DHCP configuration might look something like this: @@ -313,18 +325,6 @@ AAUUTTHHOORR - - - - - - - - - - - - 5