Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/dhcp Merge 3.0b2pl24



details:   https://anonhg.NetBSD.org/src/rev/b83c8739e8b8
branches:  trunk
changeset: 508148:b83c8739e8b8
user:      mellon <mellon%NetBSD.org@localhost>
date:      Fri Apr 06 17:08:51 2001 +0000

description:
Merge 3.0b2pl24

diffstat:

 usr.sbin/dhcp/README             |    8 +-
 usr.sbin/dhcp/RELNOTES           |   51 ++++++++++-
 usr.sbin/dhcp/client/clparse.c   |    3 +-
 usr.sbin/dhcp/client/dhclient.8  |   24 +++++-
 usr.sbin/dhcp/client/dhclient.c  |   93 +++++++++++++++++++--
 usr.sbin/dhcp/common/bpf.c       |   12 ++-
 usr.sbin/dhcp/common/discover.c  |   95 ++++++++++------------
 usr.sbin/dhcp/includes/dhcpd.h   |   39 +++++----
 usr.sbin/dhcp/includes/version.h |    2 +-
 usr.sbin/dhcp/relay/dhcrelay.c   |   14 ++-
 usr.sbin/dhcp/server/confpars.c  |    9 +-
 usr.sbin/dhcp/server/dhcpd.c     |   12 ++-
 usr.sbin/dhcp/server/omapi.c     |  160 ++++++++++++++++++++++++++++++++++++++-
 13 files changed, 418 insertions(+), 104 deletions(-)

diffs (truncated from 896 to 300 lines):

diff -r eaf96e12f767 -r b83c8739e8b8 usr.sbin/dhcp/README
--- a/usr.sbin/dhcp/README      Fri Apr 06 17:00:09 2001 +0000
+++ b/usr.sbin/dhcp/README      Fri Apr 06 17:08:51 2001 +0000
@@ -1,6 +1,6 @@
            Internet Software Consortium DHCP Distribution
-                  Version 3, Beta 2, Patchlevel 23
-                           March 22, 2001
+                  Version 3, Beta 2, Patchlevel 24
+                           April 5, 2001
 
                             README FILE
 
@@ -142,14 +142,14 @@
 To build the DHCP Distribution, unpack the compressed tar file using
 the tar utility and the gzip command - type something like:
 
-       zcat dhcp-3.0b2pl23.tar.gz |tar xvf -
+       zcat dhcp-3.0b2pl24.tar.gz |tar xvf -
 
 On BSD/OS, you have to type gzcat, not zcat, and you may run into
 similar problems on other operating systems.
 
                            CONFIGURING IT
 
-Now, cd to the dhcp-3.0b2pl23 subdirectory that you've just
+Now, cd to the dhcp-3.0b2pl24 subdirectory that you've just
 created and configure the source tree by typing:
 
                ./configure
diff -r eaf96e12f767 -r b83c8739e8b8 usr.sbin/dhcp/RELNOTES
--- a/usr.sbin/dhcp/RELNOTES    Fri Apr 06 17:00:09 2001 +0000
+++ b/usr.sbin/dhcp/RELNOTES    Fri Apr 06 17:08:51 2001 +0000
@@ -1,6 +1,6 @@
            Internet Software Consortium DHCP Distribution
-                  Version 3, Beta 2, Patchlevel 23
-                           March 22, 2001
+                  Version 3, Beta 2, Patchlevel 24
+                           April 5, 2001
 
                            Release Notes
 
@@ -43,11 +43,48 @@
 
 The Dynamic DNS Update support is a descendent of an implementation
 done by Lans Carstensen and Brian Dols at Rose-Hulman Institute of
