]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
Merge changes between 3.0.3b1 and 3.0.3rc1 to HEAD. HEAD-MERGE-V3-0-3RC1
authorDavid Hankins <dhankins@isc.org>
Thu, 7 Jul 2005 16:39:08 +0000 (16:39 +0000)
committerDavid Hankins <dhankins@isc.org>
Thu, 7 Jul 2005 16:39:08 +0000 (16:39 +0000)
Makefile.conf
RELNOTES
client/dhclient.conf.5
includes/dhcpd.h
server/bootp.c
server/dhcp.c
server/dhcpd.conf.5

index 4d57cb358eb9f9097aed73fcdae81de83f5fe218..8d6cb7961748266c68aeaef2378fbb45213c257b 100644 (file)
@@ -47,6 +47,7 @@ INCDIR=/usr/local/include
 LIBS =
 COPTS = $(BINDDEF) $(CC_OPTIONS)
 DEBUG = -g
+#WARNERR = -Werror
 RANLIB = ranlib
 MKDEP = mkdep
 CLIENT_PATH = '"PATH=/usr/ucb:/usr/bin:/usr/sbin:/bin:/sbin"'
@@ -128,7 +129,7 @@ MINORVERSION=MinorVersion
 #LIBS = -lresolv -lsocket -lnsl -lgen
 #CC=gcc
 #COPTS = $(BINDDEF) -Wall -Wno-unused -Wno-implicit -Wno-comment \
-#       -Wno-uninitialized -Wno-char-subscripts -Wno-switch -Werror \
+#       -Wno-uninitialized -Wno-char-subscripts -Wno-switch $(WARNERR) \
 #       -DSOLARIS_MAJOR=$(MAJORVERSION) -DSOLARIS_MINOR=$(MINORVERSION) \
 #       $(CC_OPTIONS)
 #CF = cf/sunos5-5.h
@@ -204,7 +205,7 @@ MINORVERSION=MinorVersion
 ## FreeBSD
 ##--freebsd--
 #CF = cf/freebsd.h
-#COPTS = -O -Wall -Wno-unused -Werror $(CC_OPTIONS)
+#COPTS = -O -Wall -Wno-unused $(WARNERR) $(CC_OPTIONS)
 #SCRIPT=freebsd
 ##--freebsd--
 
@@ -212,7 +213,7 @@ MINORVERSION=MinorVersion
 ##--rhapsody--
 #CF = cf/rhapsody.h
 #COPTS  = -Wall -Wno-unused -Wno-implicit -Wno-comment \
-#        -Wno-uninitialized -Wno-switch -Werror -pipe $(BINDDEF) $(CC_OPTIONS)
+#        -Wno-uninitialized -Wno-switch $(WARNERR) -pipe $(BINDDEF) $(CC_OPTIONS)
 ##SCRIPT=rhapsody
 ##--rhapsody--
 
@@ -220,7 +221,7 @@ MINORVERSION=MinorVersion
 ##--darwin--
 #CF = cf/rhapsody.h
 #COPTS  = -Ddarwin -Wall -Wno-unused -Wno-implicit -Wno-comment \
-#        -Wno-uninitialized -Wno-switch -Werror -pipe $(BINDDEF) $(CC_OPTIONS)
+#        -Wno-uninitialized -Wno-switch $(WARNERR) -pipe $(BINDDEF) $(CC_OPTIONS)
 #SCRIPT=freebsd
 ##--darwin--
 
@@ -228,7 +229,7 @@ MINORVERSION=MinorVersion
 ##--netbsd--
 #CF = cf/netbsd.h
 #COPTS  = -Wall -Wstrict-prototypes -Wno-unused -Wno-comment \
-#        -Wno-uninitialized -Werror \
+#        -Wno-uninitialized $(WARNERR) \
 #        -Wimplicit-function-declaration -Wpointer-arith -Wcast-qual \
 #        -Wwrite-strings -Wmissing-prototypes \
 #        -Wmissing-declarations -Wnested-externs \
