Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-5]: src/usr.sbin/dhcp/server Pull up revision 1.15 (requested b...



details:   https://anonhg.NetBSD.org/src/rev/893e2f8abc35
branches:  netbsd-1-5
changeset: 491113:893e2f8abc35
user:      he <he%NetBSD.org@localhost>
date:      Wed Apr 04 20:56:43 2001 +0000

description:
Pull up revision 1.15 (requested by mellon):
  Update DHCP software to ISC version 3, Beta 2, Patchlevel 23.

diffstat:

 usr.sbin/dhcp/server/bootp.c      |    34 +-
 usr.sbin/dhcp/server/dhcpd.conf.5 |  1374 +++++++++++++++++++++++++-----------
 2 files changed, 960 insertions(+), 448 deletions(-)

diffs (truncated from 1853 to 300 lines):

diff -r 1aa7867d87ff -r 893e2f8abc35 usr.sbin/dhcp/server/bootp.c
--- a/usr.sbin/dhcp/server/bootp.c      Wed Apr 04 20:56:40 2001 +0000
+++ b/usr.sbin/dhcp/server/bootp.c      Wed Apr 04 20:56:43 2001 +0000
@@ -43,11 +43,15 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: bootp.c,v 1.12.2.1 2000/10/18 04:11:35 tv Exp $ Copyright (c) 1995-2000 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: bootp.c,v 1.12.2.2 2001/04/04 20:56:43 he Exp $ Copyright (c) 1995-2000 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
 
+#if defined (TRACING)
+# define send_packet trace_packet_send
+#endif
+
 void bootp (packet)
        struct packet *packet;
 {
@@ -93,7 +97,8 @@
                             packet -> raw -> hlen, MDL);
 
        lease  = (struct lease *)0;
-       find_lease (&lease, packet, packet -> shared_network, 0, 0, MDL);
+       find_lease (&lease, packet, packet -> shared_network,
+                   0, 0, (struct lease *)0, MDL);
 
        /* Find an IP address in the host_decl that matches the
           specified network. */
@@ -156,7 +161,8 @@
        
        /* Execute the subnet statements. */
        execute_statements_in_scope ((struct binding_value **)0,
-                                    packet, lease, packet -> options, options,
+                                    packet, lease, (struct client_state *)0,
+                                    packet -> options, options,
                                     &lease -> scope, lease -> subnet -> group,
                                     (struct group *)0);
        
@@ -164,20 +170,23 @@
        for (i = packet -> class_count; i > 0; i--) {
                execute_statements_in_scope
                        ((struct binding_value **)0,
-                        packet, lease, packet -> options, options,
+                        packet, lease, (struct client_state *)0,
+                        packet -> options, options,
                         &lease -> scope, packet -> classes [i - 1] -> group,
                         lease -> subnet -> group);
        }
 
        /* Execute the host statements. */
        execute_statements_in_scope ((struct binding_value **)0,
-                                    packet, lease, packet -> options, options,
+                                    packet, lease, (struct client_state *)0,
+                                    packet -> options, options,
                                     &lease -> scope,
                                     hp -> group, subnet -> group);
        
        /* Drop the request if it's not allowed for this client. */
        if ((oc = lookup_option (&server_universe, options, SV_ALLOW_BOOTP)) &&
            !evaluate_boolean_option_cache (&ignorep, packet, lease,
+                                           (struct client_state *)0,
                                            packet -> options, options,
                                            &lease -> scope, oc, MDL)) {
                if (!ignorep)
@@ -188,6 +197,7 @@
        if ((oc = lookup_option (&server_universe,
                                 options, SV_ALLOW_BOOTING)) &&
            !evaluate_boolean_option_cache (&ignorep, packet, lease,
+                                           (struct client_state *)0,
                                            packet -> options, options,
                                            &lease -> scope, oc, MDL)) {
                if (!ignorep)
@@ -204,8 +214,8 @@
           just copy the input options to the output. */
        if (!packet -> options_valid &&
            !(evaluate_boolean_option_cache
-             (&ignorep, packet, lease, packet -> options, options,
-              &lease -> scope,
+             (&ignorep, packet, lease, (struct client_state *)0,
+              packet -> options, options, &lease -> scope,
               lookup_option (&server_universe, options,
                              SV_ALWAYS_REPLY_RFC1048), MDL))) {
                memcpy (outgoing.raw -> options,
@@ -238,7 +248,8 @@
                   name buffers. */
 
                outgoing.packet_length =
-                       cons_options (packet, outgoing.raw, lease, 0,
+                       cons_options (packet, outgoing.raw, lease,
+                                     (struct client_state *)0, 0,
                                      packet -> options, options,
                                      &lease -> scope,
                                      0, 0, 1, (struct data_string *)0,
@@ -264,6 +275,7 @@
        if ((oc = lookup_option (&server_universe,
                                options, SV_ALWAYS_BROADCAST)) &&
            evaluate_boolean_option_cache (&ignorep, packet, lease,
+                                          (struct client_state *)0,
                                           packet -> options, options,
                                           &lease -> scope, oc, MDL))
                raw.flags |= htons (BOOTP_BROADCAST);
@@ -273,6 +285,7 @@
        oc = lookup_option (&server_universe, options, SV_NEXT_SERVER);
        if (oc &&
            evaluate_option_cache (&d1, packet, lease,
+                                  (struct client_state *)0,
                                   packet -> options, options,
                                   &lease -> scope, oc, MDL)) {
                /* If there was more than one answer, take the first. */
@@ -293,6 +306,7 @@
        oc = lookup_option (&server_universe, options, SV_FILENAME);
        if (oc &&
            evaluate_option_cache (&d1, packet, lease,
+                                  (struct client_state *)0,
                                   packet -> options, options,
                                   &lease -> scope, oc, MDL)) {
                memcpy (raw.file, d1.data,
@@ -308,6 +322,7 @@
        oc = lookup_option (&server_universe, options, SV_SERVER_NAME);
        if (oc &&
            evaluate_option_cache (&d1, packet, lease,
+                                  (struct client_state *)0,
                                   packet -> options, options,
                                   &lease -> scope, oc, MDL)) {
                memcpy (raw.sname, d1.data,
@@ -320,7 +335,8 @@
 
        /* Execute the commit statements, if there are any. */
        execute_statements ((struct binding_value **)0,
-                           packet, lease, packet -> options,
+                           packet, lease, (struct client_state *)0,
+                           packet -> options,
                            options, &lease -> scope, lease -> on_commit);
 
        /* We're done with the option state. */
diff -r 1aa7867d87ff -r 893e2f8abc35 usr.sbin/dhcp/server/dhcpd.conf.5
--- a/usr.sbin/dhcp/server/dhcpd.conf.5 Wed Apr 04 20:56:40 2001 +0000
+++ b/usr.sbin/dhcp/server/dhcpd.conf.5 Wed Apr 04 20:56:43 2001 +0000
@@ -1,20 +1,39 @@
 .\"    dhcpd.conf.5
 .\"
-.\" Copyright (c) 1996-1999 Internet Software Consortium.
-.\" Use is subject to license terms which appear in the file named
-.\" ISC-LICENSE that should have accompanied this file when you
-.\" received it.   If a file named ISC-LICENSE did not accompany this
-.\" file, or you are not sure the one you have is correct, you may
-.\" obtain an applicable copy of the license at:
+.\" Copyright (c) 1996-2001 Internet Software Consortium.
+.\" 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.
 .\"
-.\"             http://www.isc.org/isc-license-1.0.html. 
+.\" 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 file is part of the ISC DHCP distribution.   The documentation
-.\" associated with this file is listed in the file DOCUMENTATION,
-.\" included in the top-level directory of this release.
-.\"
-.\" Support and other services are available for ISC products - see
-.\" http://www.isc.org for more information.
+.\" This software has been written for the Internet Software Consortium
+.\" by Ted Lemon in cooperation with Vixie Enterprises and Nominum, Inc.
+.\" To learn more about the Internet Software Consortium, see
+.\" ``http://www.isc.org/''.  To learn more about Vixie Enterprises,
+.\" see ``http://www.vix.com''.   To learn more about Nominum, Inc., see
+.\" ``http://www.nominum.com''.
 .TH dhcpd.conf 5
 .SH NAME
 dhcpd.conf - dhcpd configuration file
@@ -84,12 +103,12 @@
 .PP
 When a client is to be booted, its boot parameters are determined by
 consulting that client's \fIhost\fR declaration (if any), and then
-consulting the any \fIclass\fR declarations matching the client,
+consulting any \fIclass\fR declarations matching the client,
 followed by the \fIpool\fR, \fIsubnet\fR and \fIshared-network\fR
 declarations for the IP address assigned to the client.   Each of
 these declarations itself appears within a lexical scope, and all
 declarations at less specific lexical scopes are also consulted for
-client option declarations as well.   Scopes are never considered
+client option declarations.   Scopes are never considered
 twice, and if parameters are declared in more than one scope, the
 parameter declared in the most specific scope is the one that is
 used.
@@ -198,7 +217,7 @@
 \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
+the behavior 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
@@ -212,7 +231,7 @@
 .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
+boot files for each model.   One way to do this would be to have host
 declarations for each server and group them by model:
 .nf
 
@@ -291,27 +310,37 @@
 .I allow
 or \fIdeny\fR keyword.   If a pool has a permit list, then only those
 clients that match specific entries on the permit list will be
-elegible to be assigned addresses from the pool.   If a pool has a
+eligible to be assigned addresses from the pool.   If a pool has a
 deny list, then only those clients that do not match any entries on
-the deny list will be elegible.    If both permit and deny lists exist
+the deny list will be eligible.    If both permit and deny lists exist
 for a pool, then only clients that match the permit list and do not
 match the deny list will be allowed access.
-.SH ADDRESS ALLOCATION
+.SH DYNAMIC ADDRESS ALLOCATION
 Address allocation is actually only done when a client is in the INIT
 state and has sent a DHCPDISCOVER message.  If the client thinks it
 has a valid lease and sends a DHCPREQUEST to initiate or renew that
 lease, the server has only three choices - it can ignore the
 DHCPREQUEST, send a DHCPNAK to tell the client it should stop using
 the address, or send a DHCPACK, telling the client to go ahead and use
-the address for a while.  If the server finds the address the client
-is requesting, and that address is available to the client, the server
-will send a DHCPACK.  If the address is no longer available, or the
-client isn't permitted to have it, the server will send a DHCPNAK.  If
-the server knows nothing about the, it will remain silent, unless the
-address is incorrect for the network segment to which the client has
-been attached and the server is authoritative for that network
-segment, in which case the server will send a DHCPNAK even though it
-doesn't know about the address.
+the address for a while.
+.PP
+If the server finds the address the client is requesting, and that
+address is available to the client, the server will send a DHCPACK.
+If the address is no longer available, or the client isn't permitted
+to have it, the server will send a DHCPNAK.  If the server knows
+nothing about the address, it will remain silent, unless the address
+is incorrect for the network segment to which the client has been
+attached and the server is authoritative for that network segment, in
+which case the server will send a DHCPNAK even though it doesn't know
+about the address.
+.PP
+There may be a host declaration matching the client's identification,
+and that host declaration contains a fixed-address declaration that is
+valid for the network segment to which the client is connected.  In
+this case, the DHCP server will never do dynamic address allocation.
+In this case, the client is \fIrequired\fB to take the address
+specified in the host declaration.   If the client is requesting some
+other address, the server will respond with a DHCPNAK.
 .PP
 When the DHCP server allocates a new address for a client (remember,
 this only happens if the client has sent a DHCPDISCOVER), it first
@@ -344,6 +373,33 @@
 allocation but has been previously assigned to a different client, the
 server will keep looking in hopes of finding an address that has never
 before been assigned to a client.
+.SH IP ADDRESS CONFLICT PREVENTION
+The DHCP server checks IP addresses to see if they are in use before
+allocating them to clients.   It does this by sending an ICMP Echo
+request message to the IP address being allocated.   If no ICMP Echo
+reply is received within a second, the address is assumed to be free.
+This is only done for leases that have been specified in range
+statements, and only when the lease is thought by the DHCP server to
+be free - i.e., the DHCP server or its failover peer has not listed
+the lease as in use.
+.PP
+If a response is received to an ICMP Echo request, the DHCP server
+assumes that there is a configuration error - the IP address is in use
+by some host on the network that is not a DHCP client.   It marks the
+address as abandoned, and will not assign it to clients.
+.PP
+If a DHCP client tries to get an IP address, but none are available,
+but there are abandoned IP addresses, then the DHCP server will
+attempt to reclaim an abandoned IP address.   It marks one IP address
+as free, and then does the same ICMP Echo request check described
+previously.   If there is no answer to the ICMP Echo request, the



Home | Main Index | Thread Index | Old Index