diff options
author | Can Erkin Acar <canacar@cvs.openbsd.org> | 2004-10-31 10:43:39 +0000 |
---|---|---|
committer | Can Erkin Acar <canacar@cvs.openbsd.org> | 2004-10-31 10:43:39 +0000 |
commit | 2f0ab5c8cdd215d2ef0b0b640f98a7a14e9c6c8b (patch) | |
tree | 5c14b77796d5d45d14c1ab3faa6fbaafecf2c9fe | |
parent | b6df28ae4735bb0abff7d6e1fd3791778a2f9cf7 (diff) |
change the undocumented -t flag to -n used for configuration testing
and document it. cleanup some unused/unneeded variables while there.
idea & ok henning@
-rw-r--r-- | usr.sbin/dhcpd/dhcpd.8 | 7 | ||||
-rw-r--r-- | usr.sbin/dhcpd/dhcpd.c | 24 | ||||
-rw-r--r-- | usr.sbin/dhcpd/dhcpd.h | 3 | ||||
-rw-r--r-- | usr.sbin/dhcpd/dispatch.c | 4 |
4 files changed, 16 insertions, 22 deletions
diff --git a/usr.sbin/dhcpd/dhcpd.8 b/usr.sbin/dhcpd/dhcpd.8 index 0dfa752dcb1..30c83f3ae6c 100644 --- a/usr.sbin/dhcpd/dhcpd.8 +++ b/usr.sbin/dhcpd/dhcpd.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: dhcpd.8,v 1.6 2004/08/23 19:38:20 pvalchev Exp $ +.\" $OpenBSD: dhcpd.8,v 1.7 2004/10/31 10:43:38 canacar Exp $ .\" .\" Copyright (c) 1995, 1996 The Internet Software Consortium. .\" All rights reserved. @@ -44,7 +44,7 @@ .Nd Dynamic Host Configuration Protocol Server .Sh SYNOPSIS .Nm dhcpd -.Op Fl df +.Op Fl dfn .Op Fl c Ar config-file .Op Fl l Ar lease-file .Op Ar if0 Op Ar ... ifN @@ -185,6 +185,9 @@ running in production, this option should be used .Em only for testing lease files in a non-production environment. +.It Fl n +Only test configuration, do not run +.Nm . .El .Sh CONFIGURATION The syntax of the diff --git a/usr.sbin/dhcpd/dhcpd.c b/usr.sbin/dhcpd/dhcpd.c index 548b17c9a4a..93371992098 100644 --- a/usr.sbin/dhcpd/dhcpd.c +++ b/usr.sbin/dhcpd/dhcpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dhcpd.c,v 1.21 2004/09/16 18:35:43 deraadt Exp $ */ +/* $OpenBSD: dhcpd.c,v 1.22 2004/10/31 10:43:38 canacar Exp $ */ /* * Copyright (c) 2004 Henning Brauer <henning@cvs.openbsd.org> @@ -51,14 +51,14 @@ u_int16_t server_port; u_int16_t client_port; int log_priority; -int log_perror = 1; +int log_perror = 0; char *path_dhcpd_conf = _PATH_DHCPD_CONF; char *path_dhcpd_db = _PATH_DHCPD_DB; int main(int argc, char *argv[]) { - int ch, cftest = 0, quiet = 0, daemonize = 1; + int ch, cftest = 0, daemonize = 1; struct passwd *pw; extern char *__progname; @@ -66,7 +66,7 @@ main(int argc, char *argv[]) openlog(__progname, LOG_NDELAY, DHCPD_LOG_FACILITY); setlogmask(LOG_UPTO(LOG_INFO)); - while ((ch = getopt(argc, argv, "c:dfl:tq")) != -1) + while ((ch = getopt(argc, argv, "c:dfl:nq")) != -1) switch (ch) { case 'c': path_dhcpd_conf = optarg; @@ -81,15 +81,13 @@ main(int argc, char *argv[]) case 'l': path_dhcpd_db = optarg; break; - case 'q': - quiet = 1; - quiet_interface_discovery = 1; - break; - case 't': + case 'n': daemonize = 0; cftest = 1; log_perror = -1; break; + case 'q': + break; default: usage(); } @@ -109,9 +107,6 @@ main(int argc, char *argv[]) argv++; } - if (quiet) - log_perror = 0; - /* Default DHCP/BOOTP ports. */ server_port = htons(SERVER_PORT); client_port = htons(CLIENT_PORT); @@ -132,7 +127,6 @@ main(int argc, char *argv[]) if ((pw = getpwnam("_dhcp")) == NULL) error("user \"_dhcp\" not found"); - log_perror = 0; if (daemonize) daemon(0, 0); @@ -158,9 +152,9 @@ usage(void) { extern char *__progname; - fprintf(stderr, "usage: %s [-df] [-c config-file] [-l lease-file]", + fprintf(stderr, "usage: %s [-dfn] [-c config-file] [-l lease-file]", __progname); - fprintf(stderr, " [-p port] [if0 [...ifN]]\n"); + fprintf(stderr, " [if0 [...ifN]]\n"); exit(1); } diff --git a/usr.sbin/dhcpd/dhcpd.h b/usr.sbin/dhcpd/dhcpd.h index 214ca4c8bcc..cbb904be9d3 100644 --- a/usr.sbin/dhcpd/dhcpd.h +++ b/usr.sbin/dhcpd/dhcpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: dhcpd.h,v 1.15 2004/09/16 18:35:43 deraadt Exp $ */ +/* $OpenBSD: dhcpd.h,v 1.16 2004/10/31 10:43:38 canacar Exp $ */ /* * Copyright (c) 1995, 1996, 1997, 1998, 1999 @@ -720,7 +720,6 @@ void maybe_setup_fallback(void); /* dispatch.c */ extern struct interface_info *interfaces; extern struct protocol *protocols; -extern int quiet_interface_discovery; extern void (*bootp_packet_handler)(struct interface_info *, struct dhcp_packet *, int, unsigned int, struct iaddr, struct hardware *); extern struct timeout *timeouts; diff --git a/usr.sbin/dhcpd/dispatch.c b/usr.sbin/dhcpd/dispatch.c index 669a593f5aa..ca70682a9d7 100644 --- a/usr.sbin/dhcpd/dispatch.c +++ b/usr.sbin/dhcpd/dispatch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dispatch.c,v 1.14 2004/09/21 04:07:04 david Exp $ */ +/* $OpenBSD: dispatch.c,v 1.15 2004/10/31 10:43:38 canacar Exp $ */ /* * Copyright (c) 1995, 1996, 1997, 1998, 1999 @@ -58,8 +58,6 @@ void (*bootp_packet_handler)(struct interface_info *, static int interface_status(struct interface_info *ifinfo); -int quiet_interface_discovery; - /* Use getifaddrs() to get a list of all the attached interfaces. For each interface that's of type INET and not the loopback interface, register that interface with the network I/O software, figure out what |