index 4eb1fc04bacf39abb7bfa855fbe980f6e8568c7d..1c0d9a38304fdeea8796f98d31f628f1c48c03a4 100644 (file)
--- a/RELNOTES
+++ b/RELNOTES
@@ -60,6 +60,31 @@ and for prodding me into improving it.
 - 'make install' now creates the initial zero-length dhcpd.leases file if
   one does not already exist on the system.
 
+                       Changes since 3.0.3b3
+
+- dhclient.conf documentation for interface {} was updated to reflect recent
+  discussion on the dhcp-hackers mailing list.
+
+- In response to reports that the software does not compile on GCC 4.0.0,
+  -Werror was removed from Makefile.conf for all platforms that used it.
+  We will address the true problem in a future release; this is a temporary
+  workaround.
+
+                       Changes since 3.0.3b2
+
+- An error in code changes introduced in 3.0.3b2 was corrected, which caused
+  static BOOTP clients to receive random addresses.
+
+                       Changes since 3.0.3b1
+
+- A bug was fixed in BOOTPREQUEST handling code wherein stale references to
+  host records would be left behind on leases that were not allocated to the
+  client currently booting (eg in the case where the host was denied booting).
+
+- The dhcpd.conf.5 manpage was updated to be more clear in regards to
+  multiple host declarations (thanks to Vincent McIntyre).  'Interim' style
+  dynamic updates were also retouched.
+
                        Changes since 3.0.2
 
 - A bug was fixed where a server might load balance a DHCP REQUEST to its
index ba9583c8d3405f350040721e930e6af53c8d95d2..49a46b50bb715b4fcde2baf23ee342d0390e524f 100644 (file)
@@ -1,4 +1,4 @@
-.\"    $Id: dhclient.conf.5,v 1.15 2005/03/17 20:14:56 dhankins Exp $
+.\"    $Id: dhclient.conf.5,v 1.16 2005/07/07 16:39:07 dhankins Exp $
 .\"
 .\" Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
 .\" Copyright (c) 1996-2003 by Internet Software Consortium
@@ -28,7 +28,7 @@
 .\" see ``http://www.vix.com''.   To learn more about Nominum, Inc., see
 .\" ``http://www.nominum.com''.
 .\"
-.\" $Id: dhclient.conf.5,v 1.15 2005/03/17 20:14:56 dhankins Exp $
+.\" $Id: dhclient.conf.5,v 1.16 2005/07/07 16:39:07 dhankins Exp $
 .\"
 .TH dhclient.conf 5
 .SH NAME
@@ -524,6 +524,15 @@ parameters will then be used only for the interface that matches the
 specified name.   Interfaces for which there is no interface
 declaration will use the parameters declared outside of any interface
 declaration, or the default settings.
+.PP
+.B Note well:
+ISC dhclient only maintains one list of interfaces, which is either
+determined at startup from command line arguments, or otherwise is
+autodetected.  If you supplied the list of interfaces on the command
+line, this configuration clause will add the named interface to the
+list in such a way that will cause it to be configured by DHCP.  Which
+may not be the result you had intended.  This is an undesirable side
+effect that will be addressed in a future release.
 .PP
  \fBpseudo "\fIname\fR" "\fIreal-name\fB" { \fIdeclarations ... \fB }
 .PP