-Technology, Jim Watt at Perkin-Elmer, Irina Goble at Integrated
-Measurement Systems, and Brian Murrell at BC Tel Advanced
-Communications.  I'd like to express my thanks to all of these good
-people here, both for working on the code and for prodding me into
-improving it.
+Technology, Jim Watt at Applied Biosystems, Irina Goble at Integrated
+Measurement Systems, Igor Sharfmesser at Kazakh Telecom, and Brian
+Murrell at BC Tel Advanced Communications.  I'd like to express my
+thanks to all of these good people here, both for working on the code
+and for prodding me into improving it.
+
+               Changes since 3.0 Beta 2 Patchlevel 23
+
+- Fix a bug in the DNS update code where a status code was not being
+  checked.   This may have been causing core dumps.
+
+- When parsing the lease file, if a lease declaration includes a
+  billing class statement, and the lease already has a billing class,
+  unbill the old class.
+
+- When processing failover transactions, where acks will be deferred,
+  process the state transition immediately.
+
+-  Don't try to use the new SIOCGIFCONF buffer size detection code on
+   Linux 2.0, which doesn't provide this functionality.
+
+- Apply a patch suggested by Tuan Uong for a problem in dlpi.c.
+
+- Fix a problem in using the which command in the configure script.
+
+- Fix a parse error in the client when setting up an omapi listener.
+
+- Document the -n and -g flags to the client.
+
+- Make sure there is always a stdin and stdout on startup.   This
+  prevents shell scripts from accidentally writing error messages into
+  configuration files that happen to be opened as stderr.
+
+- If an interface is removed, the client will now notice that it is
+  gone rather than spinning.   This has only been tested on NetBSD.
+
+- The client will attempt to get an address even if it can't create a
+  lease file.
+
+- Don't overwrite tracefiles.
+
+- Fix some memory allocation bugs in failover.
 
                Changes since 3.0 Beta 2 Patchlevel 22
 
diff -r eaf96e12f767 -r b83c8739e8b8 usr.sbin/dhcp/client/clparse.c
--- a/usr.sbin/dhcp/client/clparse.c    Fri Apr 06 17:00:09 2001 +0000
+++ b/usr.sbin/dhcp/client/clparse.c    Fri Apr 06 17:08:51 2001 +0000
@@ -43,7 +43,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: clparse.c,v 1.10 2001/04/02 23:45:53 mellon Exp $ Copyright (c) 1996-2001 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: clparse.c,v 1.11 2001/04/06 17:08:52 mellon Exp $ Copyright (c) 1996-2001 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -409,6 +409,7 @@
 
              case OMAPI:
                token = next_token (&val, (unsigned *)0, cfile);
