Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/dhcp Patchlevel 19



details:   https://anonhg.NetBSD.org/src/rev/28f46ae0e71a
branches:  trunk
changeset: 467625:28f46ae0e71a
user:      mellon <mellon%NetBSD.org@localhost>
date:      Fri Mar 26 17:49:19 1999 +0000

description:
Patchlevel 19

diffstat:

 usr.sbin/dhcp/client/clparse.c       |  12 +---
 usr.sbin/dhcp/client/dhclient.conf.5 |  16 +++--
 usr.sbin/dhcp/common/alloc.c         |   4 +-
 usr.sbin/dhcp/common/dispatch.c      |  33 ++++++++++---
 usr.sbin/dhcp/common/lpf.c           |   6 +-
 usr.sbin/dhcp/common/options.c       |  52 ++++++++++++++------
 usr.sbin/dhcp/common/packet.c        |  24 +++++----
 usr.sbin/dhcp/common/upf.c           |   4 +-
 usr.sbin/dhcp/includes/cf/aix.h      |  89 ++++++++++++++++++++++++++++++++++++
 usr.sbin/dhcp/includes/osdep.h       |  24 +++++++++
 usr.sbin/dhcp/relay/dhcrelay.c       |   4 +-
 usr.sbin/dhcp/server/confpars.c      |  10 ++-
 12 files changed, 218 insertions(+), 60 deletions(-)

diffs (truncated from 596 to 300 lines):

diff -r 813835624800 -r 28f46ae0e71a usr.sbin/dhcp/client/clparse.c
--- a/usr.sbin/dhcp/client/clparse.c    Fri Mar 26 17:34:15 1999 +0000
+++ b/usr.sbin/dhcp/client/clparse.c    Fri Mar 26 17:49:19 1999 +0000
@@ -42,7 +42,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: clparse.c,v 1.1.1.5 1999/02/18 21:48:47 mellon Exp $ Copyright (c) 1997 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: clparse.c,v 1.1.1.6 1999/03/26 17:49:19 mellon Exp $ Copyright (c) 1997 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -51,7 +51,6 @@
 static TIME parsed_time;
 
 struct client_config top_level_config;
-u_int32_t requested_lease_time;
 
 /* client-conf-file :== client-declarations EOF
    client-declarations :== <nil>
@@ -81,8 +80,8 @@
        top_level_config.select_interval = 0;
        top_level_config.reboot_timeout = 10;
        top_level_config.retry_interval = 300;
-       top_level_config.backoff_cutoff = 120;
-       top_level_config.initial_interval = 10;
+       top_level_config.backoff_cutoff = 15;
+       top_level_config.initial_interval = 3;
        top_level_config.bootp_policy = ACCEPT;
        top_level_config.script_name = "/etc/dhclient-script";
        top_level_config.requested_options
@@ -106,11 +105,6 @@
        top_level_config.requested_options
                [top_level_config.requested_option_count++] =
                        DHO_HOST_NAME;
-       requested_lease_time = 7200;
-       top_level_config.send_options [DHO_DHCP_LEASE_TIME].data
-               = (unsigned char *)&requested_lease_time;
-       top_level_config.send_options [DHO_DHCP_LEASE_TIME].len
-               = sizeof requested_lease_time;
 
        if ((cfile = fopen (path_dhclient_conf, "r")) != NULL) {
                do {
diff -r 813835624800 -r 28f46ae0e71a usr.sbin/dhcp/client/dhclient.conf.5
--- a/usr.sbin/dhcp/client/dhclient.conf.5      Fri Mar 26 17:34:15 1999 +0000
+++ b/usr.sbin/dhcp/client/dhclient.conf.5      Fri Mar 26 17:49:19 1999 +0000
@@ -259,14 +259,15 @@
  \fBprepend { [ \fIoption declaration\fR ]
 [\fB,\fI ... \fIoption declaration\fR ]\fB}\fR
 .PP
-If for some set of options the client should first a value it
-supplies, and then use the values supplied by
+If for some set of options the client should use a value you
+supply, and then use the values supplied by
 the server, if any, these values can be defined in the
 .B prepend
 statement.   The
 .B prepend
 statement can only be used for options which
-allow more than one value to be given.
+allow more than one value to be given.   This restriction is not
+enforced - if violated, the results are unpredictable.
 .PP
 .I The
 .B append
@@ -275,14 +276,15 @@
  \fBappend { [ \fIoption declaration\fR ]
 [\fB,\fI ... \fIoption declaration\fR ]\fB}\fR
 .PP
-If for some set of options the client should first a value it
-supplies, and then use the values supplied by
-the server, if any, these values can be defined in the
+If for some set of options the client should first use the values
+supplied by the server, if any, and then use values you supply, these
+values can be defined in the
 .B append
 statement.   The
 .B append
 statement can only be used for options which
-allow more than one value to be given.
+allow more than one value to be given.   This restriction is not
+enforced - if you ignore it, the behaviour will be unpredictable.
 .SH LEASE DECLARATIONS
 .PP
 .I The
diff -r 813835624800 -r 28f46ae0e71a usr.sbin/dhcp/common/alloc.c
--- a/usr.sbin/dhcp/common/alloc.c      Fri Mar 26 17:34:15 1999 +0000
+++ b/usr.sbin/dhcp/common/alloc.c      Fri Mar 26 17:49:19 1999 +0000
@@ -42,7 +42,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: alloc.c,v 1.1.1.3 1999/02/18 21:48:49 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: alloc.c,v 1.1.1.4 1999/03/26 17:49:20 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -240,6 +240,8 @@
        struct lease_state *ptr;
        char *name;
 {
+       if (ptr -> prl)
+               dfree (ptr -> prl, name);
        ptr -> next = free_lease_states;
        free_lease_states = ptr;
 }
diff -r 813835624800 -r 28f46ae0e71a usr.sbin/dhcp/common/dispatch.c
--- a/usr.sbin/dhcp/common/dispatch.c   Fri Mar 26 17:34:15 1999 +0000
+++ b/usr.sbin/dhcp/common/dispatch.c   Fri Mar 26 17:49:19 1999 +0000
@@ -42,7 +42,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: dispatch.c,v 1.1.1.9 1999/02/24 04:11:02 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: dispatch.c,v 1.1.1.10 1999/03/26 17:49:21 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -139,10 +139,7 @@
                /* Skip loopback, point-to-point and down interfaces,
                   except don't skip down interfaces if we're trying to
                   get a list of configurable interfaces. */
