From 034aa896ced1e1cd36a0686da3bc39fe33a89c23 Mon Sep 17 00:00:00 2001 From: Ted Lemon Date: Sat, 22 Feb 1997 12:56:43 +0000 Subject: [PATCH] Moved to server/ --- bootp.c | 334 ------------- conflex.c | 521 -------------------- db.c | 212 -------- dhcp.c | 1158 ------------------------------------------- dhcpd.8 | 308 ------------ dhcpd.c | 267 ---------- dhcpd.conf | 128 ----- dhcpd.conf.5 | 1081 ---------------------------------------- dhcpd.conf.cat5 | 1254 ----------------------------------------------- 9 files changed, 5263 deletions(-) delete mode 100644 bootp.c delete mode 100644 conflex.c delete mode 100644 db.c delete mode 100644 dhcp.c delete mode 100644 dhcpd.8 delete mode 100644 dhcpd.c delete mode 100644 dhcpd.conf delete mode 100644 dhcpd.conf.5 delete mode 100644 dhcpd.conf.cat5 diff --git a/bootp.c b/bootp.c deleted file mode 100644 index 7564af4f..00000000 --- a/bootp.c +++ /dev/null @@ -1,334 +0,0 @@ -/* bootp.c - - BOOTP Protocol support. */ - -/* - * Copyright (c) 1995, 1996 The Internet Software Consortium. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of The Internet Software Consortium nor the names - * of its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND - * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This software has been written for the Internet Software Consortium - * by Ted Lemon in cooperation with Vixie - * Enterprises. To learn more about the Internet Software Consortium, - * see ``http://www.vix.com/isc''. To learn more about Vixie - * Enterprises, see ``http://www.vix.com''. - */ - -#ifndef lint -static char copyright[] = -"$Id: bootp.c,v 1.24 1997/02/22 08:36:36 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; -#endif /* not lint */ - -#include "dhcpd.h" - -void bootp (packet) - struct packet *packet; -{ - int result; - struct host_decl *hp; - struct host_decl *host = (struct host_decl *)0; - struct packet outgoing; - struct dhcp_packet raw; - struct sockaddr_in to; - struct in_addr from; - struct hardware hto; - struct tree_cache *options [256]; - struct subnet *subnet; - struct lease *lease; - struct iaddr ip_address; - int i; - - note ("BOOTREQUEST from %s via %s", - print_hw_addr (packet -> raw -> htype, - packet -> raw -> hlen, - packet -> raw -> chaddr), - packet -> raw -> giaddr.s_addr - ? inet_ntoa (packet -> raw -> giaddr) - : packet -> interface -> name); - - - - if (!locate_network (packet)) - return; - - hp = find_hosts_by_haddr (packet -> raw -> htype, - packet -> raw -> chaddr, - packet -> raw -> hlen); - - lease = find_lease (packet, packet -> shared_network); - - /* Find an IP address in the host_decl that matches the - specified network. */ - if (hp) - subnet = find_host_for_network (&hp, &ip_address, - packet -> shared_network); - else - subnet = (struct subnet *)0; - - if (!subnet) { - /* We didn't find an applicable host declaration. - Just in case we may be able to dynamically assign - an address, see if there's a host declaration - that doesn't have an ip address associated with it. */ - if (hp) { - for (; hp; hp = hp -> n_ipaddr) { - if (!hp -> fixed_addr) { - host = hp; - break; - } - } - } - - if (host && (!host -> group -> allow_booting)) { - note ("Ignoring excluded BOOTP client %s", - host -> name); - return; - } - - if (host && (!host -> group -> allow_bootp)) { - note ("Ignoring BOOTP request from client %s", - host -> name); - return; - } - - /* If we've been told not to boot unknown clients, - and we didn't find any host record for this client, - ignore it. */ - if (!host && !(packet -> shared_network -> - group -> boot_unknown_clients)) { - note ("Ignoring unknown BOOTP client %s via %s", - print_hw_addr (packet -> raw -> htype, - packet -> raw -> hlen, - packet -> raw -> chaddr), - packet -> raw -> giaddr.s_addr - ? inet_ntoa (packet -> raw -> giaddr) - : packet -> interface -> name); - return; - } - - /* If we've been told not to boot with bootp on this - network, ignore it. */ - if (!host && - !(packet -> shared_network -> group -> allow_bootp)) { - note ("Ignoring BOOTP request from client %s via %s", - print_hw_addr (packet -> raw -> htype, - packet -> raw -> hlen, - packet -> raw -> chaddr), - packet -> raw -> giaddr.s_addr - ? inet_ntoa (packet -> raw -> giaddr) - : packet -> interface -> name); - return; - } - - /* If the packet is from a host we don't know and there - are no dynamic bootp addresses on the network it came - in on, drop it on the floor. */ - if (!(packet -> shared_network -> group -> dynamic_bootp)) { - lose: - note ("No applicable record for BOOTP host %s via %s", - print_hw_addr (packet -> raw -> htype, - packet -> raw -> hlen, - packet -> raw -> chaddr), - packet -> raw -> giaddr.s_addr - ? inet_ntoa (packet -> raw -> giaddr) - : packet -> interface -> name); - return; - } - - /* If a lease has already been assigned to this client - and it's still okay to use dynamic bootp on - that lease, reassign it. */ - if (lease) { - /* If this lease can be used for dynamic bootp, - do so. */ - if ((lease -> flags & DYNAMIC_BOOTP_OK)) { - - /* If it's not a DYNAMIC_BOOTP lease, - release it before reassigning it - so that we don't get a lease - conflict. */ - if (!(lease -> flags & BOOTP_LEASE)) - release_lease (lease); - - lease -> host = host; - ack_lease (packet, lease, 0, 0); - return; - } - - /* If dynamic BOOTP is no longer allowed for - this lease, set it free. */ - release_lease (lease); - } - - /* If there are dynamic bootp addresses that might be - available, try to snag one. */ - for (lease = packet -> shared_network -> last_lease; - lease && lease -> ends <= cur_time; - lease = lease -> prev) { - if ((lease -> flags & DYNAMIC_BOOTP_OK)) { - lease -> host = host; - ack_lease (packet, lease, 0, 0); - return; - } - } - goto lose; - } - - /* Make sure we're allowed to boot this client. */ - if (hp && (!hp -> group -> allow_booting)) { - note ("Ignoring excluded BOOTP client %s", - hp -> name); - return; - } - - /* Make sure we're allowed to boot this client with bootp. */ - if (hp && (!hp -> group -> allow_bootp)) { - note ("Ignoring BOOTP request from client %s", - hp -> name); - return; - } - - /* Set up the outgoing packet... */ - memset (&outgoing, 0, sizeof outgoing); - memset (&raw, 0, sizeof raw); - outgoing.raw = &raw; - - /* Come up with a list of options that we want to send to this - client. Start with the per-subnet options, and then override - those with client-specific options. */ - - memcpy (options, subnet -> group -> options, sizeof options); - - for (i = 0; i < 256; i++) { - if (hp -> group -> options [i]) - options [i] = hp -> group -> options [i]; - } - - /* Pack the options into the buffer. Unlike DHCP, we can't - pack options into the filename and server name buffers. */ - - outgoing.packet_length = - cons_options (packet, outgoing.raw, options, 0, 0); - if (outgoing.packet_length < BOOTP_MIN_LEN) - outgoing.packet_length = BOOTP_MIN_LEN; - - /* Take the fields that we care about... */ - raw.op = BOOTREPLY; - raw.htype = packet -> raw -> htype; - raw.hlen = packet -> raw -> hlen; - memcpy (raw.chaddr, packet -> raw -> chaddr, raw.hlen); - memset (&raw.chaddr [raw.hlen], 0, - (sizeof raw.chaddr) - raw.hlen); - raw.hops = packet -> raw -> hops; - raw.xid = packet -> raw -> xid; - raw.secs = packet -> raw -> secs; - raw.flags = 0; - raw.ciaddr = packet -> raw -> ciaddr; - memcpy (&raw.yiaddr, ip_address.iabuf, sizeof raw.yiaddr); - - /* Figure out the address of the next server. */ - if (hp && hp -> group -> next_server.len) - memcpy (&raw.siaddr, hp -> group -> next_server.iabuf, 4); - else if (subnet -> group -> next_server.len) - memcpy (&raw.siaddr, subnet -> group -> next_server.iabuf, 4); - else if (subnet -> interface_address.len) - memcpy (&raw.siaddr, subnet -> interface_address.iabuf, 4); - else - raw.siaddr = packet -> interface -> primary_address; - - raw.giaddr = packet -> raw -> giaddr; - if (hp -> group -> server_name) { - strncpy (raw.sname, hp -> group -> server_name, - (sizeof raw.sname) - 1); - raw.sname [(sizeof raw.sname) - 1] = 0; - } - if (hp -> group -> filename) { - strncpy (raw.file, hp -> group -> filename, - (sizeof raw.file) - 1); - raw.file [(sizeof raw.file) - 1] = 0; - } - - /* Set up the hardware destination address... */ - hto.htype = packet -> raw -> htype; - hto.hlen = packet -> raw -> hlen; - memcpy (hto.haddr, packet -> raw -> chaddr, hto.hlen); - - from = packet -> interface -> primary_address; - - /* Report what we're doing... */ - note ("BOOTREPLY for %s to %s (%s) via %s", - piaddr (ip_address), hp -> name, - print_hw_addr (packet -> raw -> htype, - packet -> raw -> hlen, - packet -> raw -> chaddr), - packet -> raw -> giaddr.s_addr - ? inet_ntoa (packet -> raw -> giaddr) - : packet -> interface -> name); - - /* Set up the parts of the address that are in common. */ - to.sin_family = AF_INET; -#ifdef HAVE_SA_LEN - to.sin_len = sizeof to; -#endif - memset (to.sin_zero, 0, sizeof to.sin_zero); - - /* If this was gatewayed, send it back to the gateway... */ - if (raw.giaddr.s_addr) { - to.sin_addr = raw.giaddr; - to.sin_port = local_port; - -#ifdef USE_FALLBACK - result = send_fallback (&fallback_interface, - (struct packet *)0, - &raw, outgoing.packet_length, - from, &to, &hto); - if (result < 0) - warn ("send_fallback: %m"); - return; -#endif - /* Otherwise, broadcast it on the local network. */ - } else { - to.sin_addr.s_addr = INADDR_BROADCAST; - to.sin_port = remote_port; /* XXX */ - } - - errno = 0; - result = send_packet (packet -> interface, - packet, &raw, outgoing.packet_length, - from, &to, &hto); - if (result < 0) - warn ("send_packet: %m"); -} - -void relay (ip, packet, length) - struct interface_info *ip; - struct dhcp_packet *packet; - int length; -{ -} diff --git a/conflex.c b/conflex.c deleted file mode 100644 index a13f2660..00000000 --- a/conflex.c +++ /dev/null @@ -1,521 +0,0 @@ -/* conflex.c - - Lexical scanner for dhcpd config file... */ - -/* - * Copyright (c) 1995, 1996, 1997 The Internet Software Consortium. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of The Internet Software Consortium nor the names - * of its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND - * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This software has been written for the Internet Software Consortium - * by Ted Lemon in cooperation with Vixie - * Enterprises. To learn more about the Internet Software Consortium, - * see ``http://www.vix.com/isc''. To learn more about Vixie - * Enterprises, see ``http://www.vix.com''. - */ - -#ifndef lint -static char copyright[] = -"$Id: conflex.c,v 1.22 1997/02/22 12:23:40 mellon Exp $ Copyright (c) 1995, 1996, 1997 The Internet Software Consortium. All rights reserved.\n"; -#endif /* not lint */ - -#include "dhcpd.h" -#include "dhctoken.h" -#include - -int lexline; -int lexchar; -char *token_line; -char *prev_line; -char *cur_line; -char *tlname; - -static char line1 [81]; -static char line2 [81]; -static int lpos; -static int line; -static int tlpos; -static int tline; -static int token; -static int ugflag; -static char *tval; -static char tokbuf [1500]; - -#ifdef OLD_LEXER -char comments [4096]; -int comment_index; -#endif - - -static int get_char PROTO ((FILE *)); -static int get_token PROTO ((FILE *)); -static void skip_to_eol PROTO ((FILE *)); -static int read_string PROTO ((FILE *)); -static int read_number PROTO ((int, FILE *)); -static int read_num_or_name PROTO ((int, FILE *)); -static int intern PROTO ((char *, int)); - -void new_parse (name) - char *name; -{ - tlname = name; - lpos = line = 1; - cur_line = line1; - prev_line = line2; - token_line = cur_line; - cur_line [0] = prev_line [0] = 0; - warnings_occurred = 0; -} - -static int get_char (cfile) - FILE *cfile; -{ - int c = getc (cfile); - if (!ugflag) { - if (c == EOL) { - if (cur_line == line1) { - cur_line = line2; - prev_line = line1; - } else { - cur_line = line2; - prev_line = line1; - } - line++; - lpos = 1; - cur_line [0] = 0; - } else if (c != EOF) { - if (lpos <= 81) { - cur_line [lpos - 1] = c; - cur_line [lpos] = 0; - } - lpos++; - } - } else - ugflag = 0; - return c; -} - -static int get_token (cfile) - FILE *cfile; -{ - int c; - int ttok; - static char tb [2]; - int l, p, u; - - do { - l = line; - p = lpos; - u = ugflag; - - c = get_char (cfile); -#ifdef OLD_LEXER - if (c == '\n' && p == 1 && !u - && comment_index < sizeof comments) - comments [comment_index++] = '\n'; -#endif - - if (isascii (c) && isspace (c)) - continue; - if (c == '#') { -#ifdef OLD_LEXER - if (comment_index < sizeof comments) - comments [comment_index++] = '#'; -#endif - skip_to_eol (cfile); - continue; - } - if (c == '"') { - lexline = l; - lexchar = p; - ttok = read_string (cfile); - break; - } - if ((isascii (c) && isdigit (c)) || c == '-') { - lexline = l; - lexchar = p; - ttok = read_number (c, cfile); - break; - } else if (isascii (c) && isalpha (c)) { - lexline = l; - lexchar = p; - ttok = read_num_or_name (c, cfile); - break; - } else { - lexline = l; - lexchar = p; - tb [0] = c; - tb [1] = 0; - tval = tb; - ttok = c; - break; - } - } while (1); - return ttok; -} - -int next_token (rval, cfile) - char **rval; - FILE *cfile; -{ - int rv; - - if (token) { - if (lexline != tline) - token_line = cur_line; - lexchar = tlpos; - lexline = tline; - rv = token; - token = 0; - } else { - rv = get_token (cfile); - token_line = cur_line; - } - if (rval) - *rval = tval; -#ifdef DEBUG_TOKENS - fprintf (stderr, "%s:%d ", tval, rv); -#endif - return rv; -} - -int peek_token (rval, cfile) - char **rval; - FILE *cfile; -{ - int x; - - if (!token) { - tlpos = lexchar; - tline = lexline; - token = get_token (cfile); - if (lexline != tline) - token_line = prev_line; - x = lexchar; lexchar = tlpos; tlpos = x; - x = lexline; lexline = tline; tline = x; - } - if (rval) - *rval = tval; -#ifdef DEBUG_TOKENS - fprintf (stderr, "(%s:%d) ", tval, token); -#endif - return token; -} - -static void skip_to_eol (cfile) - FILE *cfile; -{ - int c; - do { - c = get_char (cfile); - if (c == EOF) - return; -#ifdef OLD_LEXER - if (comment_index < sizeof (comments)) - comments [comment_index++] = c; -#endif - if (c == EOL) { - return; - } - } while (1); -} - -static int read_string (cfile) - FILE *cfile; -{ - int i; - int bs = 0; - int c; - - for (i = 0; i < sizeof tokbuf; i++) { - c = get_char (cfile); - if (c == EOF) { - parse_warn ("eof in string constant"); - break; - } - if (bs) { - bs = 0; - tokbuf [i] = c; - } else if (c == '\\') - bs = 1; - else if (c == '"') - break; - else - tokbuf [i] = c; - } - /* Normally, I'd feel guilty about this, but we're talking about - strings that'll fit in a DHCP packet here... */ - if (i == sizeof tokbuf) { - parse_warn ("string constant larger than internal buffer"); - --i; - } - tokbuf [i] = 0; - tval = tokbuf; - return STRING; -} - -static int read_number (c, cfile) - int c; - FILE *cfile; -{ - int seenx = 0; - int i = 0; - int token = NUMBER; - - tokbuf [i++] = c; - for (; i < sizeof tokbuf; i++) { - c = get_char (cfile); - if (!seenx && c == 'x') { - seenx = 1; -#ifndef OLD_LEXER - } else if (isascii (c) && !isxdigit (c) && - (c == '-' || c == '_' || isalpha (c))) { - token = NAME; - } else if (isascii (c) && !isdigit (c) && isxdigit (c)) { - token = NUMBER_OR_NAME; -#endif - } else if (!isascii (c) || !isxdigit (c)) { - ungetc (c, cfile); - ugflag = 1; - break; - } - tokbuf [i] = c; - } - if (i == sizeof tokbuf) { - parse_warn ("numeric token larger than internal buffer"); - --i; - } - tokbuf [i] = 0; - tval = tokbuf; - return token; -} - -static int read_num_or_name (c, cfile) - int c; - FILE *cfile; -{ - int i = 0; - int rv = NUMBER_OR_NAME; - tokbuf [i++] = c; - for (; i < sizeof tokbuf; i++) { - c = get_char (cfile); - if (!isascii (c) || - (c != '-' && c != '_' && !isalnum (c))) { - ungetc (c, cfile); - ugflag = 1; - break; - } - if (!isxdigit (c)) - rv = NAME; - tokbuf [i] = c; - } - if (i == sizeof tokbuf) { - parse_warn ("token larger than internal buffer"); - --i; - } - tokbuf [i] = 0; - tval = tokbuf; - return intern (tval, rv); -} - -static int intern (atom, dfv) - char *atom; - int dfv; -{ - if (!isascii (atom [0])) - return dfv; - - switch (tolower (atom [0])) { - case 'a': - if (!strcasecmp (atom + 1, "llow")) - return ALLOW; - if (!strcasecmp (atom + 1, "lias")) - return ALIAS; - break; - case 'b': - if (!strcasecmp (atom + 1, "ootp")) - return BOOTP; - if (!strcasecmp (atom + 1, "ooting")) - return BOOTING; - if (!strcasecmp (atom + 1, "oot-unknown-clients")) - return BOOT_UNKNOWN_CLIENTS; - case 'c': - if (!strcasecmp (atom + 1, "lass")) - return CLASS; - if (!strcasecmp (atom + 1, "iaddr")) - return CIADDR; - if (!strcasecmp (atom + 1, "lient-identifier")) - return CLIENT_IDENTIFIER; - break; - case 'd': - if (!strcasecmp (atom + 1, "eny")) - return DENY; - if (!strncasecmp (atom + 1, "efault", 6)) { - if (!atom [7]) - return DEFAULT; - if (!strcasecmp (atom + 7, "-lease-time")) - return DEFAULT_LEASE_TIME; - break; - } - if (!strncasecmp (atom + 1, "ynamic-bootp", 12)) { - if (!atom [13]) - return DYNAMIC_BOOTP; - if (!strcasecmp (atom + 13, "-lease-cutoff")) - return DYNAMIC_BOOTP_LEASE_CUTOFF; - if (!strcasecmp (atom + 13, "-lease-length")) - return DYNAMIC_BOOTP_LEASE_LENGTH; - break; - } - break; - case 'e': - if (!strcasecmp (atom + 1, "thernet")) - return ETHERNET; - if (!strcasecmp (atom + 1, "nds")) - return ENDS; - if (!strcasecmp (atom + 1, "xpire")) - return EXPIRE; - break; - case 'f': - if (!strcasecmp (atom + 1, "ilename")) - return FILENAME; - if (!strcasecmp (atom + 1, "ixed-address")) - return FIXED_ADDR; - break; - case 'g': - if (!strcasecmp (atom + 1, "iaddr")) - return GIADDR; - if (!strcasecmp (atom + 1, "roup")) - return GROUP; - if (!strcasecmp (atom + 1, "et-lease-hostnames")) - return GET_LEASE_HOSTNAMES; - break; - case 'h': - if (!strcasecmp (atom + 1, "ost")) - return HOST; - if (!strcasecmp (atom + 1, "ardware")) - return HARDWARE; - break; - case 'i': - if (!strcasecmp (atom + 1, "nterface")) - return INTERFACE; - break; - case 'l': - if (!strcasecmp (atom + 1, "ease")) - return LEASE; - break; - case 'm': - if (!strcasecmp (atom + 1, "ax-lease-time")) - return MAX_LEASE_TIME; - if (!strncasecmp (atom + 1, "edi", 3)) { - if (!strcasecmp (atom + 4, "a")) - return MEDIA; - if (!strcasecmp (atom + 4, "um")) - return MEDIUM; - break; - } - break; - case 'n': - if (!strcasecmp (atom + 1, "etmask")) - return NETMASK; - if (!strcasecmp (atom + 1, "ext-server")) - return NEXT_SERVER; - break; - case 'o': - if (!strcasecmp (atom + 1, "ption")) - return OPTION; - if (!strcasecmp (atom + 1, "ne-lease-per-client")) - return ONE_LEASE_PER_CLIENT; - break; - case 'p': - if (!strcasecmp (atom + 1, "acket")) - return PACKET; - break; - case 'r': - if (!strcasecmp (atom + 1, "ange")) - return RANGE; - if (!strcasecmp (atom + 1, "equest")) - return REQUEST; - if (!strcasecmp (atom + 1, "equire")) - return REQUIRE; - if (!strcasecmp (atom + 1, "etry")) - return RETRY; - if (!strcasecmp (atom + 1, "enew")) - return RENEW; - if (!strcasecmp (atom + 1, "ebind")) - return REBIND; - break; - case 's': - if (!strcasecmp (atom + 1, "tarts")) - return STARTS; - if (!strcasecmp (atom + 1, "iaddr")) - return SIADDR; - if (!strcasecmp (atom + 1, "ubnet")) - return SUBNET; - if (!strcasecmp (atom + 1, "hared-network")) - return SHARED_NETWORK; - if (!strcasecmp (atom + 1, "erver-name")) - return SERVER_NAME; - if (!strcasecmp (atom + 1, "erver-identifier")) - return SERVER_IDENTIFIER; - if (!strcasecmp (atom + 1, "elect-timeout")) - return SELECT_TIMEOUT; - if (!strcasecmp (atom + 1, "end")) - return SEND; - if (!strcasecmp (atom + 1, "cript")) - return SCRIPT; - break; - case 't': - if (!strcasecmp (atom + 1, "imestamp")) - return TIMESTAMP; - if (!strcasecmp (atom + 1, "imeout")) - return TIMEOUT; - if (!strcasecmp (atom + 1, "oken-ring")) - return TOKEN_RING; - break; - case 'u': - if (!strcasecmp (atom + 1, "id")) - return UID; - if (!strcasecmp (atom + 1, "ser-class")) - return USER_CLASS; - if (!strcasecmp (atom + 1, "se-host-decl-names")) - return USE_HOST_DECL_NAMES; - if (!strcasecmp (atom + 1, "nknown-clients")) - return UNKNOWN_CLIENTS; - break; - case 'v': - if (!strcasecmp (atom + 1, "endor-class")) - return VENDOR_CLASS; - break; - case 'y': - if (!strcasecmp (atom + 1, "iaddr")) - return YIADDR; - break; - } - return dfv; -} diff --git a/db.c b/db.c deleted file mode 100644 index afdaff2e..00000000 --- a/db.c +++ /dev/null @@ -1,212 +0,0 @@ -/* db.c - - Persistent database management routines for DHCPD... */ - -/* - * Copyright (c) 1995, 1996 The Internet Software Consortium. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of The Internet Software Consortium nor the names - * of its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND - * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This software has been written for the Internet Software Consortium - * by Ted Lemon in cooperation with Vixie - * Enterprises. To learn more about the Internet Software Consortium, - * see ``http://www.vix.com/isc''. To learn more about Vixie - * Enterprises, see ``http://www.vix.com''. - */ - -#ifndef lint -static char copyright[] = -"$Id: db.c,v 1.8 1996/09/02 21:16:24 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; -#endif /* not lint */ - -#include "dhcpd.h" - -FILE *db_file; - -static int counting = 0; -static int count = 0; -TIME write_time; - -/* Write the specified lease to the current lease database file. */ - -int write_lease (lease) - struct lease *lease; -{ - struct tm *t; - char tbuf [64]; - int errors = 0; - - if (counting) - ++count; - errno = 0; - fprintf (db_file, "lease %s {\n", piaddr (lease -> ip_addr)); - if (errno) { - ++errors; - } - - t = gmtime (&lease -> starts); - sprintf (tbuf, "%d %d/%d/%d %02d:%02d:%02d;", - t -> tm_wday, t -> tm_year + 1900, - t -> tm_mon + 1, t -> tm_mday, - t -> tm_hour, t -> tm_min, t -> tm_sec); - errno = 0; - fprintf (db_file, "\tstarts %s\n", tbuf); - if (errno) { - ++errors; - } - - t = gmtime (&lease -> ends); - sprintf (tbuf, "%d %d/%d/%d %02d:%02d:%02d;", - t -> tm_wday, t -> tm_year + 1900, - t -> tm_mon + 1, t -> tm_mday, - t -> tm_hour, t -> tm_min, t -> tm_sec); - errno = 0; - fprintf (db_file, "\tends %s", tbuf); - if (errno) { - ++errors; - } - - if (lease -> hardware_addr.hlen) { - errno = 0; - fprintf (db_file, "\n\thardware %s %s;", - hardware_types [lease -> hardware_addr.htype], - print_hw_addr (lease -> hardware_addr.htype, - lease -> hardware_addr.hlen, - lease -> hardware_addr.haddr)); - if (errno) { - ++errors; - } - } - if (lease -> uid_len) { - int i; - errno = 0; - fprintf (db_file, "\n\tuid %x", lease -> uid [0]); - if (errno) { - ++errors; - } - for (i = 1; i < lease -> uid_len; i++) { - errno = 0; - fprintf (db_file, ":%x", lease -> uid [i]); - if (errno) { - ++errors; - } - } - putc (';', db_file); - } - if (lease -> flags & BOOTP_LEASE) { - errno = 0; - fprintf (db_file, "\n\tdynamic-bootp;"); - if (errno) { - ++errors; - } - } - errno = 0; - fputs ("\n}\n", db_file); - if (errno) { - ++errors; - } - if (errors) - note ("write_lease: unable to write lease %s", - piaddr (lease -> ip_addr)); - return !errors; -} - -/* Commit any leases that have been written out... */ - -int commit_leases () -{ - /* Commit any outstanding writes to the lease database file. - We need to do this even if we're rewriting the file below, - just in case the rewrite fails. */ - if (fflush (db_file) == EOF) { - note ("commit_leases: unable to commit: %m"); - return 0; - } - if (fsync (fileno (db_file)) < 0) { - note ("commit_leases: unable to commit: %m"); - return 0; - } - - /* If we've written more than a thousand leases or if - we haven't rewritten the lease database in over an - hour, rewrite it now. */ - if (count > 1000 || (count && cur_time - write_time > 3600)) { - count = 0; - write_time = cur_time; - new_lease_file (); - } - return 1; -} - -void db_startup () -{ - /* Read in the existing lease file... */ - read_leases (); - - new_lease_file (); -} - -void new_lease_file () -{ - char newfname [512]; - char backfname [512]; - TIME t; - - /* If we already have an open database, close it. */ - if (db_file) { - fclose (db_file); - } - - /* Make a temporary lease file... */ - time (&t); - sprintf (newfname, "%s.%d", path_dhcpd_db, (int) (t & 32767)); - if ((db_file = fopen (newfname, "w")) == NULL) { - error ("Can't start new lease file: %m"); - } - - /* Write out all the leases that we know of... */ - counting = 0; - write_leases (); - - /* Get the old database out of the way... */ - sprintf (backfname, "%s~", path_dhcpd_db); - if (unlink (backfname) < 0 && errno != ENOENT) - error ("Can't remove old lease database backup %s: %m", - backfname); - if (link (path_dhcpd_db, backfname) < 0) - error ("Can't backup lease database %s to %s: %m", - path_dhcpd_db, backfname); - - /* Move in the new file... */ - if (rename (newfname, path_dhcpd_db) < 0) - error ("Can't install new lease database %s to %s: %m", - newfname, path_dhcpd_db); - - counting = 1; -} diff --git a/dhcp.c b/dhcp.c deleted file mode 100644 index ec0ff916..00000000 --- a/dhcp.c +++ /dev/null @@ -1,1158 +0,0 @@ -/* dhcp.c - - DHCP Protocol engine. */ - -/* - * Copyright (c) 1995, 1996, 1997 The Internet Software Consortium. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of The Internet Software Consortium nor the names - * of its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND - * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This software has been written for the Internet Software Consortium - * by Ted Lemon in cooperation with Vixie - * Enterprises. To learn more about the Internet Software Consortium, - * see ``http://www.vix.com/isc''. To learn more about Vixie - * Enterprises, see ``http://www.vix.com''. - */ - -#ifndef lint -static char copyright[] = -"$Id: dhcp.c,v 1.40 1997/02/22 12:25:11 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; -#endif /* not lint */ - -#include "dhcpd.h" - -static unsigned char dhcp_message [256]; - -void dhcp (packet) - struct packet *packet; -{ - if (!locate_network (packet) && packet -> packet_type != DHCPREQUEST) - return; - - switch (packet -> packet_type) { - case DHCPDISCOVER: - dhcpdiscover (packet); - break; - - case DHCPREQUEST: - dhcprequest (packet); - break; - - case DHCPRELEASE: - dhcprelease (packet); - break; - - case DHCPDECLINE: - dhcpdecline (packet); - break; - - case DHCPINFORM: - dhcpinform (packet); - break; - - default: - break; - } -} - -void dhcpdiscover (packet) - struct packet *packet; -{ - struct lease *lease = find_lease (packet, packet -> shared_network); - struct host_decl *hp; - - note ("DHCPDISCOVER from %s via %s", - print_hw_addr (packet -> raw -> htype, - packet -> raw -> hlen, - packet -> raw -> chaddr), - packet -> raw -> giaddr.s_addr - ? inet_ntoa (packet -> raw -> giaddr) - : packet -> interface -> name); - - /* Sourceless packets don't make sense here. */ - if (!packet -> shared_network) { - note ("Packet from unknown subnet: %s", - inet_ntoa (packet -> raw -> giaddr)); - return; - } - - /* If we didn't find a lease, try to allocate one... */ - if (!lease) { - lease = packet -> shared_network -> last_lease; - - /* If there are no leases in that subnet that have - expired, we have nothing to offer this client. */ - if (!lease || lease -> ends > cur_time) { - note ("no free leases on subnet %s", - packet -> shared_network -> name); - return; - } - - /* Try to find a host_decl that matches the client - identifier or hardware address on the packet, and - has no fixed IP address. If there is one, hang - it off the lease so that its option definitions - can be used. */ - if (((packet -> options [DHO_DHCP_CLIENT_IDENTIFIER].len - != 0) && - ((hp = find_hosts_by_uid - (packet -> options [DHO_DHCP_CLIENT_IDENTIFIER].data, - packet -> options [DHO_DHCP_CLIENT_IDENTIFIER].len)) - != (struct host_decl *)0)) || - ((hp = find_hosts_by_haddr (packet -> raw -> htype, - packet -> raw -> chaddr, - packet -> raw -> hlen)) - != (struct host_decl *)0)) { - for (; hp; hp = hp -> n_ipaddr) { - if (!hp -> fixed_addr) { - lease -> host = hp; - break; - } - } - } else { - lease -> host = (struct host_decl *)0; - } - } - - /* If this subnet won't boot unknown clients, ignore the - request. */ - if (!lease -> host && - !lease -> subnet -> group -> boot_unknown_clients) { - note ("Ignoring unknown client %s", - print_hw_addr (packet -> raw -> htype, - packet -> raw -> hlen, - packet -> raw -> chaddr)); - } else if (lease -> host && - !lease -> host -> group -> allow_booting) { - note ("Declining to boot client %s", - lease -> host -> name); - } else - ack_lease (packet, lease, DHCPOFFER, cur_time + 120); -} - -void dhcprequest (packet) - struct packet *packet; -{ - struct lease *lease; - struct iaddr cip; - struct subnet *subnet; - - if (packet -> options [DHO_DHCP_REQUESTED_ADDRESS].len) { - cip.len = 4; - memcpy (cip.iabuf, - packet -> options [DHO_DHCP_REQUESTED_ADDRESS].data, - 4); - } else { - cip.len = 4; - memcpy (cip.iabuf, &packet -> raw -> ciaddr.s_addr, 4); - } - subnet = find_subnet (cip); - - /* Find the lease that matches the address requested by the - client. */ - if (packet -> shared_network) - lease = find_lease (packet, packet -> shared_network); - else - lease = (struct lease *)0; - - note ("DHCPREQUEST for %s from %s via %s", - piaddr (cip), - print_hw_addr (packet -> raw -> htype, - packet -> raw -> hlen, - packet -> raw -> chaddr), - packet -> raw -> giaddr.s_addr - ? inet_ntoa (packet -> raw -> giaddr) - : packet -> interface -> name); - - /* If we found a lease for the client but it's not the one the - client asked for, don't send it - some other server probably - made the cut. */ - if (lease && !addr_eq (lease -> ip_addr, cip)) { - return; - } - - /* If a client on a given network wants to request a lease on - an address on a different network, NAK it. If the Requested - Address option was used, the protocol says that it must have - been broadcast, so we can trust the source network information. - - If ciaddr was specified and Requested Address was not, then - we really only know for sure what network a packet came from - if it came through a BOOTP gateway - if it came through an - IP router, we'll just have to assume that it's cool. - - This violates the protocol spec in the case that the client - is in the REBINDING state and broadcasts a DHCPREQUEST on - the local wire. We're supposed to check ciaddr for - validity in that case, but if the packet was unicast - through a router from a client in the RENEWING state, it - would look exactly the same to us and it would be very - bad to send a DHCPNAK. I think we just have to live with - this. */ - if ((packet -> raw -> ciaddr.s_addr && - packet -> raw -> giaddr.s_addr) || - packet -> options [DHO_DHCP_REQUESTED_ADDRESS].len) { - - /* If we don't know where it came from but we do know - where it claims to have come from, it didn't come - from there. Fry it. */ - if (!packet -> shared_network) { - if (subnet) { - nak_lease (packet, &cip); - return; - } - /* Otherwise, ignore it. */ - return; - } - - /* If we do know where it came from and we don't know - where it claims to have come from, same deal - fry it. */ - subnet = find_grouped_subnet (packet -> shared_network, cip); - if (!subnet) { - nak_lease (packet, &cip); - return; - } - } - - /* If we own the lease that the client is asking for, - and it's already been assigned to the client, ack it. */ - if (lease && - ((lease -> uid_len && lease -> uid_len == - packet -> options [DHO_DHCP_CLIENT_IDENTIFIER].len && - !memcmp (packet -> options - [DHO_DHCP_CLIENT_IDENTIFIER].data, - lease -> uid, lease -> uid_len)) || - (lease -> hardware_addr.hlen == packet -> raw -> hlen && - lease -> hardware_addr.htype == packet -> raw -> htype && - !memcmp (lease -> hardware_addr.haddr, - packet -> raw -> chaddr, - packet -> raw -> hlen)))) { - ack_lease (packet, lease, DHCPACK, 0); - return; - } -} - -void dhcprelease (packet) - struct packet *packet; -{ - struct lease *lease = find_lease (packet, packet -> shared_network); - - note ("DHCPRELEASE of %s from %s via %s", - inet_ntoa (packet -> raw -> ciaddr), - print_hw_addr (packet -> raw -> htype, - packet -> raw -> hlen, - packet -> raw -> chaddr), - packet -> raw -> giaddr.s_addr - ? inet_ntoa (packet -> raw -> giaddr) - : packet -> interface -> name); - - - /* If we found a lease, release it. */ - if (lease) { - release_lease (lease); - } -} - -void dhcpdecline (packet) - struct packet *packet; -{ - struct lease *lease = find_lease (packet, packet -> shared_network); - struct iaddr cip; - - if (packet -> options [DHO_DHCP_REQUESTED_ADDRESS].len) { - cip.len = 4; - memcpy (cip.iabuf, - packet -> options [DHO_DHCP_REQUESTED_ADDRESS].data, - 4); - } else { - cip.len = 0; - } - - note ("DHCPDECLINE on %s from %s via %s", - piaddr (cip), - print_hw_addr (packet -> raw -> htype, - packet -> raw -> hlen, - packet -> raw -> chaddr), - packet -> raw -> giaddr.s_addr - ? inet_ntoa (packet -> raw -> giaddr) - : packet -> interface -> name); - - - /* If we found a lease, mark it as unusable and complain. */ - if (lease) { - abandon_lease (lease); - } -} - -void dhcpinform (packet) - struct packet *packet; -{ - note ("DHCPINFORM from %s", - inet_ntoa (packet -> raw -> ciaddr)); -} - -void nak_lease (packet, cip) - struct packet *packet; - struct iaddr *cip; -{ - struct sockaddr_in to; - struct in_addr from; - int result; - struct dhcp_packet raw; - unsigned char nak = DHCPNAK; - struct packet outgoing; - struct hardware hto; - - struct tree_cache *options [256]; - struct tree_cache dhcpnak_tree; - struct tree_cache dhcpmsg_tree; - - memset (options, 0, sizeof options); - memset (&outgoing, 0, sizeof outgoing); - memset (&raw, 0, sizeof raw); - outgoing.raw = &raw; - - /* Set DHCP_MESSAGE_TYPE to DHCPNAK */ - options [DHO_DHCP_MESSAGE_TYPE] = &dhcpnak_tree; - options [DHO_DHCP_MESSAGE_TYPE] -> value = &nak; - options [DHO_DHCP_MESSAGE_TYPE] -> len = sizeof nak; - options [DHO_DHCP_MESSAGE_TYPE] -> buf_size = sizeof nak; - options [DHO_DHCP_MESSAGE_TYPE] -> timeout = 0xFFFFFFFF; - options [DHO_DHCP_MESSAGE_TYPE] -> tree = (struct tree *)0; - - /* Set DHCP_MESSAGE to whatever the message is */ - options [DHO_DHCP_MESSAGE] = &dhcpmsg_tree; - options [DHO_DHCP_MESSAGE] -> value = dhcp_message; - options [DHO_DHCP_MESSAGE] -> len = strlen (dhcp_message); - options [DHO_DHCP_MESSAGE] -> buf_size = strlen (dhcp_message); - options [DHO_DHCP_MESSAGE] -> timeout = 0xFFFFFFFF; - options [DHO_DHCP_MESSAGE] -> tree = (struct tree *)0; - - /* Do not use the client's requested parameter list. */ - packet -> options [DHO_DHCP_PARAMETER_REQUEST_LIST].len = 0; - packet -> options [DHO_DHCP_PARAMETER_REQUEST_LIST].data = - (unsigned char *)0; - - /* Set up the option buffer... */ - outgoing.packet_length = - cons_options (packet, outgoing.raw, options, 0, 0); - -/* memset (&raw.ciaddr, 0, sizeof raw.ciaddr);*/ - raw.siaddr = packet -> interface -> primary_address; - raw.giaddr = packet -> raw -> giaddr; - memcpy (raw.chaddr, packet -> raw -> chaddr, sizeof raw.chaddr); - raw.hlen = packet -> raw -> hlen; - raw.htype = packet -> raw -> htype; - - raw.xid = packet -> raw -> xid; - raw.secs = packet -> raw -> secs; - raw.flags = packet -> raw -> flags | htons (BOOTP_BROADCAST); - raw.hops = packet -> raw -> hops; - raw.op = BOOTREPLY; - - /* Report what we're sending... */ - note ("DHCPNAK on %s to %s via %s", - piaddr (*cip), - print_hw_addr (packet -> raw -> htype, - packet -> raw -> hlen, - packet -> raw -> chaddr), - packet -> raw -> giaddr.s_addr - ? inet_ntoa (packet -> raw -> giaddr) - : packet -> interface -> name); - - - -#ifdef DEBUG_PACKET - dump_packet (packet); - dump_raw ((unsigned char *)packet -> raw, packet -> packet_length); - dump_packet (&outgoing); - dump_raw ((unsigned char *)&raw, outgoing.packet_length); -#endif - - hto.htype = packet -> raw -> htype; - hto.hlen = packet -> raw -> hlen; - memcpy (hto.haddr, packet -> raw -> chaddr, hto.hlen); - - /* Set up the common stuff... */ - to.sin_family = AF_INET; -#ifdef HAVE_SA_LEN - to.sin_len = sizeof to; -#endif - memset (to.sin_zero, 0, sizeof to.sin_zero); - - from = packet -> interface -> primary_address; - - /* If this was gatewayed, send it back to the gateway. - Otherwise, broadcast it on the local network. */ - if (raw.giaddr.s_addr) { - to.sin_addr = raw.giaddr; - to.sin_port = local_port; - - if (outgoing.packet_length < BOOTP_MIN_LEN) - outgoing.packet_length = BOOTP_MIN_LEN; - -#ifdef USE_FALLBACK - result = send_fallback (&fallback_interface, - packet, &raw, outgoing.packet_length, - from, &to, &hto); - if (result < 0) - warn ("send_fallback: %m"); - return; -#endif - } else { - to.sin_addr.s_addr = htonl (INADDR_BROADCAST); - to.sin_port = packet->client_port; - } - - errno = 0; - result = send_packet (packet -> interface, - packet, &raw, outgoing.packet_length, - from, &to, (struct hardware *)0); - if (result < 0) - warn ("send_packet: %m"); -} - -void ack_lease (packet, lease, offer, when) - struct packet *packet; - struct lease *lease; - unsigned char offer; - TIME when; -{ - struct lease lt; - TIME lease_time; - TIME offered_lease_time; - - int bufs = 0; - struct packet outgoing; - struct dhcp_packet raw; - struct tree_cache *options [256]; - struct sockaddr_in to; - struct in_addr from; - struct hardware hto; - int result; - - unsigned char lease_time_buf [4]; - unsigned char lease_t1_buf [4]; - unsigned char lease_t2_buf [4]; - struct tree_cache lease_time_tree; - struct tree_cache lease_t1_tree; - struct tree_cache lease_t2_tree; - struct tree_cache dhcpoffer_tree; - struct tree_cache server_id_tree; - struct tree_cache vendor_class_tree; - struct tree_cache user_class_tree; - struct tree_cache hostname_tree; - struct tree_cache netmask_tree; - - struct class *vendor_class, *user_class; - char *filename; - char *server_name; - int i; - - if (packet -> options [DHO_DHCP_CLASS_IDENTIFIER].len) { - vendor_class = - find_class (0, - packet -> - options [DHO_DHCP_CLASS_IDENTIFIER].data, - packet -> - options [DHO_DHCP_CLASS_IDENTIFIER].len); - } else { - vendor_class = (struct class *)0; - } - - if (packet -> options [DHO_DHCP_USER_CLASS_ID].len) { - user_class = - find_class (1, - packet -> - options [DHO_DHCP_USER_CLASS_ID].data, - packet -> - options [DHO_DHCP_USER_CLASS_ID].len); - } else { - user_class = (struct class *)0; - } - - /* Choose a filename; first from the host_decl, if any, then from - the user class, then from the vendor class. */ - if (lease -> host && lease -> host -> group -> filename) - filename = lease -> host -> group -> filename; - else if (user_class && user_class -> group -> filename) - filename = user_class -> group -> filename; - else if (vendor_class && vendor_class -> group -> filename) - filename = vendor_class -> group -> filename; - else filename = (char *)0; - - /* Choose a server name as above. */ - if (lease -> host && lease -> host -> group -> server_name) - server_name = lease -> host -> group -> server_name; - else if (user_class && user_class -> group -> server_name) - server_name = user_class -> group -> server_name; - else if (vendor_class && vendor_class -> group -> server_name) - server_name = vendor_class -> group -> server_name; - else server_name = (char *)0; - - /* At this point, we have a lease that we can offer the client. - Now we construct a lease structure that contains what we want, - and call supersede_lease to do the right thing with it. */ - - memset (<, 0, sizeof lt); - - /* Use the ip address of the lease that we finally found in - the database. */ - lt.ip_addr = lease -> ip_addr; - - /* Start now. */ - lt.starts = cur_time; - - /* Figure out how long a lease to assign. If this is a - dynamic BOOTP lease, its duration must be infinite. */ - if (offer) { - if (packet -> options [DHO_DHCP_LEASE_TIME].len == 4) { - lease_time = getULong - (packet -> options [DHO_DHCP_LEASE_TIME].data); - - /* Don't let the client ask for a longer lease than - is supported for this subnet or host. */ - if (lease -> host && - lease -> host -> group -> max_lease_time) { - if (lease_time > - lease -> host -> group -> max_lease_time) - lease_time = (lease -> host -> - group -> max_lease_time); - } else { - if (lease_time > - lease -> subnet -> group -> max_lease_time) - lease_time = (lease -> subnet -> - group -> max_lease_time); - } - } else { - if (lease -> host - && lease -> host -> group -> default_lease_time) - lease_time = (lease -> host -> - group -> default_lease_time); - else - lease_time = (lease -> subnet -> - group -> default_lease_time); - } - - lt.offered_expiry = cur_time + lease_time; - if (when) - lt.ends = when; - else - lt.ends = lt.offered_expiry; - } else { - if (lease -> host && - lease -> host -> group -> bootp_lease_length) - lt.ends = (cur_time + - lease -> host -> - group -> bootp_lease_length); - else if (lease -> subnet -> group -> bootp_lease_length) - lt.ends = (cur_time + - lease -> subnet -> - group -> bootp_lease_length); - else if (lease -> host && - lease -> host -> group -> bootp_lease_cutoff) - lt.ends = lease -> host -> group -> bootp_lease_cutoff; - else - lt.ends = (lease -> subnet -> - group -> bootp_lease_cutoff); - lt.offered_expiry = lt.ends; - lt.flags = BOOTP_LEASE; - } - - lt.timestamp = cur_time; - - /* Record the uid, if given... */ - if (packet -> options [DHO_DHCP_CLIENT_IDENTIFIER].len) { - lt.uid_len = - packet -> options [DHO_DHCP_CLIENT_IDENTIFIER].len; - lt.uid = packet -> options [DHO_DHCP_CLIENT_IDENTIFIER].data; - packet -> options [DHO_DHCP_CLIENT_IDENTIFIER].data = - (unsigned char *)0; - packet -> options [DHO_DHCP_CLIENT_IDENTIFIER].len = 0; - } - - /* Record the hardware address, if given... */ - lt.hardware_addr.hlen = packet -> raw -> hlen; - lt.hardware_addr.htype = packet -> raw -> htype; - memcpy (lt.hardware_addr.haddr, packet -> raw -> chaddr, - packet -> raw -> hlen); - - lt.host = lease -> host; - lt.subnet = lease -> subnet; - lt.shared_network = lease -> shared_network; - - /* Record the transaction id... */ - lt.xid = packet -> raw -> xid; - - /* Don't call supersede_lease on a mocked-up lease. */ - if (lease -> flags & STATIC_LEASE) - ; - else - /* Install the new information about this lease in the database. - If this is a DHCPACK or a dynamic BOOTREPLY and we can't write - the lease, don't ACK it (or BOOTREPLY it) either. */ - if (!(supersede_lease (lease, <, !offer || offer == DHCPACK) - || (offer && offer != DHCPACK))) - return; - - /* Send a response to the client... */ - - memset (&outgoing, 0, sizeof outgoing); - memset (&raw, 0, sizeof raw); - outgoing.raw = &raw; - - /* Copy in the filename if given; otherwise, flag the filename - buffer as available for options. */ - if (filename) - strncpy (raw.file, filename, sizeof raw.file); - else - bufs |= 1; - - /* Copy in the server name if given; otherwise, flag the - server_name buffer as available for options. */ - if (server_name) - strncpy (raw.sname, server_name, sizeof raw.sname); - else - bufs |= 2; /* XXX */ - - memcpy (raw.chaddr, packet -> raw -> chaddr, packet -> raw -> hlen); - raw.hlen = packet -> raw -> hlen; - raw.htype = packet -> raw -> htype; - - /* Start out with the subnet options... */ - memcpy (options, lease -> subnet -> group -> options, sizeof options); - - /* Vendor and user classes are only supported for DHCP clients. */ - if (offer) { - /* If we have a vendor class, install those options, - superseding any subnet options. */ - if (vendor_class) { - for (i = 0; i < 256; i++) - if (vendor_class -> group -> options [i]) - options [i] = (vendor_class -> group -> - options [i]); - } - - /* If we have a user class, install those options, - superseding any subnet and vendor class options. */ - if (user_class) { - for (i = 0; i < 256; i++) - if (user_class -> group -> options [i]) - options [i] = (user_class -> group -> - options [i]); - } - - } - - /* If we have a host_decl structure, install the associated - options, superseding anything that's in the way. */ - if (lease -> host) { - for (i = 0; i < 256; i++) - if (lease -> host -> group -> options [i]) - options [i] = (lease -> host -> - group -> options [i]); - } - - /* If we didn't get a hostname from an option somewhere, see if - we can get one from the lease. */ - if (!options [DHO_HOST_NAME] && lease -> hostname) { - options [DHO_HOST_NAME] = &hostname_tree; - options [DHO_HOST_NAME] -> value = - (unsigned char *)lease -> hostname; - options [DHO_HOST_NAME] -> buf_size = - options [DHO_HOST_NAME] -> len = - strlen (lease -> hostname); - options [DHO_HOST_NAME] -> timeout = 0xFFFFFFFF; - options [DHO_HOST_NAME] -> tree = (struct tree *)0; - } - - /* Now, if appropriate, put in DHCP-specific options that - override those. */ - if (offer) { - options [DHO_DHCP_MESSAGE_TYPE] = &dhcpoffer_tree; - options [DHO_DHCP_MESSAGE_TYPE] -> value = &offer; - options [DHO_DHCP_MESSAGE_TYPE] -> len = sizeof offer; - options [DHO_DHCP_MESSAGE_TYPE] -> buf_size = sizeof offer; - options [DHO_DHCP_MESSAGE_TYPE] -> timeout = 0xFFFFFFFF; - options [DHO_DHCP_MESSAGE_TYPE] -> tree = (struct tree *)0; - - options [DHO_DHCP_SERVER_IDENTIFIER] = &server_id_tree; - options [DHO_DHCP_SERVER_IDENTIFIER] -> value = - (unsigned char *) - &packet -> interface -> primary_address; - options [DHO_DHCP_SERVER_IDENTIFIER] -> len = - sizeof packet -> interface -> primary_address; - options [DHO_DHCP_SERVER_IDENTIFIER] -> buf_size = - sizeof packet -> interface -> primary_address; - options [DHO_DHCP_SERVER_IDENTIFIER] -> timeout = - 0xFFFFFFFF; - options [DHO_DHCP_SERVER_IDENTIFIER] -> tree = - (struct tree *)0; - - /* Sanity check the lease time. */ - if ((lease->offered_expiry - cur_time) < 15) - offered_lease_time = (lease -> subnet -> - group -> default_lease_time); - else if (lease -> offered_expiry - cur_time > - lease -> subnet -> group -> max_lease_time) - offered_lease_time = (lease -> subnet -> - group -> max_lease_time); - else - offered_lease_time = - lease -> offered_expiry - cur_time; - - putULong (lease_time_buf, offered_lease_time); - options [DHO_DHCP_LEASE_TIME] = &lease_time_tree; - options [DHO_DHCP_LEASE_TIME] -> value = lease_time_buf; - options [DHO_DHCP_LEASE_TIME] -> len = sizeof lease_time_buf; - options [DHO_DHCP_LEASE_TIME] -> - buf_size = sizeof lease_time_buf; - options [DHO_DHCP_LEASE_TIME] -> timeout = 0xFFFFFFFF; - options [DHO_DHCP_LEASE_TIME] -> tree = (struct tree *)0; - - /* Renewal time is lease time * 0.5. */ - offered_lease_time /= 2; - putULong (lease_t1_buf, offered_lease_time); - options [DHO_DHCP_RENEWAL_TIME] = &lease_t1_tree; - options [DHO_DHCP_RENEWAL_TIME] -> value = lease_t1_buf; - options [DHO_DHCP_RENEWAL_TIME] -> len = sizeof lease_t1_buf; - options [DHO_DHCP_RENEWAL_TIME] -> - buf_size = sizeof lease_t1_buf; - options [DHO_DHCP_RENEWAL_TIME] -> timeout = 0xFFFFFFFF; - options [DHO_DHCP_RENEWAL_TIME] -> tree = (struct tree *)0; - - /* Rebinding time is lease time * 0.875. */ - offered_lease_time += (offered_lease_time / 2 - + offered_lease_time / 4); - putULong (lease_t2_buf, offered_lease_time); - options [DHO_DHCP_REBINDING_TIME] = &lease_t2_tree; - options [DHO_DHCP_REBINDING_TIME] -> value = lease_t2_buf; - options [DHO_DHCP_REBINDING_TIME] -> len = sizeof lease_t2_buf; - options [DHO_DHCP_REBINDING_TIME] -> - buf_size = sizeof lease_t2_buf; - options [DHO_DHCP_REBINDING_TIME] -> timeout = 0xFFFFFFFF; - options [DHO_DHCP_REBINDING_TIME] -> tree = (struct tree *)0; - - /* If we used the vendor class the client specified, we - have to return it. */ - if (vendor_class) { - options [DHO_DHCP_CLASS_IDENTIFIER] = - &vendor_class_tree; - options [DHO_DHCP_CLASS_IDENTIFIER] -> - value = (unsigned char *)vendor_class -> name; - options [DHO_DHCP_CLASS_IDENTIFIER] -> - len = strlen (vendor_class -> name); - options [DHO_DHCP_CLASS_IDENTIFIER] -> - buf_size = strlen (vendor_class -> name); - options [DHO_DHCP_CLASS_IDENTIFIER] -> - timeout = 0xFFFFFFFF; - options [DHO_DHCP_CLASS_IDENTIFIER] -> - tree = (struct tree *)0; - } - - /* If we used the user class the client specified, we - have to return it. */ - if (user_class) { - options [DHO_DHCP_USER_CLASS_ID] = &user_class_tree; - options [DHO_DHCP_USER_CLASS_ID] -> - value = (unsigned char *)user_class -> name; - options [DHO_DHCP_USER_CLASS_ID] -> - len = strlen (user_class -> name); - options [DHO_DHCP_USER_CLASS_ID] -> - buf_size = strlen (user_class -> name); - options [DHO_DHCP_USER_CLASS_ID] -> - timeout = 0xFFFFFFFF; - options [DHO_DHCP_USER_CLASS_ID] -> - tree = (struct tree *)0; - } - } - - /* Use the subnet mask from the subnet declaration if no other - mask has been provided. */ - if (!options [DHO_SUBNET_MASK]) { - options [DHO_SUBNET_MASK] = &netmask_tree; - netmask_tree.value = lease -> subnet -> netmask.iabuf; - netmask_tree.len = lease -> subnet -> netmask.len; - netmask_tree.buf_size = lease -> subnet -> netmask.len; - netmask_tree.timeout = 0xFFFFFFFF; - netmask_tree.tree = (struct tree *)0; - } - - /* See if this is a Microsoft client that NUL-terminates its - strings and expects us to do likewise... */ - if (packet -> options [DHO_HOST_NAME].data && - packet -> options [DHO_HOST_NAME].data - [packet -> options [DHO_HOST_NAME].len - 1] == '\0') - outgoing.packet_length = - cons_options (packet, outgoing.raw, options, bufs, 1); - else - outgoing.packet_length = - cons_options (packet, outgoing.raw, options, bufs, 0); - if (!offer && outgoing.packet_length < BOOTP_MIN_LEN) - outgoing.packet_length = BOOTP_MIN_LEN; - - raw.ciaddr = packet -> raw -> ciaddr; - memcpy (&raw.yiaddr, lease -> ip_addr.iabuf, 4); - - /* Figure out the address of the next server. */ - if (lease -> host && lease -> host -> group -> next_server.len) - memcpy (&raw.siaddr, - lease -> host -> group -> next_server.iabuf, 4); - else if (lease -> subnet -> group -> next_server.len) - memcpy (&raw.siaddr, - lease -> subnet -> group -> next_server.iabuf, 4); - else if (lease -> subnet -> interface_address.len) - memcpy (&raw.siaddr, - lease -> subnet -> interface_address.iabuf, 4); - else - raw.siaddr = packet -> interface -> primary_address; - - raw.giaddr = packet -> raw -> giaddr; - - raw.xid = packet -> raw -> xid; - raw.secs = packet -> raw -> secs; - raw.flags = packet -> raw -> flags; - raw.hops = packet -> raw -> hops; - raw.op = BOOTREPLY; - - /* Say what we're doing... */ - note ("%s on %s to %s via %s", - (offer - ? (offer == DHCPACK ? "DHCPACK" : "DHCPOFFER") - : "BOOTREPLY"), - piaddr (lease -> ip_addr), - print_hw_addr (packet -> raw -> htype, - packet -> raw -> hlen, - packet -> raw -> chaddr), - packet -> raw -> giaddr.s_addr - ? inet_ntoa (packet -> raw -> giaddr) - : packet -> interface -> name); - - /* Set up the hardware address... */ - hto.htype = packet -> raw -> htype; - hto.hlen = packet -> raw -> hlen; - memcpy (hto.haddr, packet -> raw -> chaddr, hto.hlen); - - to.sin_family = AF_INET; -#ifdef HAVE_SA_LEN - to.sin_len = sizeof to; -#endif - memset (to.sin_zero, 0, sizeof to.sin_zero); - - from = packet -> interface -> primary_address; - -#ifdef DEBUG_PACKET - dump_packet (packet); - dump_raw ((unsigned char *)packet -> raw, packet -> packet_length); - dump_packet (&outgoing); - dump_raw ((unsigned char *)&raw, outgoing.packet_length); -#endif - - /* If this was gatewayed, send it back to the gateway... */ - if (raw.giaddr.s_addr) { - to.sin_addr = raw.giaddr; - to.sin_port = local_port; - - if (outgoing.packet_length < BOOTP_MIN_LEN) - outgoing.packet_length = BOOTP_MIN_LEN; - -#ifdef USE_FALLBACK - result = send_fallback (&fallback_interface, - packet, &raw, outgoing.packet_length, - raw.siaddr, &to, &hto); - if (result < 0) - warn ("send_fallback: %m"); - return; -#endif - - /* If it comes from a client who already knows its address and - is not requesting a broadcast response, sent it directly to - that client. */ - } else if (raw.ciaddr.s_addr && offer == DHCPACK && - !(raw.flags & htons (BOOTP_BROADCAST))) { - to.sin_addr = packet -> raw -> ciaddr; - to.sin_port = remote_port; /* XXX */ - -#ifdef USE_FALLBACK - result = send_fallback (&fallback_interface, - packet, &raw, outgoing.packet_length, - raw.siaddr, &to, &hto); - if (result < 0) - warn ("send_fallback: %m"); - return; -#endif - - /* Otherwise, broadcast it on the local network. */ - } else { - to.sin_addr.s_addr = htonl (INADDR_BROADCAST); - to.sin_port = remote_port; /* XXX */ - } - - - result = send_packet (packet -> interface, - packet, &raw, outgoing.packet_length, - raw.siaddr, &to, &hto); - if (result < 0) - warn ("sendpkt: %m"); -} - -struct lease *find_lease (packet, share) - struct packet *packet; - struct shared_network *share; -{ - struct lease *uid_lease, *ip_lease, *hw_lease; - struct lease *lease = (struct lease *)0; - struct iaddr cip; - struct host_decl *hp, *host = (struct host_decl *)0; - struct lease *fixed_lease; - - /* Try to find a host or lease that's been assigned to the - specified unique client identifier. */ - if (packet -> options [DHO_DHCP_CLIENT_IDENTIFIER].len) { - /* First, try to find a fixed host entry for the specified - client identifier... */ - hp = find_hosts_by_uid (packet -> options - [DHO_DHCP_CLIENT_IDENTIFIER].data, - packet -> options - [DHO_DHCP_CLIENT_IDENTIFIER].len); - if (hp) { - host = hp; - fixed_lease = mockup_lease (packet, share, hp); - uid_lease = (struct lease *)0; - } else { - uid_lease = find_lease_by_uid - (packet -> options - [DHO_DHCP_CLIENT_IDENTIFIER].data, - packet -> options - [DHO_DHCP_CLIENT_IDENTIFIER].len); - /* Find the lease matching this uid that's on the - network the packet came from (if any). */ - for (; uid_lease; uid_lease = uid_lease -> n_uid) - if (uid_lease -> shared_network == share) - break; - fixed_lease = (struct lease *)0; - } - } else { - uid_lease = (struct lease *)0; - fixed_lease = (struct lease *)0; - } - - /* If we didn't find a fixed lease using the uid, try doing - it with the hardware address... */ - if (!fixed_lease) { - hp = find_hosts_by_haddr (packet -> raw -> htype, - packet -> raw -> chaddr, - packet -> raw -> hlen); - if (hp) { - host = hp; /* Save it for later. */ - fixed_lease = mockup_lease (packet, share, hp); - } - } - - /* Try to find a lease that's been attached to the client's - hardware address... */ - hw_lease = find_lease_by_hw_addr (packet -> raw -> chaddr, - packet -> raw -> hlen); - /* Find the lease that's on the network the packet came from - (if any). */ - for (; hw_lease; hw_lease = hw_lease -> n_hw) - if (hw_lease -> shared_network == share) - break; - - /* Try to find a lease that's been allocated to the client's - IP address. */ - if (packet -> options [DHO_DHCP_REQUESTED_ADDRESS].len && - packet -> options [DHO_DHCP_REQUESTED_ADDRESS].len == 4) { - cip.len = 4; - memcpy (cip.iabuf, - packet -> options [DHO_DHCP_REQUESTED_ADDRESS].data, - cip.len); - ip_lease = find_lease_by_ip_addr (cip); - } else if (packet -> raw -> ciaddr.s_addr) { - cip.len = 4; - memcpy (cip.iabuf, &packet -> raw -> ciaddr, 4); - ip_lease = find_lease_by_ip_addr (cip); - } else - ip_lease = (struct lease *)0; - - /* If the requested IP address isn't on the network the packet - came from, don't use it (this is probably taken care of at - a higher level, but it's cheap to make sure here too). */ - if (ip_lease && ip_lease -> shared_network != share) - ip_lease = (struct lease *)0; - - /* Toss ip_lease if it hasn't yet expired and the uid doesn't - match */ - if (ip_lease && - ip_lease -> ends >= cur_time && - ip_lease -> uid && ip_lease != uid_lease) - ip_lease = (struct lease *)0; - - /* Toss hw_lease if it hasn't yet expired and the uid doesn't - match, except that if the hardware address matches and the - client is now doing dynamic BOOTP (and thus hasn't provided - a uid) we let the client get away with it. */ - if (hw_lease && - hw_lease -> ends >= cur_time && - hw_lease -> uid && hw_lease != uid_lease && - (packet -> packet_type != 0 || - !(hw_lease -> flags & DYNAMIC_BOOTP_OK))) - hw_lease = (struct lease *)0; - - /* Toss extra pointers to the same lease... */ - if (ip_lease == hw_lease) - ip_lease = (struct lease *)0; - if (hw_lease == uid_lease) - hw_lease = (struct lease *)0; - if (ip_lease == uid_lease) - ip_lease = (struct lease *)0; - - /* If we got an ip address lease, make sure it isn't assigned to - some *other* client! If it was assigned to this client, we'd - have zeroed it out above, so the only way we can take it at this - point is if some other client had it but it's timed out, or if no - other client has ever had it. */ - if (ip_lease && - ip_lease -> ends >= cur_time) - ip_lease = (struct lease *)0; - - /* If we've already eliminated the lease, it wasn't there to - begin with. If we have come up with a matching lease, - set the message to bad network in case we have to throw it out. */ - if (!ip_lease && !hw_lease && !uid_lease) { - strcpy (dhcp_message, "requested address not available"); - } else { - strcpy (dhcp_message, "requested address on bad subnet"); - } - - /* Now eliminate leases that are on the wrong network... */ - if (ip_lease && - (share != ip_lease -> shared_network)) { - release_lease (ip_lease); - ip_lease = (struct lease *)0; - } - if (uid_lease && - (share != uid_lease -> shared_network)) { - release_lease (uid_lease); - uid_lease = (struct lease *)0; - } - if (hw_lease && - (share != hw_lease -> shared_network)) { - release_lease (hw_lease); - hw_lease = (struct lease *)0; - } - - /* At this point, if fixed_lease is nonzero, we can assign it to - this client. */ - if (fixed_lease) { - lease = fixed_lease; - } - - /* If we got a lease that matched the ip address and don't have - a better offer, use that; otherwise, release it. */ - if (ip_lease) { - if (lease) { - release_lease (ip_lease); - } else { - lease = ip_lease; - lease -> host = (struct host_decl *)0; - } - } - - /* If we got a lease that matched the client identifier, we may want - to use it, but if we already have a lease we like, we must free - the lease that matched the client identifier. */ - if (uid_lease) { - if (lease) { - release_lease (uid_lease); - } else { - lease = uid_lease; - lease -> host = (struct host_decl *)0; - } - } - - /* The lease that matched the hardware address is treated likewise. */ - if (hw_lease) { - if (lease) { - release_lease (hw_lease); - } else { - lease = hw_lease; - lease -> host = (struct host_decl *)0; - } - } - - /* If we found a host_decl but no matching address, try to - find a host_decl that has no address, and if there is one, - hang it off the lease so that we can use the supplied - options. */ - if (lease && host && !lease -> host) { - for (; host; host = host -> n_ipaddr) { - if (!host -> fixed_addr) { - lease -> host = host; - break; - } - } - } - - return lease; -} - -/* Search the provided host_decl structure list for an address that's on - the specified shared network. If one is found, mock up and return a - lease structure for it; otherwise return the null pointer. */ - -struct lease *mockup_lease (packet, share, hp) - struct packet *packet; - struct shared_network *share; - struct host_decl *hp; -{ - static struct lease mock; - - mock.subnet = find_host_for_network (&hp, &mock.ip_addr, share); - if (!mock.subnet) - return (struct lease *)0; - mock.next = mock.prev = (struct lease *)0; - mock.shared_network = mock.subnet -> shared_network; - mock.host = hp; - - if (hp -> group -> options [DHO_DHCP_CLIENT_IDENTIFIER]) { - mock.uid = hp -> group -> - options [DHO_DHCP_CLIENT_IDENTIFIER] -> value; - mock.uid_len = hp -> group -> - options [DHO_DHCP_CLIENT_IDENTIFIER] -> len; - } else { - mock.uid = (unsigned char *)0; - mock.uid_len = 0; - } - - mock.hardware_addr = hp -> interface; - mock.starts = mock.timestamp = mock.ends = MIN_TIME; - mock.flags = STATIC_LEASE; - return &mock; -} diff --git a/dhcpd.8 b/dhcpd.8 deleted file mode 100644 index 4bc6ff60..00000000 --- a/dhcpd.8 +++ /dev/null @@ -1,308 +0,0 @@ -.\" dhcpd.8 -.\" -.\" Copyright (c) 1995, 1996 The Internet Software Consortium. -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" 3. Neither the name of The Internet Software Consortium nor the names -.\" of its contributors may be used to endorse or promote products derived -.\" from this software without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND -.\" CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, -.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -.\" DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR -.\" CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -.\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -.\" USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -.\" ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT -.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" This software has been written for the Internet Software Consortium -.\" by Ted Lemon in cooperation with Vixie -.\" Enterprises. To learn more about the Internet Software Consortium, -.\" see ``http://www.isc.org/isc''. To learn more about Vixie -.\" Enterprises, see ``http://www.vix.com''. -.TH dhcpd 8 -.SH NAME -dhcpd - Dynamic Host Configuration Protocol Server -.SH SYNOPSIS -.B dhcpd -[ -.B -p -.I port -] -[ -.B -f -] -[ -.B -d -] -[ -.B -cf -.I config-file -] -[ -.B -lf -.I lease-file -] -[ -.I if0 -[ -.I ...ifN -] -] -.SH DESCRIPTION -The Internet Software Consortium DHCP Server, dhcpd, implements the -Dynamic Host Configuration Protocol (DHCP) and the Internet Bootstrap -Protocol (BOOTP). DHCP allows hosts on a TCP/IP network to request -and be assigned IP addresses, and also to discover information about -the network to which they are attached. BOOTP provides similar -functionality, with certain restrictions. -.SH OPERATION -.PP -The DHCP protocol allows a host which is unknown to the network -administrator to be automatically assigned a new IP address out of a -pool of IP addresses for its network. In order for this to work, the -network administrator allocates address pools in each subnet and -enters them into the dhcpd.conf(5) file. -.PP -On startup, dhcpd reads the -.IR dhcpd.conf -file and stores a list of available addresses on each subnet in -memory. When a client requests an address using the DHCP protocol, -dhcpd allocates an address for it. Each client is assigned a lease, -which expires after an amount of time chosen by the administrator (by -default, one day). Before leases expire, the clients to which leases -are assigned are expected to renew them in order to continue to use -the addresses. Once a lease has expired, the client to which that -lease was assigned is no longer permitted to use the leased IP -address. -.PP -In order to keep track of leases across system reboots and server -restarts, dhcpd keeps a list of leases it has assigned in the -dhcpd.leases(5) file. Before dhcpd grants a lease to a host, it -records the lease in this file and makes sure that the contents of the -file are flushed to disk. This ensures that even in the event of a -system crash, dhcpd will not forget about a lease that it has -assigned. On startup, after reading the dhcpd.conf file, dhcpd -reads the dhcpd.leases file to refresh its memory about what leases -have been assigned. -.PP -New leases are appended to the end of the dhcpd.leases -file. In order to prevent the file from becoming arbitrarily large, -from time to time dhcpd creates a new dhcpd.leases file from its -in-core lease database. Once this file has been written to disk, the -old file is renamed -.IR dhcpd.leases~ , -and the new file is renamed dhcpd.leases. If the system crashes in -the middle of this process, whichever dhcpd.leases file remains will -contain all the lease information, so there is no need for a special -crash recovery process. -.PP -BOOTP support is also provided by this server. Unlike DHCP, the BOOTP -protocol does not provide a protocol for recovering -dynamically-assigned addresses once they are no longer needed. It is -still possible to dynamically assign addresses to BOOTP clients, but -some administrative process for reclaiming addresses is required. By -default, leases are granted to BOOTP clients in perpetuity, although -the network administrator may set an earlier cutoff date or a shorter -lease length for BOOTP leases if that makes sense. -.PP -BOOTP clients may also be served in the old standard way, which is to -simply provide a declaration in the dhcpd.conf file for each -BOOTP client, permanently assigning an address to each client. -.PP -Whenever changes are made to the dhcpd.conf file, dhcpd must be -restarted. To restart dhcpd, send a SIGTERM (signal 15) to the -process ID contained in -.IR RUNDIR/dhcpd.pid , -and then re-invoke dhcpd. Because the DHCP server database is not as -lightweight as a BOOTP database, dhcpd does not automatically restart -itself when it sees a change to the dhcpd.conf file. -.SH COMMAND LINE -.PP -The names of the network interfaces on which dhcpd should listen for -broadcasts may be specified on the command line. This should be done -on systems where dhcpd is unable to identify non-broadcast interfaces, -but should not be required on other systems. If no interface names -are specified on the command line dhcpd will identify all network -interfaces which are up, elimininating non-broadcast interfaces if -possible, and listen for DHCP broadcasts on each interface. -.PP -If dhcpd should listen on a port other than the standard (port 67), -the -.B -p -flag may used. It should be followed by the udp port number on which -dhcpd should listen. This is mostly useful for debugging purposes. -.PP -To run dhcpd as a foreground process, rather than allowing it to run -as a daemon in the background, the -.B -f -flag should be specified. This is useful when running dhcpd under a -debugger, or when running it out of inittab on System V systems. -.PP -To have dhcpd log to the standard error descriptor, specify the -.B -d -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 cannot be used. Normally, dhcpd will log all -output using the syslog(3) function with the log facility set to -LOG_DAEMON. -.PP -Dhcpd can be made to use an alternate configuration file with the -.B -cf -flag, or an alternate lease file with the -.B -lf -flag. Because of the importance of using the same lease database at -all times when running dhcpd in production, these options should be -used \fBonly\fR for testing lease files or database files in a -non-production environment. -.SH CONFIGURATION -The syntax of the dhcpd.conf(8) file is discussed seperately. This -section should be used as an overview of the configuration process, -and the dhcpd.conf(8) documentation should be consulted for detailed -reference information. -.PP -.SH Subnets -dhcpd needs to know the subnet numbers and netmasks of all subnets for -which it will be providing service. In addition, in order to -dynamically allocate addresses, it must be assigned one or more ranges -of addresses on each subnet which it can in turn assign to client -hosts as they boot. Thus, a very simple configuration providing DHCP -support might look like this: -.nf -.sp 1 - subnet 239.252.197.0 netmask 255.255.255.0 { - range 239.252.197.10 239.252.197.250; - } -.fi -.PP -Multiple address ranges may be specified like this: -.nf -.sp 1 - subnet 239.252.197.0 netmask 255.255.255.0 { - range 239.252.197.10 239.252.197.107; - range 239.252.197.113 239.252.197.250; - } -.fi -.PP -If a subnet will only be provided with BOOTP service and no dynamic -address assignment, the range clause can be left out entirely, but the -subnet statement must appear. -.PP -.SH Lease Lengths -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. -.PP -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 environment 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 -appliance before packaging it up for delivery. -.PP -It is possible to specify two lease lengths: the default length that -will be assigned if a client doesn't ask for any particular lease -length, and a maximum lease length. These are specified as clauses -to the subnet command: -.nf -.sp 1 - subnet 239.252.197.0 netmask 255.255.255.0 { - range 239.252.197.10 239.252.197.107; - default-lease-time 600; - max-lease-time 7200; - | -.fi -.PP -This particular subnet declaration specifies a default lease time of -600 seconds (ten minutes), and a maximum lease time of 7200 seconds -(two hours). Other common values would be 86400 (one day), 604800 -(one week) and 2592000 (30 days). -.PP -Each subnet need not have the same lease\(emin the case of an office -environment and a manufacturing environment served by the same DHCP -server, it might make sense to have widely disparate values for -default and maximum lease times on each subnet. -.SH BOOTP Support -Each BOOTP client must be explicitly declared in the dhcpd.conf -file. A very basic client declaration will specify the client -network interface's hardware address and the IP address to assign to -that client. If the client needs to be able to load a boot file from -the server, that file's name must be specified. A simple bootp -client declaration might look like this: -.nf -.sp 1 - host haagen { - hardware ethernet 08:00:2b:4c:59:23; - fixed-address 239.252.197.9; - filename "/tftpboot/haagen.boot"; - } -.fi -.SH Options -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). -.PP -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 precedence. An reasonably complete DHCP configuration might -look something like this: -.nf -.sp 1 - subnet 239.252.197.0 netmask 255.255.255.0 { - range 239.252.197.10 239.252.197.250; - default-lease-time 600 max-lease-time 7200; - option subnet-mask 255.255.255.0; - option broadcast-address 239.252.197.255; - option routers 239.252.197.1; - option domain-name-servers 239.252.197.2, 239.252.197.3; - option domain-name "isc.org"; - } -.fi -.PP -A bootp host on that subnet that needs to be in a different domain and -use a different name server might be declared as follows: -.nf -.sp 1 - host haagen hardware ethernet 08:00:2b:4c:59:23 { - fixed-address 239.252.197.9; - filename "/tftpboot/haagen.boot"; - option domain-name-servers 192.5.5.1; - option domain-name "vix.com"; - } -.fi -.PP -A more complete description of the dhcpd.conf file syntax is provided -in dhcpd.conf(5). -.SH FILES -.B ETCDIR/dhcpd.conf, DBDIR/dhcpd.leases, RUNDIR/dhcpd.pid, -.B DBDIR/dhcpd.leases~. -.SH SEE ALSO -dhclient(8), dhcrelay(8), dhcpd.conf(5), dhcpd.leases(5) -.SH AUTHOR -.B dhcpd(8) -was written by Ted Lemon -under a contract with Vixie Labs. Funding -for this project was provided by the Internet Software Corporation. -Information about the Internet Software Consortium can be found at -.B http://www.isc.org/isc. diff --git a/dhcpd.c b/dhcpd.c deleted file mode 100644 index b063c305..00000000 --- a/dhcpd.c +++ /dev/null @@ -1,267 +0,0 @@ -/* dhcpd.c - - DHCP Server Daemon. */ - -/* - * Copyright (c) 1995, 1996, 1997 The Internet Software Consortium. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of The Internet Software Consortium nor the names - * of its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND - * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This software has been written for the Internet Software Consortium - * by Ted Lemon in cooperation with Vixie - * Enterprises. To learn more about the Internet Software Consortium, - * see ``http://www.vix.com/isc''. To learn more about Vixie - * Enterprises, see ``http://www.vix.com''. - */ - -#ifndef lint -static char ocopyright[] = -"$Id: dhcpd.c,v 1.38 1997/02/22 08:49:44 mellon Exp $ Copyright 1995, 1996 The Internet Software Consortium."; -#endif - -static char copyright[] = -"Copyright 1995, 1996 The Internet Software Consortium."; -static char arr [] = "All rights reserved."; -static char message [] = "Internet Software Consortium DHCPD $Name: $"; - -#include "dhcpd.h" - -static void usage PROTO ((void)); - -TIME cur_time; -struct group root_group; - -struct iaddr server_identifier; -int server_identifier_matched; - -#ifdef USE_FALLBACK -struct interface_info fallback_interface; -#endif - -u_int16_t local_port; -u_int16_t remote_port; - -int log_priority; -#ifdef DEBUG -int log_perror = -1; -#else -int log_perror = 1; -#endif - -char *path_dhcpd_conf = _PATH_DHCPD_CONF; -char *path_dhcpd_db = _PATH_DHCPD_DB; -char *path_dhcpd_pid = _PATH_DHCPD_PID; - -int main (argc, argv, envp) - int argc; - char **argv, **envp; -{ - int i, status; - struct servent *ent; - char *s; -#ifndef DEBUG - int pidfilewritten = 0; - int pid; - char pbuf [20]; - int daemon = 1; -#endif - - /* Initially, log errors to stderr as well as to syslogd. */ -#ifdef SYSLOG_4_2 - openlog ("dhcpd", LOG_NDELAY); - log_priority = DHCPD_LOG_FACILITY; -#else - openlog ("dhcpd", LOG_NDELAY, DHCPD_LOG_FACILITY); -#endif - -#ifndef DEBUG -#ifndef SYSLOG_4_2 - setlogmask (LOG_UPTO (LOG_INFO)); -#endif -#endif - note (message); - note (copyright); - note (arr); - - for (i = 1; i < argc; i++) { - if (!strcmp (argv [i], "-p")) { - if (++i == argc) - usage (); - for (s = argv [i]; *s; s++) - if (!isdigit (*s)) - error ("%s: not a valid UDP port", - argv [i]); - status = atoi (argv [i]); - if (status < 1 || status > 65535) - error ("%s: not a valid UDP port", - argv [i]); - local_port = htons (status); - debug ("binding to user-specified port %d", - ntohs (local_port)); - } else if (!strcmp (argv [i], "-f")) { -#ifndef DEBUG - daemon = 0; -#endif - } else if (!strcmp (argv [i], "-d")) { -#ifndef DEBUG - daemon = 0; -#endif - log_perror = -1; - } else if (!strcmp (argv [i], "-cf")) { - if (++i == argc) - usage (); - path_dhcpd_conf = argv [i]; - } else if (!strcmp (argv [i], "-lf")) { - if (++i == argc) - usage (); - path_dhcpd_db = argv [i]; - } else if (argv [i][0] == '-') { - usage (); - } else { - struct interface_info *tmp = - ((struct interface_info *) - dmalloc (sizeof *tmp, "get_interface_list")); - if (!tmp) - error ("Insufficient memory to %s %s", - "record interface", argv [i]); - memset (tmp, 0, sizeof *tmp); - strcpy (tmp -> name, argv [i]); - tmp -> next = interfaces; - tmp -> flags = INTERFACE_REQUESTED; - interfaces = tmp; - } - } - -#ifndef DEBUG - if (daemon) { - /* First part of becoming a daemon... */ - if ((pid = fork ()) < 0) - error ("Can't fork daemon: %m"); - else if (pid) - exit (0); - } - - /* Read previous pid file. */ - if ((i = open (path_dhcpd_pid, O_RDONLY)) >= 0) { - status = read (i, pbuf, (sizeof pbuf) - 1); - close (i); - pbuf [status] = 0; - pid = atoi (pbuf); - - /* If the previous server process is not still running, - write a new pid file immediately. */ - if (pid && kill (pid, 0) < 0) { - unlink (path_dhcpd_pid); - if ((i = open (path_dhcpd_pid, - O_WRONLY | O_CREAT, 0640)) >= 0) { - sprintf (pbuf, "%d\n", (int)getpid ()); - write (i, pbuf, strlen (pbuf)); - close (i); - pidfilewritten = 1; - } - } - } -#endif /* !DEBUG */ - - /* Default to the DHCP/BOOTP port. */ - if (!local_port) - { - ent = getservbyname ("dhcp", "udp"); - if (!ent) - local_port = htons (67); - else - local_port = ent -> s_port; - endservent (); - } - - remote_port = htons (ntohs (local_port) + 1); - - /* Get the current time... */ - GET_TIME (&cur_time); - - /* Read the dhcpd.conf file... */ - if (!readconf ()) - error ("Configuration file errors encountered -- exiting"); - - /* Start up the database... */ - db_startup (); - - /* Discover all the network interfaces and initialize them. */ - discover_interfaces (1); - -#ifndef DEBUG - /* If we were requested to log to stdout on the command line, - keep doing so; otherwise, stop. */ - if (log_perror == -1) - log_perror = 1; - else - log_perror = 0; - - if (daemon) { - /* Become session leader and get pid... */ - close (0); - close (1); - close (2); - pid = setsid (); - } - - /* If we didn't write the pid file earlier because we found a - process running the logged pid, but we made it to here, - meaning nothing is listening on the bootp port, then write - the pid file out - what's in it now is bogus anyway. */ - if (!pidfilewritten) { - unlink (path_dhcpd_pid); - if ((i = open (path_dhcpd_pid, - O_WRONLY | O_CREAT, 0640)) >= 0) { - sprintf (pbuf, "%d\n", (int)getpid ()); - write (i, pbuf, strlen (pbuf)); - close (i); - pidfilewritten = 1; - } - } -#endif /* !DEBUG */ - - /* Receive packets and dispatch them... */ - dispatch (1); - - /* Not reached */ - return 0; -} - -/* Print usage message. */ - -static void usage () -{ - error ("Usage: dhcpd [-p ] [-d] [-f] [-cf config-file]%s", - "\n [-lf lease-file] [if0 [...ifN]]"); -} - -void cleanup () -{ -} diff --git a/dhcpd.conf b/dhcpd.conf deleted file mode 100644 index a50dee07..00000000 --- a/dhcpd.conf +++ /dev/null @@ -1,128 +0,0 @@ -# dhcpd.conf -# -# Configuration file for ISC dhcpd -# - -# Hosts with more than one interface MUST specify a ``server-identifier'', -# which should be the IP address of the server's primary network interface, -# or if there is no interface that can be described that way, at least an -# interface whose address isn't likely to change. - -server-identifier toccata.fugue.com; - -# option definitions common to all supported networks... -option domain-name "fugue.com"; -option domain-name-servers toccata.fugue.com; - -# Shared network declaration is used to group subnets which share the same -# physical network together. The name is specified so that the shared -# network can be referred to in log messages - it serves no other function. - -shared-network FUGUE { - -# option definitions common to this shared network. - option subnet-mask 255.255.255.224; - default-lease-time 600; - max-lease-time 7200; - -# One of the two IP subnets that share this physical network -# -# Address ranges can be specified for each subnet attached to -# a shared network. Since these subnets share the same physical -# network, addresses are pooled together, and assignments are made -# without regard to the actual subnet. If the optional dynamic-bootp -# keyword is given in the address range declaration, then addresses -# in that range can be assigned either with the DHCP protocol or the -# BOOTP protocol; otherwise, only DHCP clients will have addresses -# allocated from the address range. -# -# Note that each IP subnet can have its own options specific to that subnet. -# options that aren't specified in the subnet are taken from the shared -# network (if any) and then from the global option list. - - subnet 204.254.239.0 netmask 255.255.255.224 { - range 204.254.239.10 204.254.239.20; - option broadcast-address 204.254.239.31; - option routers prelude.fugue.com; - } - -# The other subnet that shares this physical network - subnet 204.254.239.32 netmask 255.255.255.224 { - range dynamic-bootp 204.254.239.10 204.254.239.20; - option broadcast-address 204.254.239.31; - option routers snarg.fugue.com; - } -} - -# IP subnets that are alone on their physical wire should be declared by -# themselves. ISC dhcpd may still refer to them as shared networks in -# log messages, but this is simply an artifact of the underlying data -# structures. -# -# Note that options can be specified in the subnet declaration which -# supersede the global options specified earlier. - -subnet 192.5.5.0 netmask 255.255.255.224 { - range 192.5.5.26 192.5.5.30; - option name-servers bb.home.vix.com, gw.home.vix.com; - option domain-name "vix.com"; - option routers 192.5.5.1; - option subnet-mask 255.255.255.224; - option broadcast-address 192.5.5.31; - default-lease-time 600; - max-lease-time 7200; -} - -# Hosts which require special configuration options can be listed in -# host statements. If no address is specified, the address will be -# allocated dynamically (if possible), but the host-specific information -# will still come from the host declaration. - -host passacaglia { - hardware ethernet 0:0:c0:5d:bd:95; - filename "vmunix.passacaglia"; - server-name "toccata.fugue.com"; -} - -# Fixed IP addresses can also be specified for hosts. These addresses -# should not also be listed as being available for dynamic assignment. -# Hosts for which fixed IP addresses have been specified can boot using -# BOOTP or DHCP. Hosts for which no fixed address is specified can only -# be booted with DHCP, unless there is an address range on the subnet -# to which a BOOTP client is connected which has the dynamic-bootp flag -# set. -host fantasia { - hardware ethernet 08:00:07:26:c0:a5; - fixed-address fantasia.fugue.com; -} - -# If a DHCP or BOOTP client is mobile and might be connected to a variety -# of networks, more than one fixed address for that host can be specified. -# Hosts can have fixed addresses on some networks, but receive dynamically -# allocated address on other subnets; in order to support this, a host -# declaration for that client must be given which does not have a fixed -# address. If a client should get different parameters depending on -# what subnet it boots on, host declarations for each such network should -# be given. Finally, if a domain name is given for a host's fixed address -# and that domain name evaluates to more than one address, the address -# corresponding to the network to which the client is attached, if any, -# will be assigned. -host confusia { - hardware ethernet 02:03:04:05:06:07; - fixed-address confusia-1.fugue.com, confusia-2.fugue.com; - filename "vmunix.confusia"; - server-name "toccata.fugue.com"; -} - -host confusia { - hardware ethernet 02:03:04:05:06:07; - fixed-address confusia-3.fugue.com; - filename "vmunix.confusia"; - server-name "snarg.fugue.com"; -} - -host confusia { - hardware ethernet 02:03:04:05:06:07; - filename "vmunix.confusia"; - server-name "bb.home.vix.com"; -} diff --git a/dhcpd.conf.5 b/dhcpd.conf.5 deleted file mode 100644 index 0f93d92e..00000000 --- a/dhcpd.conf.5 +++ /dev/null @@ -1,1081 +0,0 @@ -.\" dhcpd.conf.5 -.\" -.\" Copyright (c) 1995, 1996 The Internet Software Consortium. -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" 3. Neither the name of The Internet Software Consortium nor the names -.\" of its contributors may be used to endorse or promote products derived -.\" from this software without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND -.\" CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, -.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -.\" DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR -.\" CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -.\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF -.\" USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -.\" ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT -.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" This software has been written for the Internet Software Consortium -.\" by Ted Lemon in cooperation with Vixie -.\" Enterprises. To learn more about the Internet Software Consortium, -.\" see ``http://www.isc.org/isc''. To learn more about Vixie -.\" Enterprises, see ``http://www.vix.com''. -.TH dhcpd.conf 5 -.SH NAME -dhcpd.conf - dhcpd configuration file -.SH DESCRIPTION -The dhcpd.conf file contains configuration information for -.IR dhcpd, -the Internet Software Consortium DHCP Server. -.PP -The dhcpd.conf file is a free-form ASCII text file. It is parsed by -the recursive-descent parser built into dhcpd. The file may contain -extra tabs and newlines for formatting purposes. Keywords in the file -are case-insensitive. Comments may be placed anywhere within the -file (except within quotes). Comments begin with the # character and -end at the end of the line. -.PP -The file essentially consists of a list of statements. Statements -fall into two broad categories - parameters and declarations. -.PP -Parameter statements either say how to do something (e.g., how long a -lease to offer), whether to do something (e.g., should dhcpd provide -addresses to unknown clients), or what parameters to provide to the -client (e.g., use gateway 220.177.244.7). -.PP -Declarations are used to describe the topology of the -network, to describe clients on the network, to provide addresses that -can be assigned to clients, or to apply a group of parameters to a -group of declarations. In any group of parameters and declarations, -all parameters must be specified before any declarations which depend -on those parameters may be specified. -.PP -Declarations about network topology include the -\fIserver-identifier\fR, the \fIshared-network\fR and the \fIsubnet\fR -declarations. If clients on a subnet are to be assigned addresses -dynamically, a \fIrange\fR declaration must appear within the -\fIsubnet\fR declaration. For clients with statically assigned -addresses, or for installations where only known clients will be -served, each such client must have a \fIhost\fR declaration. If -parameters are to be applied to a group of declarations which are not -related strictly on a per-subnet basis, the \fIgroup\fR declaration -can be used. -.PP -Each dhcpd.conf file must have one (and only one) -.I server-identifier -declaration, which tells dhcpd the identifier to use when issuing -leases. For every subnet which will be served, and for every subnet -to which the dhcp server is connected, there must be one \fIsubnet\fR -declaration, which tells dhcpd how to recognize that an address is on -that subnet. A \fIsubnet\fR declaration is required for each subnet -even if no addresses will be dynamically allocated on that subnet. -.PP -Some installations have physical networks on which more than one IP -subnet operates. For example, if there is a site-wide requirement -that 8-bit subnet masks be used, but a department with a single -physical ethernet network expands to the point where it has more than -254 nodes, it may be necessary to run two 8-bit subnets on the same -ethernet until such time as a new physical network can be added. In -this case, the \fIsubnet\fR declarations for these two networks may be -enclosed in a \fIshared-network\fR declaration. -.PP -Some sites may have departments which have clients on more than one -subnet, but it may be desirable to offer those clients a uniform set -of parameters which are different than what would be offered to -clients from other departments on the same subnet. For clients which -will be declared explicitly with \fIhost\fR declarations, these -declarations can be enclosed in a \fIgroup\fR declaration along with -the parameters which are common to that department. For clients -whose addresses will be dynamically assigned, there is currently no -way to group parameter assignments other than by network topology. -.PP -When a client is to be booted, its boot parameters are determined by -first consulting that client's \fIhost\fR declaration (if any), then -consulting the \fIgroup\fR declaration (if any) which enclosed that -\fIhost\fR declaration, then consulting the \fIsubnet\fR declaration -for the subnet on which the client is booting, then consulting the -\fIshared-network\fR declaration (if any) containing that subnet, and -finally consulting the top-level parameters which may be specified -outside of any declaration. -.PP -When dhcpd tries to find a \fIhost\fR declaration for a client, it -first looks for a \fIhost\fR declaration which has a -\fIfixed-address\fR parameter which matches the subnet or shared -network on which the client is booting. If it doesn't find any such -entry, it then tries to find an entry which has no \fIfixed-address\fR -parameter. If no such entry is found, then dhcpd acts as if there is -no entry in the dhcpd.conf file for that client, even if there is an -entry for that client on a different subnet or shared network. -.SH EXAMPLES -.PP -A typical dhcpd.conf file will look something like this: -.nf - -server-identifier dhcps.isc.org; -.I global parameters... - -shared-network ISC-BIGGIE { - \fIshared-network-specific parameters...\fR - subnet 204.254.239.0 netmask 255.255.255.224 { - \fIsubnet-specific parameters...\fR - range 204.254.239.10 204.254.239.30; - } - subnet 204.254.239.32 netmask 255.255.255.224 { - \fIsubnet-specific parameters...\fR - range 204.254.239.42 204.254.239.62; - } -} - -subnet 204.254.239.64 netmask 255.255.255.224 { - \fIsubnet-specific parameters...\fR - range 204.254.239.74 204.254.239.94; -} - -group { - \fIgroup-specific parameters...\fR - host zappo.test.isc.org { - \fIhost-specific parameters...\fR - } - host beppo.test.isc.org { - \fIhost-specific parameters...\fR - } - host harpo.test.isc.org { - \fIhost-specific parameters...\fR - } -} - -.ce 1 -Figure 1 - -.fi -.PP -Notice that after the server-identifier declaration, there's a place -for global parameters. These might be things like the organization's -domain name, the addresses of the name servers (if they are common to -the entire organization), and so on. So, for example: -.nf - - option domain-name "isc.org"; - option name-servers ns1.isc.org, ns2.isc.org; - -.ce 1 -Figure 2 -.fi -.PP -As you can see in Figure 2, it's legal to specify host addresses in -parameters as domain names rather than as numeric IP addresses. If a -given hostname resolves to more than one IP address (for example, if -that host has two ethernet interfaces), both addresses are supplied to -the client. -.PP -In Figure 1, you can see that both the shared-network statement and -the subnet statements can have parameters. Let us say that the -shared network \fIISC-BIGGIE\fR supports an entire department - -perhaps the accounting department. If accounting has its own domain, -then a shared-network-specific parameter might be: -.nf - - option domain-name "accounting.isc.org"; -.fi -.PP -All subnet declarations appearing in the shared-network declaration -would then have the domain-name option set to "accounting.isc.org" -instead of just "isc.org". -.PP -The most obvious reason for having subnet-specific parameters as -shown in Figure 1 is that each subnet, of necessity, has its own -router. So for the first subnet, for example, there should be -something like: -.nf - - option routers 204.254.239.1; -.fi -.PP -Note that the address here is specified numerically. This is not -required - if you have a different domain name for each interface on -your router, it's perfectly legitimate to use the domain name for that -interface instead of the numeric address. However, in many cases -there may be only one domain name for all of a router's IP addresses, and -it would not be appropriate to use that name here. -.PP -In Figure 1 there is also a \fIgroup\fR statement, which provides -common parameters for a set of three hosts - zappo, beppo and harpo. -As you can see, these hosts are all in the test.isc.org domain, so it -might make sense for a group-specific parameter to override the domain -name supplied to these hosts: -.nf - - option domain-name "test.isc.org"; -.fi -.PP -Also, given the domain they're in, these are probably test machines. -If we wanted to test the DHCP leasing mechanism, we might set the -lease timeout somewhat shorter than the default: - -.nf - max-lease-time 120; - default-lease-time 120; -.fi -.PP -You may have noticed that while some parameters start with the -\fIoption\fR keyword, some do not. Parameters starting with the -\fIoption\fR keyword correspond to actual DHCP options, while -parameters that do not start with the option keyword either control -the behaviour of the DHCP server (e.g., how long a lease dhcpd will -give out), or specify client parameters that are not optional in the -DHCP protocol (for example, server-name and filename). -.PP -In Figure 1, each host had \fIhost-specific parameters\fR. These -could include such things as the \fIhostname\fR option, the name of a -file to upload (the \fIfilename parameter) and the address of the -server from which to upload the file (the \fInext-server\fR -parameter). In general, any parameter can appear anywhere that -parameters are allowed, and will be applied according to the scope in -which the parameter appears. -.PP -Imagine that you have a site with a lot of NCD X-Terminals. These -terminals come in a variety of models, and you want to specify the -boot files for each models. One way to do this would be to have host -declarations for each server and group them by model: -.nf - -group { - filename "Xncd19r"; - next-server ncd-booter; - - host ncd1 { hardware ethernet 0:c0:c3:49:2b:57; } - host ncd4 { hardware ethernet 0:c0:c3:80:fc:32; } - host ncd8 { hardware ethernet 0:c0:c3:22:46:81; } -} - -group { - filename "Xncd19c"; - next-server ncd-booter; - - host ncd2 { hardware ethernet 0:c0:c3:88:2d:81; } - host ncd3 { hardware ethernet 0:c0:c3:00:14:11; } -} - -group { - filename "XncdHMX"; - next-server ncd-booter; - - host ncd1 { hardware ethernet 0:c0:c3:11:90:23; } - host ncd4 { hardware ethernet 0:c0:c3:91:a7:8; } - host ncd8 { hardware ethernet 0:c0:c3:cc:a:8f; } -} -.fi -.SH REFERENCE: DECLARATIONS -.PP -.B The -.I server-identifier -.B statement -.PP - \fBserver-identifier \fIhostname\fR\fB;\fR -.PP -The server-identifier declaration must be used exactly once in each -dhcpd.conf file to tell dhcpd what IP address to use as its server -identifier, as required by the DHCP protocol. On a machine with a -single interface, the server identifier should be the primary address -of that interface. On machines with multiple interfaces, the address -of one such interface must be chosen. Any address may be chosen, as -long as it is the address of one of the interfaces of that machine. -.PP -.B The -.I shared-network -.B statement -.PP -.nf - \fBshared-network\fR \fIname\fR \fB{\fR - [ \fIparameters\fR ] - [ \fIdeclarations\fR ] - \fB}\fR -.fi -.PP -The \fIshared-network\fR statement is used to inform the DHCP server -that some IP subnets actually share the same physical network. Any -subnets in a shared network should be declared within a -\fIshared-network\fR statement. Parameters specified in the -\fIshared-network\fR statement will be used when booting clients on -those subnets unless parameters provided at the subnet or host level -override them. If any subnet in a shared network has addresses -available for dynamic allocation, those addresses are collected into a -common pool for that shared network and assigned to clients as needed. -There is no way to distinguish on which subnet of a shared network a -client should boot. -.PP -.I Name -should be the name of the shared network. This name is used when -printing debugging messages, so it should be descriptive for the -shared network. The name may have the syntax of a valid domain name -(although it will never be used as such), or it may be any arbitrary -name, enclosed in quotes. -.PP -.B The -.I subnet -.B statement -.PP -.nf - \fBsubnet\fR \fIsubnet-number\fR \fBnetmask\fR \fInetmask\fR \fB{\fR - [ \fIparameters\fR ] - [ \fIdeclarations\fR ] - \fB}\fR -.fi -.PP -The \fIsubnet\fR statement is used to provide dhcpd with enough -information to tell whether or not an IP address is on that subnet. -It may also be used to provide subnet-specific parameters and to -specify what addresses may be dynamically allocated to clients booting -on that subnet. Such addresses are specified using the \fIrange\fR -declaration. -.PP -The -.I subnet-number -should be an IP address or domain name which resolves to the subnet -number of the subnet being described. The -.I netmask -should be an IP address or domain name which resolves to the subnet mask -of the subnet being described. The subnet number, together with the -netmask, are sufficient to determine whether any given IP address is -on the specified subnet. -.PP -Although a netmask must be given with every subnet declaration, it is -recommended that if there is any variance in subnet masks at a site, a -subnet-mask option statement be used in each subnet declaration to set -the desired subnet mask, since any subnet-mask option statement will -override the subnet mask declared in the subnet statement. -.PP -.B The -.I range -.B statement -.PP -.nf - \fBrange\fR [ \fBdynamic-bootp\fR ] \fIlow-address\fR [ \fIhigh-address\fR]\fB;\fR -.fi -.PP -For any subnet on which addresses will be assigned dynamically, there -must be at least one \fIrange\fR statement. The range statement -gives the lowest and highest IP addresses in a range. All IP -addresses in the range should be in the subnet in which the -\fIrange\fR statement is declared. The \fIdynamic-bootp\fR flag may -be specified if addresses in the specified range may be dynamically -assigned to BOOTP clients as well as DHCP clients. When specifying a -single address, \fIhigh-address\fR can be omitted. -.PP -.B The -.I host -.B statement -.PP -.nf - \fBhost\fR \fIhostname\fR { - [ \fIparameters\fR ] - [ \fIdeclarations\fR ] - \fB}\fR -.fi -.PP -There must be at least one -.B host -statement for every BOOTP client that is to be served. -.B host -statements may also be specified for DHCP clients, although this is -not required unless booting is only enabled for known hosts. -.PP -If it is desirable to be able to boot a DHCP or BOOTP -client on more than one subnet with fixed addresses, more than one -address may be specified in the -.I fixed-address -parameter, or more than one -.B host -statement may be specified. -.PP -If client-specific boot parameters must change based on the network -to which the client is attached, then multiple -.B host -statements should -be used. -.PP -If a client is to be booted using a fixed address if it's -possible, but should be allocated a dynamic address otherwise, then a -.B host -statement must be specified without a -.B fixed-address -clause. -.I hostname -should be a name identifying the host. If a \fIhostname\fR option is -not specified for the host, \fIhostname\fR is used. -.PP -\fIHost\fR declarations are matched to actual DHCP or BOOTP clients -by matching the \fRdhcp-client-identifier\fR option specified in the -\fIhost\fR declaration to the one supplied by the client, or, if the -\fIhost\fR declaration or the client does not provide a -\fRdhcp-client-identifier\fR option, by matching the \fIhardware\fR -parameter in the \fIhost\fR declaration to the network hardware -address supplied by the client. BOOTP clients do not normally -provide a \fIdhcp-client-identifier\fR, so the hardware address must -be used for all clients that may boot using the BOOTP protocol. -.PP -.B The -.I group -.B statement -.PP -.nf - \fBgroup\fR { - [ \fIparameters\fR ] - [ \fIdeclarations\fR ] - \fB}\fR -.fi -.PP -The group statement is used simply to apply one or more parameters to -a group of declarations. It can be used to group hosts, shared -networks, subnets, or even other groups. -.SH REFERENCE: ALLOW and DENY -.PP -The -.I allow -and -.I deny -statements can be used to control the behaviour of dhcpd to various -sorts of requests. -.PP -.PP -.B The -.I unknown-clients -.B keyword -.PP - \fBallow unknown-clients;\fR - \fBdeny unknown-clients;\fR -.PP -The \fBunknown-clients\fR flag is used to tell dhcpd whether -or not to dynamically assign addresses to unknown clients. Dynamic -address assignment to unknown clients is \fBallow\fRed by default. -.PP -.B The -.I bootp -.B keyword -.PP - \fBallow bootp;\fR - \fBdeny bootp;\fR -.PP -The \fBunknown-clients\fR flag is used to tell dhcpd whether -or not to respond to bootp queries. Bootp queries are \fBallow\fRed -by default. -.PP -.B The -.I booting -.B keyword -.PP - \fBallow booting;\fR - \fBdeny booting;\fR -.PP -The \fBbooting\fR flag is used to tell dhcpd whether or not to respond -to queries from a particular client. This keyword only has meaning -when it appears in a host declaration. By default, booting is -\fBallow\fRed, but if it is disabled for a particular client, then -that client will not be able to get and address from the DHCP server. -.SH REFERENCE: PARAMETERS -.PP -.B The -.I default-lease-time -.B statement -.PP - \fBdefault-lease-time\fR \fItime\fR\fB;\fR -.PP -.I Time -should be the length in seconds that will be assigned to a lease if -the client requesting the lease does not ask for a specific expiration -time. -.PP -.B The -.I max-lease-time -.B statement -.PP - \fBmax-lease-time\fR \fItime\fR\fB;\fR -.PP -.I Time -should be the maximum length in seconds that will be assigned to a -lease if the client requesting the lease asks for a specific -expiration time. -.PP -.B The -.I hardware -.B statement -.PP - \fBhardware\fR \fIhardware-type\fR \fIhardware-address\fR\fB;\fR -.PP -In order for a BOOTP client to be recognized, its network hardware -address must be declared using a \fIhardware\fR clause in the -.I host -statement. -.I hardware-type -must be the name of a physical hardware interface type. Currently, -only the -.B ethernet -type is recognized, although support for -.B token-ring -and -.B fddi -hardware types would also be desirable. -The -.I hardware-address -should be a set of hexadecimal octets (numbers from 0 through ff) -seperated by colons. The \fIhardwarefR statement may also be used -for DHCP clients. -.PP -.B The -.I filename -.B statement -.PP - \fBfilename\fR \fB"\fR\fIfilename\fR\fB";\fR -.PP -The \fIfilename\fR statement can be used to specify the name of the -initial boot file which is to be loaded by a client. The -.I filename -should be a filename recognizable to whatever file transfer protocol -the client can be expected to use to load the file. -.PP -.B The -.I server-name -.B statement -.PP - \fBserver-name\fR \fB"\fR\fIname\fR\fB";\fR -.PP -The \fIserver-name\fR statement can be used to inform the client of -the name of the server from which it is booting. \fIName\fR should -be the name that will be provided to the client. -.PP -.B The -.I next-server -.B statement -.PP - \fBnext-server\fR \fIserver-name\fR\fB;\fR -.PP -The \fInext-server\fR statement is used to specify the host address of -the server from which the initial boot file (specified in the -\fIfilename\fR statement) is to be loaded. \fIServer-name\fR should -be a numeric IP address or a domain name. If no \fInext-server\fR -parameter applies to a given client, the address specified in the -\fIserver-identifier\fR statement is used. -.PP -.B The -.I fixed-address -.B statement -.PP - \fBfixed-address\fR \fIaddress\fR [\fB,\fR \fIaddress\fR ... ]\fB;\fR -.PP -The \fIfixed-address\fR statement is used to assign one or more fixed -IP addresses to a client. It should only appear in a \fIhost\fR -declaration. If more than one address is supplied, then when the -client boots, it will be assigned the address which corresponds to the -network on which it is booting. If none of the addresses in the -\fIfixed-address\fR statement are on the network on which the client -is booting, that client will not match the \fIhost\fR declaration -containing that \fIfixed-address\fR statement. Each \fIaddress\fR -should be either an IP address or a domain name which resolves to one -or more IP addresses. -.PP -.B The -.I dynamic-bootp-lease-cutoff -.B statement -.PP - \fBdynamic-bootp-lease-cutoff\fR \fIdate\fR\fB;\fR -.PP -The \fIdynamic-bootp-lease-cutoff\fR statement sets the ending time -for all leases assigned dynamically to BOOTP clients. Because BOOTP -clients do not have any way of renewing leases, and don't know that -their leases could expire, by default dhcpd assignes infinite leases -to all BOOTP clients. However, it may make sense in some situations -to set a cutoff date for all BOOTP leases - for example, the end of a -school term, or the time at night when a facility is closed and all -machines are required to be powered off. -.PP -.I Date -should be the date on which all assigned BOOTP leases will end. The -date is specified in the form: -.PP -.ce 1 -W YYYY/MM/DD HH:MM:SS -.PP -W is the day of the week expressed as a number -from zero (Sunday) to six (Saturday). YYYY is the year, including the -century. MM is the month expressed as a number from 1 to 12. DD is -the day of the month, counting from 1. HH is the hour, from zero to -23. MM is the minute and SS is the second. The time is always in -Greenwich Mean Time (GMT), not local time. -.PP -.B The -.I dynamic-bootp-lease-length -.B statement -.PP - \fBdynamic-bootp-lease-length\fR \fIlength\fR\fB;\fR -.PP -The \fIdynamic-bootp-lease-length\fR statement is used to set the -length of leases dynamically assigned to BOOTP clients. At some -sites, it may be possible to assume that a lease is no longer in -use if its holder has not used BOOTP or DHCP to get its address within -a certain time period. The period is specified in \fIlength\fR as a -number of seconds. If a client reboots using BOOTP during the -timeout period, the lease duration is reset to \fIlength\fR, so a -BOOTP client that boots frequently enough will never lose its lease. -Needless to say, this parameter should be adjusted with extreme -caution. -.PP -.B The -.I get-lease-hostnames -.B statement -.PP - \fBget-lease-hostnames\fR \fIflag\fR\fB;\fR -.PP -The \fIget-lease-hostnames\fR statement is used to tell dhcpd whether -or not to look up the domain name corresponding to the IP address of -each address in the lease pool and use that address for the DHCP -\fIhostname\fR option. If \fIflag\fR is true, then this lookup is -done for all addresses in the current scope. By default, or if -\fIflag\fR is false, no lookups are done. -.PP -.B The -.I use-host-decl-names -.B statement -.PP - \fBuse-host-decl-names\fR \fIflag\fR\fB;\fR -.PP -If the \fIuse-host-decl-names\fR parameter is true in a given scope, -then for every host declaration within that scope, the name provided -for the host declaration will be supplied to the client as its -hostname. So, for example, -.PP -.nf - group { - use-host-decl-names on; - - host joe { - hardware ethernet 08:00:2b:4c:29:32; - fixed-address joe.fugue.com; - } - } - -is equivalent to - - host joe { - hardware ethernet 08:00:2b:4c:29:32; - fixed-address joe.fugue.com; - option host-name "joe"; - } -.fi -.PP -An \fIoption host-name\fR statement within a host declaration will -override the use of the name in the host declaration. -.SH REFERENCE: OPTION STATEMENTS -.PP -DHCP \fIoption\fR statements always start with the \fIoption\fR -keyword, followed by an option name, followed by option data. The -option names and data formats are described below. It is not -necessary to exhaustively specify all DHCP options - only those -options which are needed by clients must be specified. -.PP -Option data comes in a variety of formats, as defined below: -.PP -The -.B ip-address -data type can be entered either as an explicit IP -address (e.g., 239.254.197.10) or as a domain name (e.g., -haagen.isc.org). When entering a domain name, be sure that that -domain name resolves to a single IP address. -.PP -The -.B int32 -data type specifies a signed 32-bit integer. The -.B uint32 -data type specifies an unsigned 32-bit integer. The -.B int16 -and -.B uint16 -data types specify signed and unsigned 16-bit integers. The -.B int8 -and -.B uint8 -data types specify signed and unsigned 8-bit integers. -Unsigned 8-bit integers are also sometimes referred to as octets. -.PP -The -.B string -data type specifies an NVT ASCII string, which must be -enclosed in double quotes - for example, to specify a domain-name -option, the syntax would be -.nf -.sp 1 - option domain-name "isc.org"; -.fi -.PP -The -.B flag -data type specifies a boolean value. Booleans can be either true or -false (or on or off, if that makes more sense to you). -.PP -The -.B data-string -data type specifies either an NVT ASCII string -enclosed in double quotes, or a series of octets specified in -hexadecimal, seperated by colons. For example: -.nf -.sp 1 - option client-identifier "CLIENT-FOO"; -or - option client-identifier 43:4c:49:45:54:2d:46:4f:4f; -.fi -.PP -The documentation for the various options mentioned below is taken -from the latest IETF draft document on DHCP options. Options which -are not listed by name may be defined by the name option-\fInnn\fR, -where \fInnn\fI is the decimal number of the option code. These -options may be followed either by a string, enclosed in quotes, or by -a series of octets, expressed as two-digit hexadecimal numbers seperated -by colons. For example: -.PP -.nf - option option-133 "my-option-133-text"; - option option-129 1:54:c9:2b:47; -.fi -.PP -Because dhcpd does not know the format of these undefined option codes, -no checking is done to ensure the correctness of the entered data. -.PP -The standard options are: -.PP - \fBoption subnet-mask\fR \fIip-address\fR\fB;\fR -.PP -The subnet mask option specifies the client's subnet mask as per RFC -950. If no subnet mask option is provided anywhere in scope, as a -last resort dhcpd will use the subnet mask from the subnet declaration -for the network on which an address is being assigned. However, -.I any -subnet-mask option declaration that is in scope for the address being -assigned will override the subnet mask specified in the subnet -declaration. -.PP - \fBoption time-offset\fR \fIint32\fR\fB;\fR -.PP -The time-offset option specifies the offset of the client's subnet in -seconds from Coordinated Universal Time (UTC). -.PP - \fBoption routers\fR \fIip-address\fR [\fB,\fR \fIip-address\fR ... ]\fB;\fR -.PP -The routers option specifies a list of IP addresses for routers on the -client's subnet. Routers should be listed in order of preference. -.PP - \fBoption time-servers\fR \fIip-address [, \fIip-address\fR ... ]\fB;\fR -.PP -The time-server option specifies a list of RFC 868 time servers -available to the client. Servers should be listed in order of -preference. -.PP - \fBoption\fR \fBname-servers\fR \fIip-address\fR [\fB,\fR \fIip-address\fR ... ]; -.PP -The name-servers option specifies a list of IEN 116 name servers -available to the client. Servers should be listed in order of -preference. -.PP - \fBoption\fR \fBdomain-name-servers\fR \fIip-address\fR [\fB,\fR \fIip-address\fR ... ]\fB;\fR -.PP -The domain-name-servers option specifies a list of Domain Name System -(STD 13, RFC 1035) name servers available to the client. Servers -should be listed in order of preference. -.PP - \fBoption\fR \fBlog-servers\fR \fIip-address\fR [\fB,\fR \fIip-address\fR ... ]\fB;\fR -.PP -The log-server option specifies a list of MIT-LCS UDP log servers -available to the client. Servers should be listed in order of -preference. -.PP - \fBoption\fR \fBcookie-servers\fR \fIip-address\fR [\fB,\fR \fIip-address\fR ... ]\fB;\fR -.PP -The cookie server option specifies a list of RFC 865 cookie -servers available to the client. Servers should be listed in order -of preference. -.PP - \fBoption\fR \fBlpr-servers\fR \fIip-address \fR [\fB,\fR \fIip-address\fR ... ]\fB;\fR -.PP -The LPR server option specifies a list of RFC 1179 line printer -servers available to the client. Servers should be listed in order -of preference. -.PP - \fBoption\fR \fBimpress-servers\fR \fIip-address\fR [\fB,\fR \fIip-address\fR ... ]\fB;\fR -.PP -The impress-server option specifies a list of Imagen Impress servers -available to the client. Servers should be listed in order of -preference. -.PP - \fBoption\fR \fBresource-location-servers\fR \fIip-address\fR [\fB,\fR \fIip-address\fR ... ]\fB;\fR -.PP -This option specifies a list of RFC 887 Resource Location -servers available to the client. Servers should be listed in order -of preference. -.PP - \fBoption\fR \fBhost-name\fR \fIstring\fR\fB;\fR -.PP -This option specifies the name of the client. The name may or may -not be qualified with the local domain name (it is preferable to use -the domain-name option to specify the domain name). See RFC 1035 for -character set restrictions. -.PP - \fBoption\fR \fBboot-size\fR \fIuint16\fR\fB;\fR -.PP -This option specifies the length in 512-octet blocks of the default -boot image for the client. -.PP - \fBoption\fR \fBmerit-dump\fR \fIstring\fR\fB;\fR -.PP -This option specifies the path-name of a file to which the client's -core image should be dumped in the event the client crashes. The -path is formatted as a character string consisting of characters from -the NVT ASCII character set. -.PP - \fBoption\fR \fBdomain-name\fR \fIstring\fR\fB;\fR -.PP -This option specifies the domain name that client should use when -resolving hostnames via the Domain Name System. -.PP - \fBoption\fR \fBswap-server\fR \fIip-address\fR\fB;\fR -.PP -This specifies the IP address of the client's swap server. -.PP - \fBoption\fR \fBroot-path\fR \fIstring\fB;\fR\fR -.PP -This option specifies the path-name that contains the client's root -disk. The path is formatted as a character string consisting of -characters from the NVT ASCII character set. -.PP - \fBoption\fR \fBip-forwarding\fR \fIflag\fR\fB;\fR -.PP -This option specifies whether the client should configure its IP -layer for packet forwarding. A value of 0 means disable IP -forwarding, and a value of 1 means enable IP forwarding. -.PP - \fBoption\fR \fBnon-local-source-routing\fR \fIflag\fR\fB;\fR -.PP -This option specifies whether the client should configure its IP -layer to allow forwarding of datagrams with non-local source routes -(see Section 3.3.5 of [4] for a discussion of this topic). A value -of 0 means disallow forwarding of such datagrams, and a value of 1 -means allow forwarding. -.PP - \fBoption\fR \fBpolicy-filter\fR \fIip-address ip-address\fR [\fB,\fR \fIip-address ip-address\fR ... ]\fB;\fR -.PP -This option specifies policy filters for non-local source routing. -The filters consist of a list of IP addresses and masks which specify -destination/mask pairs with which to filter incoming source routes. -.PP -Any source routed datagram whose next-hop address does not match one -of the filters should be discarded by the client. -.PP -See STD 3 (RFC1122) for further information. -.PP - \fBoption\fR \fBmax-dgram-reassembly\fR \fIuint16\fR\fB;\fR -.PP -This option specifies the maximum size datagram that the client -should be prepared to reassemble. The minimum value legal value is -576. -.PP - \fBoption\fR \fBdefault-ip-ttl\fR \fIuint8;\fR -.PP -This option specifies the default time-to-live that the client should -use on outgoing datagrams. -.PP - \fBoption\fR \fBpath-mtu-aging-timeout\fR \fIuint32\fR\fB;\fR -.PP -This option specifies the timeout (in seconds) to use when aging Path -MTU values discovered by the mechanism defined in RFC 1191. -.PP - \fBoption\fR \fBpath-mtu-plateau-table\fR \fIuint16\fR [\fB,\fR \fIuint16\fR ... ]\fB;\fR -.PP -This option specifies a table of MTU sizes to use when performing -Path MTU Discovery as defined in RFC 1191. The table is formatted as -a list of 16-bit unsigned integers, ordered from smallest to largest. -The minimum MTU value cannot be smaller than 68. -.PP - \fBoption\fR \fBinterface-mtu\fR \fIuint16\fR\fB;\fR -.PP -This option specifies the MTU to use on this interface. The minimum -legal value for the MTU is 68. -.PP - \fBoption\fR \fBall-subnets-local\fR \fIflag\fR\fB;\fR -.PP -This option specifies whether or not the client may assume that all -subnets of the IP network to which the client is connected use the -same MTU as the subnet of that network to which the client is -directly connected. A value of 1 indicates that all subnets share -the same MTU. A value of 0 means that the client should assume that -some subnets of the directly connected network may have smaller MTUs. -.PP - \fBoption\fR \fBbroadcast-address\fR \fIip-address\fR\fB;\fR -.PP -This option specifies the broadcast address in use on the client's -subnet. Legal values for broadcast addresses are specified in -section 3.2.1.3 of STD 3 (RFC1122). -.PP - \fBoption\fR \fBperform-mask-discovery\fR \fIflag\fR\fB;\fR -.PP -This option specifies whether or not the client should perform subnet -mask discovery using ICMP. A value of 0 indicates that the client -should not perform mask discovery. A value of 1 means that the -client should perform mask discovery. -.PP - \fBoption\fR \fBmask-supplier\fR \fIflag\fR\fB;\fR -.PP -This option specifies whether or not the client should respond to -subnet mask requests using ICMP. A value of 0 indicates that the -client should not respond. A value of 1 means that the client should -respond. -.PP - \fBoption\fR \fBrouter-discovery\fR \fIflag\fR\fB;\fR -.PP -This option specifies whether or not the client should solicit -routers using the Router Discovery mechanism defined in RFC 1256. -A value of 0 indicates that the client should not perform -router discovery. A value of 1 means that the client should perform -router discovery. -.PP - \fBoption\fR \fBrouter-solicitation-address\fR \fIip-address\fR\fB;\fR -.PP -This option specifies the address to which the client should transmit -router solicitation requests. -.PP - \fBoption\fR \fBstatic-routes\fR \fIip-address ip-address\fR [\fB,\fR \fIip-address ip-address\fR ... ]\fB;\fR -.PP -This option specifies a list of static routes that the client should -install in its routing cache. If multiple routes to the same -destination are specified, they are listed in descending order of -priority. -.PP -The routes consist of a list of IP address pairs. The first address -is the destination address, and the second address is the router for -the destination. -.PP -The default route (0.0.0.0) is an illegal destination for a static -route. To specify the default route, use the -.B routers -option. -.PP - \fBoption\fR \fBtrailer-encapsulation\fR \fIflag\fR\fB;\fR -.PP -This option specifies whether or not the client should negotiate the -use of trailers (RFC 893 [14]) when using the ARP protocol. A value -of 0 indicates that the client should not attempt to use trailers. A -value of 1 means that the client should attempt to use trailers. -.PP - \fBoption\fR \fBarp-cache-timeout\fR \fIuint32\fR\fB;\fR -.PP -This option specifies the timeout in seconds for ARP cache entries. -.PP - \fBoption\fR \fBieee802-3-encapsulation\fR \fIflag\fR\fB;\fR -.PP -This option specifies whether or not the client should use Ethernet -Version 2 (RFC 894) or IEEE 802.3 (RFC 1042) encapsulation if the -interface is an Ethernet. A value of 0 indicates that the client -should use RFC 894 encapsulation. A value of 1 means that the client -should use RFC 1042 encapsulation. -.PP - \fBoption\fR \fBdefault-tcp-ttl\fR \fIuint8\fR\fB;\fR -.PP -This option specifies the default TTL that the client should use when -sending TCP segments. The minimum value is 1. -.PP - \fBoption\fR \fBtcp-keepalive-interval\fR \fIuint32\fR\fB;\fR -.PP -This option specifies the interval (in seconds) that the client TCP -should wait before sending a keepalive message on a TCP connection. -The time is specified as a 32-bit unsigned integer. A value of zero -indicates that the client should not generate keepalive messages on -connections unless specifically requested by an application. -.PP - \fBoption\fR \fBtcp-keepalive-garbage\fR \fIflag\fR\fB;\fR -.PP -This option specifies the whether or not the client should send TCP -keepalive messages with a octet of garbage for compatibility with -older implementations. A value of 0 indicates that a garbage octet -should not be sent. A value of 1 indicates that a garbage octet -should be sent. -.PP - \fBoption\fR \fBnis-domain\fR \fIstring\fR\fB;\fR -.PP -This option specifies the name of the client's NIS (Sun Network -Information Services) domain. The domain is formatted as a character -string consisting of characters from the NVT ASCII character set. -.PP - \fBoption\fR \fBnis-servers\fR \fIip-address\fR [\fB,\fR \fIip-address\fR ... ]\fB;\fR -.PP -This option specifies a list of IP addresses indicating NIS servers -available to the client. Servers should be listed in order of -preference. -.PP - \fBoption\fR \fBntp-servers\fR \fIip-address\fR [\fB,\fR \fIip-address\fR ... ]\fB;\fR -.PP -This option specifies a list of IP addresses indicating NTP (RFC 1035) -servers available to the client. Servers should be listed in order -of preference. -.PP - \fBoption\fR \fBnetbios-name-servers\fR \fIip-address\fR [\fB,\fR \fIip-address\fR ... ]\fB;\fR -.PP -The NetBIOS name server (NBNS) option specifies a list of RFC -1001/1002 NBNS name servers listed in order of preference. -.PP - \fBoption\fR \fBnetbios-dd-server\fR \fIip-address\fR [\fB,\fR \fIip-address\fR ... ]\fB;\fR -.PP -The NetBIOS datagram distribution server (NBDD) option specifies a -list of RFC 1001/1002 NBDD servers listed in order of preference. -.PP - \fBoption\fR \fBnetbios-node-type\fR \fIuint8\fR\fB;\fR -.PP -The NetBIOS node type option allows NetBIOS over TCP/IP clients which -are configurable to be configured as described in RFC 1001/1002. The -value is specified as a single octet which identifies the client type. -A value of 1 corresponds to a NetBIOS B-node; a value of 2 corresponds -to a P-node; a value of 4 corresponds to an M-node; a value of 8 -corresponds to an H-node. -.PP - \fBoption\fR \fBnetbios-scope\fR \fIstring\fR\fB;\fR -.PP -The NetBIOS scope option specifies the NetBIOS over TCP/IP scope -parameter for the client as specified in RFC 1001/1002. See RFC1001, -RFC1002, and RFC1035 for character-set restrictions. -.PP - \fBoption\fR \fBfont-servers\fR \fIip-address\fR [\fB,\fR \fIip-address\fR ... ]\fB;\fR -.PP -This option specifies a list of X Window System Font servers available -to the client. Servers should be listed in order of preference. -.PP - \fBoption\fR \fBx-display-manager\fR \fIip-address\fR [\fB,\fR \fIip-address\fR ... ]\fB;\fR -.PP -This option specifies a list of systems that are running the X Window -System Display Manager and are available to the client. Addresses -should be listed in order of preference. -.PP - \fBoption\fR \fBdhcp-client-identifier\fR \fIdata-string\fR\fB;\fR -.PP -This option can be used to specify the a DHCP client identifier in a -host declaration, so that dhcpd can find the host record by matching -against the client identifier. -.SH SEE ALSO -dhcpd.conf(5), dhcpd.leases(5), -draft-ietf-dhc-options-1533update-04.txt, draft-ietf-dhc-dhcp-07.txt. -.SH AUTHOR -.B dhcpd(8) -was written by Ted Lemon -under a contract with Vixie Labs. Funding -for this project was provided by the Internet Software Corporation. -Information about the Internet Software Consortium can be found at -.B http://www.isc.org/isc. diff --git a/dhcpd.conf.cat5 b/dhcpd.conf.cat5 deleted file mode 100644 index ddbe2fbc..00000000 --- a/dhcpd.conf.cat5 +++ /dev/null @@ -1,1254 +0,0 @@ - - - -dhcpd.conf(5) dhcpd.conf(5) - - -NNAAMMEE - dhcpd.conf - dhcpd configuration file - -DDEESSCCRRIIPPTTIIOONN - The dhcpd.conf file contains configuration information for - _d_h_c_p_d_, the Internet Software Consortium DHCP Server. - - The dhcpd.conf file is a free-form ASCII text file. It - is parsed by the recursive-descent parser built into - dhcpd. The file may contain extra tabs and newlines for - formatting purposes. Keywords in the file are case-insen- - sitive. Comments may be placed anywhere within the file - (except within quotes). Comments begin with the # char- - acter and end at the end of the line. - - The file essentially consists of a list of statements. - Statements fall into two broad categories - parameters and - declarations. - - Parameter statements either say how to do something (e.g., - how long a lease to offer), whether to do something (e.g., - should dhcpd provide addresses to unknown clients), or - what parameters to provide to the client (e.g., use gate- - way 220.177.244.7). - - Declarations are used to describe the topology of the net- - work, to describe clients on the network, to provide - addresses that can be assigned to clients, or to apply a - group of parameters to a group of declarations. In any - group of parameters and declarations, all parameters must - be specified before any declarations which depend on those - parameters may be specified. - - Declarations about network topology include the _s_e_r_v_e_r_- - _i_d_e_n_t_i_f_i_e_r, the _s_h_a_r_e_d_-_n_e_t_w_o_r_k and the _s_u_b_n_e_t declara- - tions. If clients on a subnet are to be assigned - addresses dynamically, a _r_a_n_g_e declaration must appear - within the _s_u_b_n_e_t declaration. For clients with stati- - cally assigned addresses, or for installations where only - known clients will be served, each such client must have a - _h_o_s_t declaration. If parameters are to be applied to a - group of declarations which are not related strictly on a - per-subnet basis, the _g_r_o_u_p declaration can be used. - - Each dhcpd.conf file must have one (and only one) _s_e_r_v_e_r_- - _i_d_e_n_t_i_f_i_e_r declaration, which tells dhcpd the identifier - to use when issuing leases. For every subnet which will - be served, and for every subnet to which the dhcp server - is connected, there must be one _s_u_b_n_e_t declaration, which - tells dhcpd how to recognize that an address is on that - subnet. A _s_u_b_n_e_t declaration is required for each subnet - even if no addresses will be dynamically allocated on that - subnet. - - - - - 1 - - - - - -dhcpd.conf(5) dhcpd.conf(5) - - - Some installations have physical networks on which more - than one IP subnet operates. For example, if there is a - site-wide requirement that 8-bit subnet masks be used, but - a department with a single physical ethernet network - expands to the point where it has more than 254 nodes, it - may be necessary to run two 8-bit subnets on the same eth- - ernet until such time as a new physical network can be - added. In this case, the _s_u_b_n_e_t declarations for these - two networks may be enclosed in a _s_h_a_r_e_d_-_n_e_t_w_o_r_k declara- - tion. - - Some sites may have departments which have clients on more - than one subnet, but it may be desirable to offer those - clients a uniform set of parameters which are different - than what would be offered to clients from other depart- - ments on the same subnet. For clients which will be - declared explicitly with _h_o_s_t declarations, these declara- - tions can be enclosed in a _g_r_o_u_p declaration along with - the parameters which are common to that department. For - clients whose addresses will be dynamically assigned, - there is currently no way to group parameter assignments - other than by network topology. - - When a client is to be booted, its boot parameters are - determined by first consulting that client's _h_o_s_t declara- - tion (if any), then consulting the _g_r_o_u_p declaration (if - any) which enclosed that _h_o_s_t declaration, then consulting - the _s_u_b_n_e_t declaration for the subnet on which the client - is booting, then consulting the _s_h_a_r_e_d_-_n_e_t_w_o_r_k declaration - (if any) containing that subnet, and finally consulting - the top-level parameters which may be specified outside of - any declaration. - - When dhcpd tries to find a _h_o_s_t declaration for a client, - it first looks for a _h_o_s_t declaration which has a _f_i_x_e_d_- - _a_d_d_r_e_s_s parameter which matches the subnet or shared net- - work on which the client is booting. If it doesn't find - any such entry, it then tries to find an entry which has - no _f_i_x_e_d_-_a_d_d_r_e_s_s parameter. If no such entry is found, - then dhcpd acts as if there is no entry in the dhcpd.conf - file for that client, even if there is an entry for that - client on a different subnet or shared network. - -EEXXAAMMPPLLEESS - A typical dhcpd.conf file will look something like this: - - server-identifier dhcps.isc.org; - _g_l_o_b_a_l _p_a_r_a_m_e_t_e_r_s_._._. - - shared-network ISC-BIGGIE { - _s_h_a_r_e_d_-_n_e_t_w_o_r_k_-_s_p_e_c_i_f_i_c _p_a_r_a_m_e_t_e_r_s_._._. - subnet 204.254.239.0 netmask 255.255.255.224 { - _s_u_b_n_e_t_-_s_p_e_c_i_f_i_c _p_a_r_a_m_e_t_e_r_s_._._. - range 204.254.239.10 204.254.239.30; - - - - 2 - - - - - -dhcpd.conf(5) dhcpd.conf(5) - - - } - subnet 204.254.239.32 netmask 255.255.255.224 { - _s_u_b_n_e_t_-_s_p_e_c_i_f_i_c _p_a_r_a_m_e_t_e_r_s_._._. - range 204.254.239.42 204.254.239.62; - } - } - - subnet 204.254.239.64 netmask 255.255.255.224 { - _s_u_b_n_e_t_-_s_p_e_c_i_f_i_c _p_a_r_a_m_e_t_e_r_s_._._. - range 204.254.239.74 204.254.239.94; - } - - group { - _g_r_o_u_p_-_s_p_e_c_i_f_i_c _p_a_r_a_m_e_t_e_r_s_._._. - host zappo.test.isc.org { - _h_o_s_t_-_s_p_e_c_i_f_i_c _p_a_r_a_m_e_t_e_r_s_._._. - } - host beppo.test.isc.org { - _h_o_s_t_-_s_p_e_c_i_f_i_c _p_a_r_a_m_e_t_e_r_s_._._. - } - host harpo.test.isc.org { - _h_o_s_t_-_s_p_e_c_i_f_i_c _p_a_r_a_m_e_t_e_r_s_._._. - } - } - - Figure 1 - - - Notice that after the server-identifier declaration, - there's a place for global parameters. These might be - things like the organization's domain name, the addresses - of the name servers (if they are common to the entire - organization), and so on. So, for example: - - option domain-name "isc.org"; - option name-servers ns1.isc.org, ns2.isc.org; - - Figure 2 - - As you can see in Figure 2, it's legal to specify host - addresses in parameters as domain names rather than as - numeric IP addresses. If a given hostname resolves to - more than one IP address (for example, if that host has - two ethernet interfaces), both addresses are supplied to - the client. - - In Figure 1, you can see that both the shared-network - statement and the subnet statements can have parameters. - Let us say that the shared network _I_S_C_-_B_I_G_G_I_E supports an - entire department - perhaps the accounting department. - If accounting has its own domain, then a shared-network- - specific parameter might be: - - option domain-name "accounting.isc.org"; - - - - 3 - - - - - -dhcpd.conf(5) dhcpd.conf(5) - - - All subnet declarations appearing in the shared-network - declaration would then have the domain-name option set to - "accounting.isc.org" instead of just "isc.org". - - The most obvious reason for having subnet-specific parame- - ters as shown in Figure 1 is that each subnet, of neces- - sity, has its own router. So for the first subnet, for - example, there should be something like: - - option routers 204.254.239.1; - - Note that the address here is specified numerically. - This is not required - if you have a different domain name - for each interface on your router, it's perfectly legiti- - mate to use the domain name for that interface instead of - the numeric address. However, in many cases there may be - only one domain name for all of a router's IP addresses, - and it would not be appropriate to use that name here. - - In Figure 1 there is also a _g_r_o_u_p statement, which pro- - vides common parameters for a set of three hosts - zappo, - beppo and harpo. As you can see, these hosts are all in - the test.isc.org domain, so it might make sense for a - group-specific parameter to override the domain name sup- - plied to these hosts: - - option domain-name "test.isc.org"; - - Also, given the domain they're in, these are probably test - machines. If we wanted to test the DHCP leasing mecha- - nism, we might set the lease timeout somewhat shorter than - the default: - - max-lease-time 120; - default-lease-time 120; - - You may have noticed that while some parameters start with - the _o_p_t_i_o_n keyword, some do not. Parameters starting - with the _o_p_t_i_o_n keyword correspond to actual DHCP options, - while parameters that do not start with the option keyword - either control the behaviour of the DHCP server (e.g., how - long a lease dhcpd will give out), or specify client - parameters that are not optional in the DHCP protocol (for - example, server-name and filename). - - In Figure 1, each host had _h_o_s_t_-_s_p_e_c_i_f_i_c _p_a_r_a_m_e_t_e_r_s. - These could include such things as the _h_o_s_t_n_a_m_e option, - the name of a file to upload (the _f_i_l_e_n_a_m_e _p_a_r_a_m_e_t_e_r_) _a_n_d - _t_h_e _a_d_d_r_e_s_s _o_f _t_h_e _s_e_r_v_e_r _f_r_o_m _w_h_i_c_h _t_o _u_p_l_o_a_d _t_h_e _f_i_l_e - _(_t_h_e _n_e_x_t_-_s_e_r_v_e_r parameter). In general, any parameter - can appear anywhere that parameters are allowed, and will - be applied according to the scope in which the parameter - appears. - - - - - 4 - - - - - -dhcpd.conf(5) dhcpd.conf(5) - - - Imagine that you have a site with a lot of NCD X-Termi- - nals. These terminals come in a variety of models, and - you want to specify the boot files for each models. One - way to do this would be to have host declarations for each - server and group them by model: - - group { - filename "Xncd19r"; - next-server ncd-booter; - - host ncd1 { hardware ethernet 0:c0:c3:49:2b:57; } - host ncd4 { hardware ethernet 0:c0:c3:80:fc:32; } - host ncd8 { hardware ethernet 0:c0:c3:22:46:81; } - } - - group { - filename "Xncd19c"; - next-server ncd-booter; - - host ncd2 { hardware ethernet 0:c0:c3:88:2d:81; } - host ncd3 { hardware ethernet 0:c0:c3:00:14:11; } - } - - group { - filename "XncdHMX"; - next-server ncd-booter; - - host ncd1 { hardware ethernet 0:c0:c3:11:90:23; } - host ncd4 { hardware ethernet 0:c0:c3:91:a7:8; } - host ncd8 { hardware ethernet 0:c0:c3:cc:a:8f; } - } - -RREEFFEERREENNCCEE:: DDEECCLLAARRAATTIIOONNSS - TThhee _s_e_r_v_e_r_-_i_d_e_n_t_i_f_i_e_r ssttaatteemmeenntt - - sseerrvveerr--iiddeennttiiffiieerr _h_o_s_t_n_a_m_e;; - - The server-identifier declaration must be used exactly - once in each dhcpd.conf file to tell dhcpd what IP address - to use as its server identifier, as required by the DHCP - protocol. On a machine with a single interface, the - server identifier should be the primary address of that - interface. On machines with multiple interfaces, the - address of one such interface must be chosen. Any - address may be chosen, as long as it is the address of one - of the interfaces of that machine. - - TThhee _s_h_a_r_e_d_-_n_e_t_w_o_r_k ssttaatteemmeenntt - - sshhaarreedd--nneettwwoorrkk _n_a_m_e {{ - [ _p_a_r_a_m_e_t_e_r_s ] - [ _d_e_c_l_a_r_a_t_i_o_n_s ] - }} - - - - - 5 - - - - - -dhcpd.conf(5) dhcpd.conf(5) - - - The _s_h_a_r_e_d_-_n_e_t_w_o_r_k statement is used to inform the DHCP - server that some IP subnets actually share the same physi- - cal network. Any subnets in a shared network should be - declared within a _s_h_a_r_e_d_-_n_e_t_w_o_r_k statement. Parameters - specified in the _s_h_a_r_e_d_-_n_e_t_w_o_r_k statement will be used - when booting clients on those subnets unless parameters - provided at the subnet or host level override them. If - any subnet in a shared network has addresses available for - dynamic allocation, those addresses are collected into a - common pool for that shared network and assigned to - clients as needed. There is no way to distinguish on - which subnet of a shared network a client should boot. - - _N_a_m_e should be the name of the shared network. This name - is used when printing debugging messages, so it should be - descriptive for the shared network. The name may have - the syntax of a valid domain name (although it will never - be used as such), or it may be any arbitrary name, - enclosed in quotes. - - TThhee _s_u_b_n_e_t ssttaatteemmeenntt - - ssuubbnneett _s_u_b_n_e_t_-_n_u_m_b_e_r nneettmmaasskk _n_e_t_m_a_s_k {{ - [ _p_a_r_a_m_e_t_e_r_s ] - [ _d_e_c_l_a_r_a_t_i_o_n_s ] - }} - - The _s_u_b_n_e_t statement is used to provide dhcpd with enough - information to tell whether or not an IP address is on - that subnet. It may also be used to provide subnet-spe- - cific parameters and to specify what addresses may be - dynamically allocated to clients booting on that subnet. - Such addresses are specified using the _r_a_n_g_e declaration. - - The _s_u_b_n_e_t_-_n_u_m_b_e_r should be an IP address or domain name - which resolves to the subnet number of the subnet being - described. The _n_e_t_m_a_s_k should be an IP address or domain - name which resolves to the subnet mask of the subnet being - described. The subnet number, together with the netmask, - are sufficient to determine whether any given IP address - is on the specified subnet. - - Although a netmask must be given with every subnet decla- - ration, it is recommended that if there is any variance in - subnet masks at a site, a subnet-mask option statement be - used in each subnet declaration to set the desired subnet - mask, since any subnet-mask option statement will override - the subnet mask declared in the subnet statement. - - TThhee _r_a_n_g_e ssttaatteemmeenntt - - rraannggee [ ddyynnaammiicc--bboooottpp ] _l_o_w_-_a_d_d_r_e_s_s [ _h_i_g_h_-_a_d_d_r_e_s_s];; - - For any subnet on which addresses will be assigned - - - - 6 - - - - - -dhcpd.conf(5) dhcpd.conf(5) - - - dynamically, there must be at least one _r_a_n_g_e statement. - The range statement gives the lowest and highest IP - addresses in a range. All IP addresses in the range - should be in the subnet in which the _r_a_n_g_e statement is - declared. The _d_y_n_a_m_i_c_-_b_o_o_t_p flag may be specified if - addresses in the specified range may be dynamically - assigned to BOOTP clients as well as DHCP clients. When - specifying a single address, _h_i_g_h_-_a_d_d_r_e_s_s can be omitted. - - TThhee _h_o_s_t ssttaatteemmeenntt - - hhoosstt _h_o_s_t_n_a_m_e { - [ _p_a_r_a_m_e_t_e_r_s ] - [ _d_e_c_l_a_r_a_t_i_o_n_s ] - }} - - There must be at least one hhoosstt statement for every BOOTP - client that is to be served. hhoosstt statements may also be - specified for DHCP clients, although this is not required - unless booting is only enabled for known hosts. - - If it is desirable to be able to boot a DHCP or BOOTP - client on more than one subnet with fixed addresses, more - than one address may be specified in the _f_i_x_e_d_-_a_d_d_r_e_s_s - parameter, or more than one hhoosstt statement may be speci- - fied. - - If client-specific boot parameters must change based on - the network to which the client is attached, then multiple - hhoosstt statements should be used. - - If a client is to be booted using a fixed address if it's - possible, but should be allocated a dynamic address other- - wise, then a hhoosstt statement must be specified without a - ffiixxeedd--aaddddrreessss clause. _h_o_s_t_n_a_m_e should be a name identify- - ing the host. If a _h_o_s_t_n_a_m_e option is not specified for - the host, _h_o_s_t_n_a_m_e is used. - - _H_o_s_t declarations are matched to actual DHCP or BOOTP - clients by matching the dhcp-client-identifier option - specified in the _h_o_s_t declaration to the one supplied by - the client, or, if the _h_o_s_t declaration or the client does - not provide a dhcp-client-identifier option, by matching - the _h_a_r_d_w_a_r_e parameter in the _h_o_s_t declaration to the net- - work hardware address supplied by the client. BOOTP - clients do not normally provide a _d_h_c_p_-_c_l_i_e_n_t_-_i_d_e_n_t_i_f_i_e_r, - so the hardware address must be used for all clients that - may boot using the BOOTP protocol. - - TThhee _g_r_o_u_p ssttaatteemmeenntt - - ggrroouupp { - [ _p_a_r_a_m_e_t_e_r_s ] - [ _d_e_c_l_a_r_a_t_i_o_n_s ] - - - - 7 - - - - - -dhcpd.conf(5) dhcpd.conf(5) - - - }} - - The group statement is used simply to apply one or more - parameters to a group of declarations. It can be used to - group hosts, shared networks, subnets, or even other - groups. - -RREEFFEERREENNCCEE:: AALLLLOOWW aanndd DDEENNYY - The _a_l_l_o_w and _d_e_n_y statements can be used to control the - behaviour of dhcpd to various sorts of requests. - - - TThhee _u_n_k_n_o_w_n_-_c_l_i_e_n_t_s kkeeyywwoorrdd - - aallllooww uunnkknnoowwnn--cclliieennttss;; - ddeennyy uunnkknnoowwnn--cclliieennttss;; - - The uunnkknnoowwnn--cclliieennttss flag is used to tell dhcpd whether or - not to dynamically assign addresses to unknown clients. - Dynamic address assignment to unknown clients is aalllloowwed - by default. - - TThhee _b_o_o_t_p kkeeyywwoorrdd - - aallllooww bboooottpp;; - ddeennyy bboooottpp;; - - The uunnkknnoowwnn--cclliieennttss flag is used to tell dhcpd whether or - not to respond to bootp queries. Bootp queries are - aalllloowwed by default. - - TThhee _b_o_o_t_i_n_g kkeeyywwoorrdd - - aallllooww bboooottiinngg;; - ddeennyy bboooottiinngg;; - - The bboooottiinngg flag is used to tell dhcpd whether or not to - respond to queries from a particular client. This keyword - only has meaning when it appears in a host declaration. - By default, booting is aalllloowwed, but if it is disabled for - a particular client, then that client will not be able to - get and address from the DHCP server. - -RREEFFEERREENNCCEE:: PPAARRAAMMEETTEERRSS - TThhee _d_e_f_a_u_l_t_-_l_e_a_s_e_-_t_i_m_e ssttaatteemmeenntt - - ddeeffaauulltt--lleeaassee--ttiimmee _t_i_m_e;; - - _T_i_m_e should be the length in seconds that will be assigned - to a lease if the client requesting the lease does not ask - for a specific expiration time. - - TThhee _m_a_x_-_l_e_a_s_e_-_t_i_m_e ssttaatteemmeenntt - - - - - 8 - - - - - -dhcpd.conf(5) dhcpd.conf(5) - - - mmaaxx--lleeaassee--ttiimmee _t_i_m_e;; - - _T_i_m_e should be the maximum length in seconds that will be - assigned to a lease if the client requesting the lease - asks for a specific expiration time. - - TThhee _h_a_r_d_w_a_r_e ssttaatteemmeenntt - - hhaarrddwwaarree _h_a_r_d_w_a_r_e_-_t_y_p_e _h_a_r_d_w_a_r_e_-_a_d_d_r_e_s_s;; - - In order for a BOOTP client to be recognized, its network - hardware address must be declared using a _h_a_r_d_w_a_r_e clause - in the _h_o_s_t statement. _h_a_r_d_w_a_r_e_-_t_y_p_e must be the name of - a physical hardware interface type. Currently, only the - eetthheerrnneett type is recognized, although support for ttookkeenn-- - rriinngg and ffddddii hardware types would also be desirable. The - _h_a_r_d_w_a_r_e_-_a_d_d_r_e_s_s should be a set of hexadecimal octets - (numbers from 0 through ff) seperated by colons. The - _h_a_r_d_w_a_r_e_f_R _s_t_a_t_e_m_e_n_t _m_a_y _a_l_s_o _b_e _u_s_e_d _f_o_r _D_H_C_P _c_l_i_e_n_t_s_. - - TThhee _f_i_l_e_n_a_m_e ssttaatteemmeenntt - - ffiilleennaammee ""_f_i_l_e_n_a_m_e"";; - - The _f_i_l_e_n_a_m_e statement can be used to specify the name of - the initial boot file which is to be loaded by a client. - The _f_i_l_e_n_a_m_e should be a filename recognizable to whatever - file transfer protocol the client can be expected to use - to load the file. - - TThhee _s_e_r_v_e_r_-_n_a_m_e ssttaatteemmeenntt - - sseerrvveerr--nnaammee ""_n_a_m_e"";; - - The _s_e_r_v_e_r_-_n_a_m_e statement can be used to inform the client - of the name of the server from which it is booting. _N_a_m_e - should be the name that will be provided to the client. - - TThhee _n_e_x_t_-_s_e_r_v_e_r ssttaatteemmeenntt - - nneexxtt--sseerrvveerr _s_e_r_v_e_r_-_n_a_m_e;; - - The _n_e_x_t_-_s_e_r_v_e_r statement is used to specify the host - address of the server from which the initial boot file - (specified in the _f_i_l_e_n_a_m_e statement) is to be loaded. - _S_e_r_v_e_r_-_n_a_m_e should be a numeric IP address or a domain - name. If no _n_e_x_t_-_s_e_r_v_e_r parameter applies to a given - client, the address specified in the _s_e_r_v_e_r_-_i_d_e_n_t_i_f_i_e_r - statement is used. - - TThhee _f_i_x_e_d_-_a_d_d_r_e_s_s ssttaatteemmeenntt - - ffiixxeedd--aaddddrreessss _a_d_d_r_e_s_s [,, _a_d_d_r_e_s_s ... ];; - - - - - 9 - - - - - -dhcpd.conf(5) dhcpd.conf(5) - - - The _f_i_x_e_d_-_a_d_d_r_e_s_s statement is used to assign one or more - fixed IP addresses to a client. It should only appear in - a _h_o_s_t declaration. If more than one address is supplied, - then when the client boots, it will be assigned the - address which corresponds to the network on which it is - booting. If none of the addresses in the _f_i_x_e_d_-_a_d_d_r_e_s_s - statement are on the network on which the client is boot- - ing, that client will not match the _h_o_s_t declaration con- - taining that _f_i_x_e_d_-_a_d_d_r_e_s_s statement. Each _a_d_d_r_e_s_s should - be either an IP address or a domain name which resolves to - one or more IP addresses. - - TThhee _d_y_n_a_m_i_c_-_b_o_o_t_p_-_l_e_a_s_e_-_c_u_t_o_f_f ssttaatteemmeenntt - - ddyynnaammiicc--bboooottpp--lleeaassee--ccuuttooffff _d_a_t_e;; - - The _d_y_n_a_m_i_c_-_b_o_o_t_p_-_l_e_a_s_e_-_c_u_t_o_f_f statement sets the ending - time for all leases assigned dynamically to BOOTP clients. - Because BOOTP clients do not have any way of renewing - leases, and don't know that their leases could expire, by - default dhcpd assignes infinite leases to all BOOTP - clients. However, it may make sense in some situations to - set a cutoff date for all BOOTP leases - for example, the - end of a school term, or the time at night when a facility - is closed and all machines are required to be powered off. - - _D_a_t_e should be the date on which all assigned BOOTP leases - will end. The date is specified in the form: - - W YYYY/MM/DD HH:MM:SS - - W is the day of the week expressed as a number from zero - (Sunday) to six (Saturday). YYYY is the year, including - the century. MM is the month expressed as a number from 1 - to 12. DD is the day of the month, counting from 1. HH - is the hour, from zero to 23. MM is the minute and SS is - the second. The time is always in Greenwich Mean Time - (GMT), not local time. - - TThhee _d_y_n_a_m_i_c_-_b_o_o_t_p_-_l_e_a_s_e_-_l_e_n_g_t_h ssttaatteemmeenntt - - ddyynnaammiicc--bboooottpp--lleeaassee--lleennggtthh _l_e_n_g_t_h;; - - The _d_y_n_a_m_i_c_-_b_o_o_t_p_-_l_e_a_s_e_-_l_e_n_g_t_h statement is used to set - the length of leases dynamically assigned to BOOTP - clients. At some sites, it may be possible to assume - that a lease is no longer in use if its holder has not - used BOOTP or DHCP to get its address within a certain - time period. The period is specified in _l_e_n_g_t_h as a num- - ber of seconds. If a client reboots using BOOTP during - the timeout period, the lease duration is reset to _l_e_n_g_t_h, - so a BOOTP client that boots frequently enough will never - lose its lease. Needless to say, this parameter should be - adjusted with extreme caution. - - - - 10 - - - - - -dhcpd.conf(5) dhcpd.conf(5) - - - TThhee _g_e_t_-_l_e_a_s_e_-_h_o_s_t_n_a_m_e_s ssttaatteemmeenntt - - ggeett--lleeaassee--hhoossttnnaammeess _f_l_a_g;; - - The _g_e_t_-_l_e_a_s_e_-_h_o_s_t_n_a_m_e_s statement is used to tell dhcpd - whether or not to look up the domain name corresponding to - the IP address of each address in the lease pool and use - that address for the DHCP _h_o_s_t_n_a_m_e option. If _f_l_a_g is - true, then this lookup is done for all addresses in the - current scope. By default, or if _f_l_a_g is false, no - lookups are done. - - TThhee _u_s_e_-_h_o_s_t_-_d_e_c_l_-_n_a_m_e_s ssttaatteemmeenntt - - uussee--hhoosstt--ddeeccll--nnaammeess _f_l_a_g;; - - If the _u_s_e_-_h_o_s_t_-_d_e_c_l_-_n_a_m_e_s parameter is true in a given - scope, then for every host declaration within that scope, - the name provided for the host declaration will be sup- - plied to the client as its hostname. So, for example, - - group { - use-host-decl-names on; - - host joe { - hardware ethernet 08:00:2b:4c:29:32; - fixed-address joe.fugue.com; - } - } - - is equivalent to - - host joe { - hardware ethernet 08:00:2b:4c:29:32; - fixed-address joe.fugue.com; - option host-name "joe"; - } - - An _o_p_t_i_o_n _h_o_s_t_-_n_a_m_e statement within a host declaration - will override the use of the name in the host declaration. - -RREEFFEERREENNCCEE:: OOPPTTIIOONN SSTTAATTEEMMEENNTTSS - DHCP _o_p_t_i_o_n statements always start with the _o_p_t_i_o_n key- - word, followed by an option name, followed by option data. - The option names and data formats are described below. - It is not necessary to exhaustively specify all DHCP - options - only those options which are needed by clients - must be specified. - - Option data comes in a variety of formats, as defined - below: - - The iipp--aaddddrreessss data type can be entered either as an - explicit IP address (e.g., 239.254.197.10) or as a domain - - - - 11 - - - - - -dhcpd.conf(5) dhcpd.conf(5) - - - name (e.g., haagen.isc.org). When entering a domain name, - be sure that that domain name resolves to a single IP - address. - - The iinntt3322 data type specifies a signed 32-bit integer. - The uuiinntt3322 data type specifies an unsigned 32-bit integer. - The iinntt1166 and uuiinntt1166 data types specify signed and - unsigned 16-bit integers. The iinntt88 and uuiinntt88 data types - specify signed and unsigned 8-bit integers. Unsigned - 8-bit integers are also sometimes referred to as octets. - - The ssttrriinngg data type specifies an NVT ASCII string, which - must be enclosed in double quotes - for example, to spec- - ify a domain-name option, the syntax would be - - option domain-name "isc.org"; - - The ffllaagg data type specifies a boolean value. Booleans - can be either true or false (or on or off, if that makes - more sense to you). - - The ddaattaa--ssttrriinngg data type specifies either an NVT ASCII - string enclosed in double quotes, or a series of octets - specified in hexadecimal, seperated by colons. For exam- - ple: - - option client-identifier "CLIENT-FOO"; - or - option client-identifier 43:4c:49:45:54:2d:46:4f:4f; - - The documentation for the various options mentioned below - is taken from the latest IETF draft document on DHCP - options. Options which are not listed by name may be - defined by the name option-_n_n_n, where _n_n_n _i_s _t_h_e _d_e_c_i_m_a_l - _n_u_m_b_e_r _o_f _t_h_e _o_p_t_i_o_n _c_o_d_e_. _T_h_e_s_e _o_p_t_i_o_n_s _m_a_y _b_e _f_o_l_l_o_w_e_d - _e_i_t_h_e_r _b_y _a _s_t_r_i_n_g_, _e_n_c_l_o_s_e_d _i_n _q_u_o_t_e_s_, _o_r _b_y _a _s_e_r_i_e_s _o_f - _o_c_t_e_t_s_, _e_x_p_r_e_s_s_e_d _a_s _t_w_o_-_d_i_g_i_t _h_e_x_a_d_e_c_i_m_a_l _n_u_m_b_e_r_s _s_e_p_e_r_- - _a_t_e_d _b_y _c_o_l_o_n_s_. _F_o_r _e_x_a_m_p_l_e_: - - option option-133 "my-option-133-text"; - option option-129 1:54:c9:2b:47; - - Because dhcpd does not know the format of these undefined - option codes, no checking is done to ensure the correct- - ness of the entered data. - - The standard options are: - - ooppttiioonn ssuubbnneett--mmaasskk _i_p_-_a_d_d_r_e_s_s;; - - The subnet mask option specifies the client's subnet mask - as per RFC 950. If no subnet mask option is provided any- - where in scope, as a last resort dhcpd will use the subnet - mask from the subnet declaration for the network on which - - - - 12 - - - - - -dhcpd.conf(5) dhcpd.conf(5) - - - an address is being assigned. However, _a_n_y subnet-mask - option declaration that is in scope for the address being - assigned will override the subnet mask specified in the - subnet declaration. - - ooppttiioonn ttiimmee--ooffffsseett _i_n_t_3_2;; - - The time-offset option specifies the offset of the - client's subnet in seconds from Coordinated Universal Time - (UTC). - - ooppttiioonn rroouutteerrss _i_p_-_a_d_d_r_e_s_s [,, _i_p_-_a_d_d_r_e_s_s ... ];; - - The routers option specifies a list of IP addresses for - routers on the client's subnet. Routers should be listed - in order of preference. - - ooppttiioonn ttiimmee--sseerrvveerrss _i_p_-_a_d_d_r_e_s_s _[_, _i_p_-_a_d_d_r_e_s_s ... ];; - - The time-server option specifies a list of RFC 868 time - servers available to the client. Servers should be listed - in order of preference. - - ooppttiioonn nnaammee--sseerrvveerrss _i_p_-_a_d_d_r_e_s_s [,, _i_p_-_a_d_d_r_e_s_s ... ]; - - The name-servers option specifies a list of IEN 116 name - servers available to the client. Servers should be listed - in order of preference. - - ooppttiioonn ddoommaaiinn--nnaammee--sseerrvveerrss _i_p_-_a_d_d_r_e_s_s [,, _i_p_-_a_d_d_r_e_s_s ... - ];; - - The domain-name-servers option specifies a list of Domain - Name System (STD 13, RFC 1035) name servers available to - the client. Servers should be listed in order of prefer- - ence. - - ooppttiioonn lloogg--sseerrvveerrss _i_p_-_a_d_d_r_e_s_s [,, _i_p_-_a_d_d_r_e_s_s ... ];; - - The log-server option specifies a list of MIT-LCS UDP log - servers available to the client. Servers should be listed - in order of preference. - - ooppttiioonn ccooookkiiee--sseerrvveerrss _i_p_-_a_d_d_r_e_s_s [,, _i_p_-_a_d_d_r_e_s_s ... ];; - - The cookie server option specifies a list of RFC 865 - cookie servers available to the client. Servers should be - listed in order of preference. - - ooppttiioonn llpprr--sseerrvveerrss _i_p_-_a_d_d_r_e_s_s [,, _i_p_-_a_d_d_r_e_s_s ... ];; - - The LPR server option specifies a list of RFC 1179 line - printer servers available to the client. Servers should - be listed in order of preference. - - - - 13 - - - - - -dhcpd.conf(5) dhcpd.conf(5) - - - ooppttiioonn iimmpprreessss--sseerrvveerrss _i_p_-_a_d_d_r_e_s_s [,, _i_p_-_a_d_d_r_e_s_s ... ];; - - The impress-server option specifies a list of Imagen - Impress servers available to the client. Servers should - be listed in order of preference. - - ooppttiioonn rreessoouurrccee--llooccaattiioonn--sseerrvveerrss _i_p_-_a_d_d_r_e_s_s [,, _i_p_-_a_d_d_r_e_s_s - ... ];; - - This option specifies a list of RFC 887 Resource Location - servers available to the client. Servers should be listed - in order of preference. - - ooppttiioonn hhoosstt--nnaammee _s_t_r_i_n_g;; - - This option specifies the name of the client. The name - may or may not be qualified with the local domain name (it - is preferable to use the domain-name option to specify the - domain name). See RFC 1035 for character set restric- - tions. - - ooppttiioonn bboooott--ssiizzee _u_i_n_t_1_6;; - - This option specifies the length in 512-octet blocks of - the default boot image for the client. - - ooppttiioonn mmeerriitt--dduummpp _s_t_r_i_n_g;; - - This option specifies the path-name of a file to which the - client's core image should be dumped in the event the - client crashes. The path is formatted as a character - string consisting of characters from the NVT ASCII charac- - ter set. - - ooppttiioonn ddoommaaiinn--nnaammee _s_t_r_i_n_g;; - - This option specifies the domain name that client should - use when resolving hostnames via the Domain Name System. - - ooppttiioonn sswwaapp--sseerrvveerr _i_p_-_a_d_d_r_e_s_s;; - - This specifies the IP address of the client's swap server. - - ooppttiioonn rroooott--ppaatthh _s_t_r_i_n_g;; - - This option specifies the path-name that contains the - client's root disk. The path is formatted as a character - string consisting of characters from the NVT ASCII charac- - ter set. - - ooppttiioonn iipp--ffoorrwwaarrddiinngg _f_l_a_g;; - - This option specifies whether the client should configure - its IP layer for packet forwarding. A value of 0 means - - - - 14 - - - - - -dhcpd.conf(5) dhcpd.conf(5) - - - disable IP forwarding, and a value of 1 means enable IP - forwarding. - - ooppttiioonn nnoonn--llooccaall--ssoouurrccee--rroouuttiinngg _f_l_a_g;; - - This option specifies whether the client should configure - its IP layer to allow forwarding of datagrams with non- - local source routes (see Section 3.3.5 of [4] for a dis- - cussion of this topic). A value of 0 means disallow for- - warding of such datagrams, and a value of 1 means allow - forwarding. - - ooppttiioonn ppoolliiccyy--ffiilltteerr _i_p_-_a_d_d_r_e_s_s _i_p_-_a_d_d_r_e_s_s [,, _i_p_-_a_d_d_r_e_s_s - _i_p_-_a_d_d_r_e_s_s ... ];; - - This option specifies policy filters for non-local source - routing. The filters consist of a list of IP addresses - and masks which specify destination/mask pairs with which - to filter incoming source routes. - - Any source routed datagram whose next-hop address does not - match one of the filters should be discarded by the - client. - - See STD 3 (RFC1122) for further information. - - ooppttiioonn mmaaxx--ddggrraamm--rreeaasssseemmbbllyy _u_i_n_t_1_6;; - - This option specifies the maximum size datagram that the - client should be prepared to reassemble. The minimum - value legal value is 576. - - ooppttiioonn ddeeffaauulltt--iipp--ttttll _u_i_n_t_8_; - - This option specifies the default time-to-live that the - client should use on outgoing datagrams. - - ooppttiioonn ppaatthh--mmttuu--aaggiinngg--ttiimmeeoouutt _u_i_n_t_3_2;; - - This option specifies the timeout (in seconds) to use when - aging Path MTU values discovered by the mechanism defined - in RFC 1191. - - ooppttiioonn ppaatthh--mmttuu--ppllaatteeaauu--ttaabbllee _u_i_n_t_1_6 [,, _u_i_n_t_1_6 ... ];; - - This option specifies a table of MTU sizes to use when - performing Path MTU Discovery as defined in RFC 1191. The - table is formatted as a list of 16-bit unsigned integers, - ordered from smallest to largest. The minimum MTU value - cannot be smaller than 68. - - ooppttiioonn iinntteerrffaaccee--mmttuu _u_i_n_t_1_6;; - - This option specifies the MTU to use on this interface. - - - - 15 - - - - - -dhcpd.conf(5) dhcpd.conf(5) - - - The minimum legal value for the MTU is 68. - - ooppttiioonn aallll--ssuubbnneettss--llooccaall _f_l_a_g;; - - This option specifies whether or not the client may assume - that all subnets of the IP network to which the client is - connected use the same MTU as the subnet of that network - to which the client is directly connected. A value of 1 - indicates that all subnets share the same MTU. A value of - 0 means that the client should assume that some subnets of - the directly connected network may have smaller MTUs. - - ooppttiioonn bbrrooaaddccaasstt--aaddddrreessss _i_p_-_a_d_d_r_e_s_s;; - - This option specifies the broadcast address in use on the - client's subnet. Legal values for broadcast addresses are - specified in section 3.2.1.3 of STD 3 (RFC1122). - - ooppttiioonn ppeerrffoorrmm--mmaasskk--ddiissccoovveerryy _f_l_a_g;; - - This option specifies whether or not the client should - perform subnet mask discovery using ICMP. A value of 0 - indicates that the client should not perform mask discov- - ery. A value of 1 means that the client should perform - mask discovery. - - ooppttiioonn mmaasskk--ssuupppplliieerr _f_l_a_g;; - - This option specifies whether or not the client should - respond to subnet mask requests using ICMP. A value of 0 - indicates that the client should not respond. A value of - 1 means that the client should respond. - - ooppttiioonn rroouutteerr--ddiissccoovveerryy _f_l_a_g;; - - This option specifies whether or not the client should - solicit routers using the Router Discovery mechanism - defined in RFC 1256. A value of 0 indicates that the - client should not perform router discovery. A value of 1 - means that the client should perform router discovery. - - ooppttiioonn rroouutteerr--ssoolliicciittaattiioonn--aaddddrreessss _i_p_-_a_d_d_r_e_s_s;; - - This option specifies the address to which the client - should transmit router solicitation requests. - - ooppttiioonn ssttaattiicc--rroouutteess _i_p_-_a_d_d_r_e_s_s _i_p_-_a_d_d_r_e_s_s [,, _i_p_-_a_d_d_r_e_s_s - _i_p_-_a_d_d_r_e_s_s ... ];; - - This option specifies a list of static routes that the - client should install in its routing cache. If multiple - routes to the same destination are specified, they are - listed in descending order of priority. - - - - - 16 - - - - - -dhcpd.conf(5) dhcpd.conf(5) - - - The routes consist of a list of IP address pairs. The - first address is the destination address, and the second - address is the router for the destination. - - The default route (0.0.0.0) is an illegal destination for - a static route. To specify the default route, use the - rroouutteerrss option. - - ooppttiioonn ttrraaiilleerr--eennccaappssuullaattiioonn _f_l_a_g;; - - This option specifies whether or not the client should - negotiate the use of trailers (RFC 893 [14]) when using - the ARP protocol. A value of 0 indicates that the client - should not attempt to use trailers. A value of 1 means - that the client should attempt to use trailers. - - ooppttiioonn aarrpp--ccaacchhee--ttiimmeeoouutt _u_i_n_t_3_2;; - - This option specifies the timeout in seconds for ARP cache - entries. - - ooppttiioonn iieeeeee880022--33--eennccaappssuullaattiioonn _f_l_a_g;; - - This option specifies whether or not the client should use - Ethernet Version 2 (RFC 894) or IEEE 802.3 (RFC 1042) - encapsulation if the interface is an Ethernet. A value of - 0 indicates that the client should use RFC 894 encapsula- - tion. A value of 1 means that the client should use RFC - 1042 encapsulation. - - ooppttiioonn ddeeffaauulltt--ttccpp--ttttll _u_i_n_t_8;; - - This option specifies the default TTL that the client - should use when sending TCP segments. The minimum value - is 1. - - ooppttiioonn ttccpp--kkeeeeppaalliivvee--iinntteerrvvaall _u_i_n_t_3_2;; - - This option specifies the interval (in seconds) that the - client TCP should wait before sending a keepalive message - on a TCP connection. The time is specified as a 32-bit - unsigned integer. A value of zero indicates that the - client should not generate keepalive messages on connec- - tions unless specifically requested by an application. - - ooppttiioonn ttccpp--kkeeeeppaalliivvee--ggaarrbbaaggee _f_l_a_g;; - - This option specifies the whether or not the client should - send TCP keepalive messages with a octet of garbage for - compatibility with older implementations. A value of 0 - indicates that a garbage octet should not be sent. A value - of 1 indicates that a garbage octet should be sent. - - ooppttiioonn nniiss--ddoommaaiinn _s_t_r_i_n_g;; - - - - 17 - - - - - -dhcpd.conf(5) dhcpd.conf(5) - - - This option specifies the name of the client's NIS (Sun - Network Information Services) domain. The domain is for- - matted as a character string consisting of characters from - the NVT ASCII character set. - - ooppttiioonn nniiss--sseerrvveerrss _i_p_-_a_d_d_r_e_s_s [,, _i_p_-_a_d_d_r_e_s_s ... ];; - - This option specifies a list of IP addresses indicating - NIS servers available to the client. Servers should be - listed in order of preference. - - ooppttiioonn nnttpp--sseerrvveerrss _i_p_-_a_d_d_r_e_s_s [,, _i_p_-_a_d_d_r_e_s_s ... ];; - - This option specifies a list of IP addresses indicating - NTP (RFC 1035) servers available to the client. Servers - should be listed in order of preference. - - ooppttiioonn nneettbbiiooss--nnaammee--sseerrvveerrss _i_p_-_a_d_d_r_e_s_s [,, _i_p_-_a_d_d_r_e_s_s ... - ];; - - The NetBIOS name server (NBNS) option specifies a list of - RFC 1001/1002 NBNS name servers listed in order of prefer- - ence. - - ooppttiioonn nneettbbiiooss--dddd--sseerrvveerr _i_p_-_a_d_d_r_e_s_s [,, _i_p_-_a_d_d_r_e_s_s ... ];; - - The NetBIOS datagram distribution server (NBDD) option - specifies a list of RFC 1001/1002 NBDD servers listed in - order of preference. - - ooppttiioonn nneettbbiiooss--nnooddee--ttyyppee _u_i_n_t_8;; - - The NetBIOS node type option allows NetBIOS over TCP/IP - clients which are configurable to be configured as - described in RFC 1001/1002. The value is specified as a - single octet which identifies the client type. A value of - 1 corresponds to a NetBIOS B-node; a value of 2 corre- - sponds to a P-node; a value of 4 corresponds to an M-node; - a value of 8 corresponds to an H-node. - - ooppttiioonn nneettbbiiooss--ssccooppee _s_t_r_i_n_g;; - - The NetBIOS scope option specifies the NetBIOS over TCP/IP - scope parameter for the client as specified in RFC - 1001/1002. See RFC1001, RFC1002, and RFC1035 for charac- - ter-set restrictions. - - ooppttiioonn ffoonntt--sseerrvveerrss _i_p_-_a_d_d_r_e_s_s [,, _i_p_-_a_d_d_r_e_s_s ... ];; - - This option specifies a list of X Window System Font - servers available to the client. Servers should be listed - in order of preference. - - ooppttiioonn xx--ddiissppllaayy--mmaannaaggeerr _i_p_-_a_d_d_r_e_s_s [,, _i_p_-_a_d_d_r_e_s_s ... ];; - - - - 18 - - - - - -dhcpd.conf(5) dhcpd.conf(5) - - - This option specifies a list of systems that are running - the X Window System Display Manager and are available to - the client. Addresses should be listed in order of pref- - erence. - - ooppttiioonn ddhhccpp--cclliieenntt--iiddeennttiiffiieerr _d_a_t_a_-_s_t_r_i_n_g;; - - This option can be used to specify the a DHCP client iden- - tifier in a host declaration, so that dhcpd can find the - host record by matching against the client identifier. - -SSEEEE AALLSSOO - dhcpd.conf(5), dhcpd.leases(5), draft-ietf-dhc- - options-1533update-04.txt, draft-ietf-dhc-dhcp-07.txt. - -AAUUTTHHOORR - ddhhccppdd((88)) was written by Ted Lemon under a - contract with Vixie Labs. Funding for this project was - provided by the Internet Software Corporation. Informa- - tion about the Internet Software Consortium can be found - at hhttttpp::////wwwwww..iisscc..oorrgg//iisscc.. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 19 - -