+               token = next_token (&val, (unsigned *)0, cfile);
                if (token != PORT) {
                        parse_warn (cfile,
                                    "unexpected omapi subtype: %s", val);
diff -r eaf96e12f767 -r b83c8739e8b8 usr.sbin/dhcp/client/dhclient.8
--- a/usr.sbin/dhcp/client/dhclient.8   Fri Apr 06 17:00:09 2001 +0000
+++ b/usr.sbin/dhcp/client/dhclient.8   Fri Apr 06 17:08:51 2001 +0000
@@ -60,6 +60,13 @@
 server
 ]
 [
+.B -g
+relay
+]
+[
+.B -n
+]
+[
 .B -w
 ]
 [
@@ -160,6 +167,12 @@
 .B -s
 flag, followed by the IP address or domain name of the destination.
 .PP
+For testing purposes, the giaddr field of all packets that the client
+sends can be set using the
+.B -g
+flag, followed by the IP address to send.   This is only useful for testing,
+and should not be expected to work in any consistent or useful way.
+.PP
 The DHCP client will normally run in the foreground until it has
 configured an interface, and then will revert to running in the
 background.   To run force dhclient to always run as a foreground
@@ -226,10 +239,17 @@
 .B -w
 flag can be used to cause the client not to exit when it doesn't find
 any such interfaces.   The
-.B dhcpccp (8)
+.B omshell (8)
 program can then be used to notify the client when a network interface
-has been added or removed, so that the client can configure an IP
+has been added or removed, so that the client can attempt to configure an IP
 address on that interface.
+.PP
+The DHCP client can be directed not to attempt to configure any interfaces
+using the
+.B -n
+flag.   This is most likely to be useful in combination with the
+.B -w
+flag.
 .SH CONFIGURATION
 The syntax of the dhclient.conf(5) file is discussed seperately.
 .SH FILES
diff -r eaf96e12f767 -r b83c8739e8b8 usr.sbin/dhcp/client/dhclient.c
--- a/usr.sbin/dhcp/client/dhclient.c   Fri Apr 06 17:00:09 2001 +0000
+++ b/usr.sbin/dhcp/client/dhclient.c   Fri Apr 06 17:08:51 2001 +0000
@@ -41,7 +41,7 @@
 
 #ifndef lint
 static char ocopyright[] =
-"$Id: dhclient.c,v 1.35 2001/04/02 23:45:53 mellon Exp $ Copyright (c) 1995-2001 Internet Software Consortium.  All rights reserved.\n";
+"$Id: dhclient.c,v 1.36 2001/04/06 17:08:52 mellon Exp $ Copyright (c) 1995-2001 Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -112,6 +112,16 @@
        int no_dhclient_script = 0;
        char *s;
 
+       /* Make sure we have stdin, stdout and stderr. */
+       i = open ("/dev/null", O_RDWR);
+       if (i == 0)
+               i = open ("/dev/null", O_RDWR);
+       if (i == 1) {
+               i = open ("/dev/null", O_RDWR);
+               log_perror = 0; /* No sense logging to /dev/null. */
+       } else if (i != -1)
+               close (i);
+
 #ifdef SYSLOG_4_2
        openlog ("dhclient", LOG_NDELAY);
        log_priority = LOG_DAEMON;
@@ -135,6 +145,7 @@
 
        dhcp_interface_discovery_hook = dhclient_interface_discovery_hook;
        dhcp_interface_shutdown_hook = dhclient_interface_shutdown_hook;
+       dhcp_interface_startup_hook = dhclient_interface_startup_hook;
 
        for (i = 1; i < argc; i++) {
                if (!strcmp (argv [i], "-r")) {
@@ -1681,7 +1692,6 @@
        destination.sin_len = sizeof destination;
 #endif
 
-
        /* Set the lease to end now, so that we don't accidentally
           reuse it if we restart before the old expiry time. */
        client -> active -> expiry =
@@ -2066,8 +2076,10 @@
        if (leaseFile)
                fclose (leaseFile);
        leaseFile = fopen (path_dhclient_db, "w");
-       if (!leaseFile)
-               log_fatal ("can't create %s: %m", path_dhclient_db);
+       if (!leaseFile) {
+               log_error ("can't create %s: %m", path_dhclient_db);
+               return;
+       }
 
        /* Write out all the leases attached to configured interfaces that
           we know about. */
@@ -2159,8 +2171,10 @@
 
        if (!leaseFile) {       /* XXX */
                leaseFile = fopen (path_dhclient_db, "w");
-               if (!leaseFile)
-                       log_fatal ("can't create %s: %m", path_dhclient_db);
+               if (!leaseFile) {
+                       log_error ("can't create %s: %m", path_dhclient_db);
+                       return 0;
+               }
        }
 
        errno = 0;
@@ -2681,6 +2695,7 @@
 
                              case S_INIT:
                              case S_REBINDING:
+                             case S_STOPPED:
                                break;
                        }
                        client -> state = S_INIT;
@@ -2695,9 +2710,7 @@
        struct data_string ds;
        struct option_cache *oc;
 
-       /* make_request doesn't initialize xid because it normally comes
-          from the DHCPDISCOVER, but we haven't sent a DHCPDISCOVER,
-          so pick an xid now. */
+       /* Pick a random xid. */
        client -> xid = random ();
 
        /* is there even a lease to release? */
@@ -2742,13 +2755,19 @@
                script_go (client);
        }
 
-       /* remove the timeouts for this client */
-       cancel_timeout (0, client);
+       /* Cancel any timeouts. */
+       cancel_timeout (state_bound, client);
+       cancel_timeout (send_discover, client);
+       cancel_timeout (state_init, client);
+       cancel_timeout (send_request, client);
+       cancel_timeout (state_reboot, client);
+       client -> state = S_STOPPED;
 }
 
 int dhclient_interface_shutdown_hook (struct interface_info *interface)
 {
        do_release (interface -> client);
+
        return 1;
 }
 
@@ -2795,6 +2814,58 @@
        return 1;
 }
 
+isc_result_t dhclient_interface_startup_hook (struct interface_info *interface)
+{
+       struct interface_info *ip;
+       struct client_state *client;
+
+       /* This code needs some rethinking.   It doesn't test against
+          a signal name, and it just kind of bulls into doing something
+          that may or may not be appropriate. */
+
+       if (interfaces) {
+               interface_reference (&interface -> next, interfaces, MDL);
+               interface_dereference (&interfaces, MDL);
+       }
+       interface_reference (&interfaces, interface, MDL);
+
+       discover_interfaces (DISCOVER_UNCONFIGURED);
+
+       for (ip = interfaces; ip; ip = ip -> next) {
+               /* If interfaces were specified, don't configure



Home | Main Index | Thread Index | Old Index