-               if ((ifr.ifr_flags & IFF_LOOPBACK) ||
-#ifdef HAVE_IFF_POINTOPOINT
-                   (ifr.ifr_flags & IFF_POINTOPOINT) ||
-#endif
+               if (!(ifr.ifr_flags & IFF_BROADCAST) ||
                    (!(ifr.ifr_flags & IFF_UP) &&
                     state != DISCOVER_UNCONFIGURED))
                        continue;
@@ -356,6 +353,9 @@
                      case ARPHRD_TUNNEL:
                        /* ignore tunnel interfaces. */
 #endif
+#ifdef HAVE_ARPHRD_ROSE
+                     case ARPHRD_ROSE:
+#endif
 #ifdef HAVE_ARPHRD_LOOPBACK
                      case ARPHRD_LOOPBACK:
                        /* ignore loopback interface */
@@ -368,7 +368,7 @@
                        memcpy (tmp -> hw_address.haddr, sa.sa_data, 6);
                        break;
 
-#ifndef ARPHRD_IEEE802
+#ifndef HAVE_ARPHRD_IEEE802
 # define ARPHRD_IEEE802 HTYPE_IEEE802
 #endif
                      case ARPHRD_IEEE802:
@@ -377,7 +377,7 @@
                        memcpy (tmp -> hw_address.haddr, sa.sa_data, 6);
                        break;
 
-#ifndef ARPHRD_FDDI
+#ifndef HAVE_ARPHRD_FDDI
 # define ARPHRD_FDDI HTYPE_FDDI
 #endif
                      case ARPHRD_FDDI:
@@ -394,9 +394,26 @@
                        break;
 #endif
 
+#ifdef HAVE_ARPHRD_AX25
+                     case ARPHRD_AX25:
+                       tmp -> hw_address.hlen = 6;
+                       tmp -> hw_address.htype = ARPHRD_AX25;
+                       memcpy (tmp -> hw_address.haddr, sa.sa_data, 6);
+                       break;
+#endif
+
+#ifdef HAVE_ARPHRD_NETROM
+                     case ARPHRD_NETROM:
+                       tmp -> hw_address.hlen = 6;
+                       tmp -> hw_address.htype = ARPHRD_NETROM;
+                       memcpy (tmp -> hw_address.haddr, sa.sa_data, 6);
+                       break;
+#endif
+
                      default:
-                       error ("%s: unknown hardware address type %d",
+                       warn ("%s: unknown hardware address type %d",
                               ifr.ifr_name, sa.sa_family);
+                       break;
                }
        }
 #endif /* defined (HAVE_SIOCGIFHWADDR) && !defined (HAVE_AF_LINK) */