index e12bc9c849f4b59180113dd4246f4ff076dcd406..50899d5c02842a9842541295f8da7a0da898be1a 100644 (file)
@@ -1376,7 +1376,7 @@ void dhcpdecline PROTO ((struct packet *, int));
 void dhcpinform PROTO ((struct packet *, int));
 void nak_lease PROTO ((struct packet *, struct iaddr *cip));
 void ack_lease PROTO ((struct packet *, struct lease *,
-                      unsigned int, TIME, char *, int));
+                      unsigned int, TIME, char *, int, struct host_decl *));
 void dhcp_reply PROTO ((struct lease *));
 int find_lease PROTO ((struct lease **, struct packet *,
                       struct shared_network *, int *, int *, struct lease *,
index ed980b3d80ca39b5cf4cd275639780b3e52852af..c5b2ae0b6413869176c001d1cc877102f26c5030 100644 (file)
@@ -3,7 +3,7 @@
    BOOTP Protocol support. */
 
 /*
- * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004-2005 by Internet Systems Consortium, Inc. ("ISC")
  * Copyright (c) 1995-2003 by Internet Software Consortium
  *
  * Permission to use, copy, modify, and distribute this software for any
@@ -34,7 +34,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: bootp.c,v 1.72 2005/03/17 20:15:26 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium.  All rights reserved.\n";
+"$Id: bootp.c,v 1.73 2005/07/07 16:39:07 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -55,9 +55,7 @@ void bootp (packet)
        struct in_addr from;
        struct hardware hto;
        struct option_state *options = (struct option_state *)0;
-       struct subnet *subnet;
-       struct lease *lease;
-       struct iaddr ip_address;
+       struct lease *lease = (struct lease *)0;
        unsigned i;
        struct data_string d1;
        struct option_cache *oc;
@@ -79,90 +77,70 @@ void bootp (packet)
                 ? inet_ntoa (packet -> raw -> giaddr)
                 : packet -> interface -> name);
 
-
-
        if (!locate_network (packet)) {
                log_info ("%s: network unknown", msgbuf);
                return;
        }
 
-       find_hosts_by_haddr (&hp, packet -> raw -> htype,
-                            packet -> raw -> chaddr,
-                            packet -> raw -> hlen, MDL);
-
-       lease  = (struct lease *)0;
        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. */
-       subnet = (struct subnet *)0;
-       if (hp)
-               find_host_for_network (&subnet, &hp, &ip_address,
-                                      packet -> shared_network);
+       if (lease && lease->host)
+               host_reference(&hp, lease->host, MDL);
 
-       if (!subnet) {
+       if (!lease || ((lease->flags & STATIC_LEASE) == 0)) {
                struct host_decl *h;
-               /* 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
+               /* We didn't find an applicable fixed-address 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)
+                       find_hosts_by_haddr(&hp, packet->raw->htype,
+                                           packet->raw->chaddr,
+                                           packet->raw->hlen, MDL);
+
                for (h = hp; h; h = h -> n_ipaddr) {
                        if (!h -> fixed_addr) {
-                               host_reference (&host, h, MDL);
+                               host_reference(&host, h, MDL);
                                break;
                        }
                }
-               if (hp) {
-                       host_dereference (&hp, MDL);
-                       if (host)
-                               host_reference (&hp, host, MDL);
-               }                       
-
-               /* If a lease has already been assigned to this client,
-                  use it. */
-               if (lease) {
-                       if (host && host != lease -> host) {
-                               if (lease -> host)
-                                       host_dereference (&lease -> host, MDL);
-                               host_reference (&lease -> host, host, MDL);
-                       }
-                       ack_lease (packet, lease, 0, 0, msgbuf, 0);
-                       goto out;
-               }
 
-               /* Otherwise, try to allocate one. */
-               allocate_lease (&lease, packet,
-                               packet -> shared_network -> pools,
-                               &peer_has_leases);
-               if (lease) {
-                       if (host && host != lease -> host) {
-                               if (lease -> host)
-                                       host_dereference (&lease -> host, MDL);
-                               host_reference (&lease -> host, host, MDL);
-                       } else if (lease -> host)
-                               host_dereference (&lease -> host, MDL);
-                       ack_lease (packet, lease, 0, 0, msgbuf, 0);
-                       goto out;
+               if (hp)
+                       host_dereference(&hp, MDL);
+
+               if (host) {
+                       host_reference(&hp, host, MDL);
+                       host_dereference(&host, MDL);
                }
 
-               /* We couldn't find an address to give this bootp client. */
-               log_info ("%s: BOOTP from unknown client and no dynamic leases",
-                       msgbuf);
+               /* Allocate a lease if we have not yet found one. */
+               if (!lease)
+                       allocate_lease (&lease, packet,
+                                       packet -> shared_network -> pools,
+                                       &peer_has_leases);
+
+               if (lease)
+                       ack_lease (packet, lease, 0, 0, msgbuf, 0, hp);
+               else
+                       log_info ("%s: BOOTP from dynamic client and no "
+                                 "dynamic leases", msgbuf);
+
                goto out;
        }
 
        /* Run the executable statements to compute the client and server
           options. */
        option_state_allocate (&options, MDL);
-       
+
        /* Execute the subnet statements. */
        execute_statements_in_scope ((struct binding_value **)0,
                                     packet, lease, (struct client_state *)0,
                                     packet -> options, options,
                                     &lease -> scope, lease -> subnet -> group,
                                     (struct group *)0);
-       
+
        /* Execute statements from class scopes. */
        for (i = packet -> class_count; i > 0; i--) {
                execute_statements_in_scope
@@ -178,7 +156,7 @@ void bootp (packet)
                                     packet, lease, (struct client_state *)0,
                                     packet -> options, options,
                                     &lease -> scope,
-                                    hp -> group, subnet -> group);
+                                    hp -> group, lease -> subnet -> group);
        
        /* Drop the request if it's not allowed for this client. */
        if ((oc = lookup_option (&server_universe, options, SV_ALLOW_BOOTP)) &&
@@ -266,7 +244,9 @@ void bootp (packet)
        raw.secs = packet -> raw -> secs;
        raw.flags = packet -> raw -> flags;
        raw.ciaddr = packet -> raw -> ciaddr;
-       memcpy (&raw.yiaddr, ip_address.iabuf, sizeof raw.yiaddr);
+
+       /* yiaddr is an ipv4 address, it must be 4 octets. */
+       memcpy (&raw.yiaddr, lease->ip_addr.iabuf, 4);
 
        /* If we're always supposed to broadcast to this client, set
           the broadcast bit in the bootp flags field. */
@@ -350,7 +330,7 @@ void bootp (packet)
        /* Report what we're doing... */
        log_info ("%s", msgbuf);
        log_info ("BOOTREPLY for %s to %s (%s) via %s",
-             piaddr (ip_address), hp -> name,
+             piaddr (lease->ip_addr), hp -> name,
              print_hw_addr (packet -> raw -> htype,
                             packet -> raw -> hlen,
                             packet -> raw -> chaddr),
@@ -406,6 +386,4 @@ void bootp (packet)
                host_dereference (&hp, MDL);
        if (host)
                host_dereference (&host, MDL);
-       if (subnet)
-               subnet_dereference (&subnet, MDL);
 }
index 3d647458fe0cd3a385b067625a35959ad494c3c6..fee59a92a7468c23df0d1d1167dcffbe632f2686 100644 (file)
@@ -34,7 +34,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: dhcp.c,v 1.197 2005/03/17 20:15:27 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium.  All rights reserved.\n";
+"$Id: dhcp.c,v 1.198 2005/07/07 16:39:08 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -387,7 +387,8 @@ void dhcpdiscover (packet, ms_nulltp)
        if (when < lease -> ends)
                when = lease -> ends;
 
-       ack_lease (packet, lease, DHCPOFFER, when, msgbuf, ms_nulltp);
+       ack_lease (packet, lease, DHCPOFFER, when, msgbuf, ms_nulltp,
+                  (struct host_decl *)0);
       out:
        if (lease)
                lease_dereference (&lease, MDL);
@@ -664,7 +665,8 @@ void dhcprequest (packet, ms_nulltp, ip_lease)
 
        /* Otherwise, send the lease to the client if we found one. */
        if (lease) {
-               ack_lease (packet, lease, DHCPACK, 0, msgbuf, ms_nulltp);
+               ack_lease (packet, lease, DHCPACK, 0, msgbuf, ms_nulltp,
+                          (struct host_decl *)0);
        } else
                log_info ("%s: unknown lease %s.", msgbuf, piaddr (cip));
 
@@ -1476,13 +1478,14 @@ void nak_lease (packet, cip)
                              from, &to, (struct hardware *)0);
 }
 
-void ack_lease (packet, lease, offer, when, msg, ms_nulltp)
+void ack_lease (packet, lease, offer, when, msg, ms_nulltp, hp)
        struct packet *packet;
        struct lease *lease;
        unsigned int offer;
        TIME when;
        char *msg;
        int ms_nulltp;
+       struct host_decl *hp;
 {
        struct lease *lt;
        struct lease_state *state;
@@ -1511,7 +1514,9 @@ void ack_lease (packet, lease, offer, when, msg, ms_nulltp)
                return;
 
        /* If the lease carries a host record, remember it. */
-       if (lease -> host)
+       if (hp)
+               host_reference (&host, hp, MDL);
+       else if (lease -> host)
                host_reference (&host, lease -> host, MDL);
 
        /* Allocate a lease state structure... */
index 1c2df1f2538f5a67b2845cf2965e69b87af6898d..847b34582f57ad35518f6a8f1c64c84af21c87aa 100644 (file)
@@ -28,7 +28,7 @@
 .\" see ``http://www.vix.com''.   To learn more about Nominum, Inc., see
 .\" ``http://www.nominum.com''.
 .\"
-.\" $Id: dhcpd.conf.5,v 1.67 2005/03/17 20:15:27 dhankins Exp $
+.\" $Id: dhcpd.conf.5,v 1.68 2005/07/07 16:39:08 dhankins Exp $
 .\"
 .TH dhcpd.conf 5
 .SH NAME
@@ -1040,8 +1040,8 @@ IP address, it can update its own A record, assuming that the
 .PP
 If the server is configured not to allow client updates, or if the
 client doesn't want to do its own update, the server will simply
-choose a name for the client, possibly using the hostname supplied by
-the client ("jschmoe" in the previous example).   It will use its own
+choose a name for the client from either the fqdn option (if present)
+or the hostname option (if present).  It will use its own
 domain name for the client, just as in the ad-hoc update scheme.
 It will then update both the A and PTR record, using the name that it
 chose for the client.   If the client sends a fully-qualified domain
@@ -1049,6 +1049,14 @@ name in the fqdn option, the server uses only the leftmost part of the
 domain name - in the example above, "jschmoe" instead of
 "jschmoe.radish.org".
 .PP
+Also, if the
+.I use-host-decl-names
+configuration option is enabled, then the host declaration's
+.I hostname
+will be used in place of the
+.I hostname
+option, and the same rules will apply as described above.
+.PP
 The other difference between the ad-hoc scheme and the interim
 scheme is that with the interim scheme, a method is used that
 allows more than one DHCP server to update the DNS database without
@@ -1352,26 +1360,32 @@ a specific client, and also provides a way to assign a client a fixed address.
 The host declaration provides a way for the DHCP server to identify a DHCP or
 BOOTP client, and also a way to assign the client a static IP address.
 .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
+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
 declaration, or more than one
 .B host
-statement may be specified.
+statement may be specified matching the same client.
 .PP
 If client-specific boot parameters must change based on the network
 to which the client is attached, then multiple 
 .B host
-declaration 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
+declarations should be used.  The
 .B host
-declaration must be specified without a
-.B fixed-address
-declaration.
+declarations will only match a client if one of their
+.I fixed-address
+statements is viable on the subnet (or shared network) where the client is
+attached.  Conversely, for a
+.B host
+declaration to match a client being allocated a dynamic address, it must not
+have any
+.I fixed-address
+statements.  You may therefore need a mixture of
+.B host
+declarations for any given client...some having
+.I fixed-address
+statements, others without.
+.PP
 .I hostname
 should be a name identifying the host.  If a \fIhostname\fR option is
 not specified for the host, \fIhostname\fR is used.