diff -r 813835624800 -r 28f46ae0e71a usr.sbin/dhcp/common/lpf.c
--- a/usr.sbin/dhcp/common/lpf.c        Fri Mar 26 17:34:15 1999 +0000
+++ b/usr.sbin/dhcp/common/lpf.c        Fri Mar 26 17:49:19 1999 +0000
@@ -43,7 +43,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: lpf.c,v 1.1.1.2 1999/02/24 04:11:03 mellon Exp $ Copyright (c) 1995, 1996, 1998, 1999 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: lpf.c,v 1.1.1.3 1999/03/26 17:49:21 mellon Exp $ Copyright (c) 1995, 1996, 1998, 1999 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -92,7 +92,7 @@
        if ((sock = socket(PF_PACKET, SOCK_PACKET, htons(ETH_P_ALL))) < 0) {
                if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT ||
                    errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT ||
-                   errno == EAFNOSUPPORT)
+                   errno == EAFNOSUPPORT || errno == EINVAL)
                        error ("socket: %m - make sure %s %s!",
                               "CONFIG_PACKET and CONFIG_FILTER are defined",
                               "in your kernel configuration");
@@ -106,7 +106,7 @@
        if (bind (sock, &sa, sizeof sa)) {
                if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT ||
                    errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT ||
-                   errno == EAFNOSUPPORT)
+                   errno == EAFNOSUPPORT || errno == EINVAL)
                        error ("socket: %m - make sure %s %s!",
                               "CONFIG_PACKET and CONFIG_FILTER are defined",
                               "in your kernel configuration");
diff -r 813835624800 -r 28f46ae0e71a usr.sbin/dhcp/common/options.c
--- a/usr.sbin/dhcp/common/options.c    Fri Mar 26 17:34:15 1999 +0000
+++ b/usr.sbin/dhcp/common/options.c    Fri Mar 26 17:49:19 1999 +0000
@@ -42,7 +42,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: options.c,v 1.1.1.5 1999/02/18 21:48:50 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: options.c,v 1.1.1.6 1999/03/26 17:49:22 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #define DHCP_OPTION_DATA
@@ -157,13 +157,17 @@
    three seperate buffers if needed.  This allows us to cons up a set
    of vendor options using the same routine. */
 
-int cons_options (inpacket, outpacket, options, overload, terminate, bootpp)
+int cons_options (inpacket, outpacket, mms,
+                 options, overload, terminate, bootpp, prl, prl_len)
        struct packet *inpacket;
        struct dhcp_packet *outpacket;
+       int mms;
        struct tree_cache **options;
        int overload;   /* Overload flags that may be set. */
        int terminate;
        int bootpp;
+       u_int8_t *prl;
+       int prl_len;
 {
        unsigned char priority_list [300];
        int priority_len;
@@ -178,21 +182,29 @@
           use up to the minimum IP MTU size (576 bytes). */
        /* XXX if a BOOTP client specifies a max message size, we will
           honor it. */
-       if (inpacket && inpacket -> options [DHO_DHCP_MAX_MESSAGE_SIZE].data) {
-               main_buffer_size =
-                       (getUShort (inpacket -> options
-                                   [DHO_DHCP_MAX_MESSAGE_SIZE].data)
-                        - DHCP_FIXED_LEN);
-               /* Enforce a minimum packet size... */
-               if (main_buffer_size < (576 - DHCP_FIXED_LEN))
-                       main_buffer_size = 576 - DHCP_FIXED_LEN;
-               if (main_buffer_size > sizeof buffer)
-                       main_buffer_size = sizeof buffer;
-       } else if (bootpp)
+       if (!mms &&
+           inpacket &&
+           inpacket -> options [DHO_DHCP_MAX_MESSAGE_SIZE].data &&
+           (inpacket -> options [DHO_DHCP_MAX_MESSAGE_SIZE].len >=
+            sizeof (u_int16_t)))
+               mms = getUShort (inpacket -> options
+                                [DHO_DHCP_MAX_MESSAGE_SIZE].data);
+
+       /* If the client has provided a maximum DHCP message size,
+          use that; otherwise, if it's BOOTP, only 64 bytes; otherwise
+          use up to the minimum IP MTU size (576 bytes). */
+       /* XXX if a BOOTP client specifies a max message size, we will
+          honor it. */
+       if (mms)
+               main_buffer_size = mms - DHCP_FIXED_LEN;
+       else if (bootpp)
                main_buffer_size = 64;
        else
                main_buffer_size = 576 - DHCP_FIXED_LEN;
 
+       if (main_buffer_size > sizeof buffer)
+               main_buffer_size = sizeof buffer;
+
        /* Preload the option priority list with mandatory options. */
        priority_len = 0;
        priority_list [priority_len++] = DHO_DHCP_MESSAGE_TYPE;
@@ -212,9 +224,19 @@
                        prlen = (sizeof priority_list) - priority_len;
 
                memcpy (&priority_list [priority_len],
-                       inpacket -> options
-                               [DHO_DHCP_PARAMETER_REQUEST_LIST].data, prlen);
+                       (inpacket -> options
+                        [DHO_DHCP_PARAMETER_REQUEST_LIST].data), prlen);
                priority_len += prlen;
+               prl = priority_list;
+       } else if (prl) {
+               if (prl_len + priority_len > sizeof priority_list)



Home | Main Index | Thread Index | Old Index