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 Pull up to head



details:   https://anonhg.NetBSD.org/src/rev/e88d6aa5a5b7
branches:  netbsd-1-5
changeset: 488464:e88d6aa5a5b7
user:      mellon <mellon%NetBSD.org@localhost>
date:      Mon Jul 10 19:58:45 2000 +0000

description:
Pull up to head

diffstat:

 usr.sbin/dhcp/client/clparse.c           |   29 +++++++-
 usr.sbin/dhcp/client/dhclient.c          |   27 ++++--
 usr.sbin/dhcp/client/scripts/linux       |    4 +-
 usr.sbin/dhcp/common/alloc.c             |   26 +++++-
 usr.sbin/dhcp/common/comapi.c            |   10 +-
 usr.sbin/dhcp/common/conflex.c           |    4 +-
 usr.sbin/dhcp/common/discover.c          |    4 +-
 usr.sbin/dhcp/common/dns.c               |   22 +++--
 usr.sbin/dhcp/common/execute.c           |   80 +++++++++++++-------
 usr.sbin/dhcp/common/hash.c              |   16 ++-
 usr.sbin/dhcp/common/icmp.c              |    4 +-
 usr.sbin/dhcp/common/options.c           |   20 ++++-
 usr.sbin/dhcp/common/parse.c             |   51 +++++++++---
 usr.sbin/dhcp/common/tree.c              |   51 ++++++++----
 usr.sbin/dhcp/dhcpctl/Makefile.dist      |   21 +++-
 usr.sbin/dhcp/dhcpctl/dhcpctl.c          |    4 +-
 usr.sbin/dhcp/includes/cf/freebsd.h      |    1 +
 usr.sbin/dhcp/includes/cf/linux.h        |    1 +
 usr.sbin/dhcp/includes/cf/netbsd.h       |    8 ++
 usr.sbin/dhcp/includes/dhcpd.h           |   29 ++++---
 usr.sbin/dhcp/includes/dhctoken.h        |    1 +
 usr.sbin/dhcp/includes/hash.h            |    2 +-
 usr.sbin/dhcp/includes/minires/minires.h |   10 +-
 usr.sbin/dhcp/includes/minires/resolv.h  |    3 +-
 usr.sbin/dhcp/includes/omapip/omapip.h   |    3 +
 usr.sbin/dhcp/includes/site.h            |   10 ++
 usr.sbin/dhcp/includes/version.h         |    2 +-
 usr.sbin/dhcp/minires/Makefile.dist      |   14 +++-
 usr.sbin/dhcp/minires/res_findzonecut.c  |  109 ++++++++++++++------------
 usr.sbin/dhcp/minires/res_update.c       |   10 +-
 usr.sbin/dhcp/omapip/alloc.c             |   59 +++++++++-----
 usr.sbin/dhcp/omapip/dispatch.c          |   50 +++++++++++-
 usr.sbin/dhcp/omapip/errwarn.c           |   10 +-
 usr.sbin/dhcp/omapip/support.c           |   21 +++--
 usr.sbin/dhcp/server/confpars.c          |   44 ++++++++---
 usr.sbin/dhcp/server/db.c                |   25 ++++++-
 usr.sbin/dhcp/server/dhcp.c              |   81 +++++++++++---------
 usr.sbin/dhcp/server/dhcpd.c             |   82 +++++++++++---------
 usr.sbin/dhcp/server/dhcpd.conf.5        |    2 +-
 usr.sbin/dhcp/server/failover.c          |   27 +++---
 usr.sbin/dhcp/server/mdb.c               |  122 +++++++++++++++++++++---------
 usr.sbin/dhcp/server/omapi.c             |   21 ++--
 usr.sbin/dhcp/server/salloc.c            |    2 +-
 usr.sbin/dhcp/server/stables.c           |    6 +-
 44 files changed, 745 insertions(+), 383 deletions(-)

diffs (truncated from 2805 to 300 lines):

diff -r 0ce10724f655 -r e88d6aa5a5b7 usr.sbin/dhcp/client/clparse.c
--- a/usr.sbin/dhcp/client/clparse.c    Fri Jul 07 16:22:15 2000 +0000
+++ b/usr.sbin/dhcp/client/clparse.c    Mon Jul 10 19:58:45 2000 +0000
@@ -43,7 +43,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: clparse.c,v 1.5 2000/06/12 18:57:43 mellon Exp $ Copyright (c) 1996-2000 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: clparse.c,v 1.5.2.1 2000/07/10 19:58:45 mellon Exp $ Copyright (c) 1996-2000 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -96,6 +96,7 @@
        top_level_config.bootp_policy = P_ACCEPT;
        top_level_config.script_name = "/etc/dhclient-script";
        top_level_config.requested_options = default_requested_options;
+       top_level_config.omapi_port = -1;
 
        group_allocate (&top_level_config.on_receipt, MDL);
        if (!top_level_config.on_receipt)
@@ -223,6 +224,7 @@
        struct data_string key_id;
        enum policy policy;
        int known;
+       int tmp;
 
        switch (peek_token (&val, cfile)) {
              case KEY:
@@ -422,6 +424,31 @@
                parse_lease_time (cfile, &config -> select_interval);
                return;
 
+             case OMAPI:
+               token = next_token (&val, cfile);
+               if (token != PORT) {
+                       parse_warn (cfile,
+                                   "unexpected omapi subtype: %s", val);
+                       skip_to_semi (cfile);
+                       return;
+               }
+               token = next_token (&val, cfile);
+               if (token != NUMBER) {
+                       parse_warn (cfile, "invalid port number: `%s'", val);
+                       skip_to_semi (cfile);
+                       return;
+               }
+               tmp = atoi (val);
+               if (tmp < 0 || tmp > 65535)
+                       parse_warn (cfile, "invalid omapi port %d.", tmp);
+               else if (config != &top_level_config)
+                       parse_warn (cfile,
+                                   "omapi port only works at top level.");
+               else
+                       config -> omapi_port = tmp;
+               parse_semi (cfile);
+               return;
+               
              case REBOOT:
                token = next_token (&val, cfile);
                parse_lease_time (cfile, &config -> reboot_timeout);
diff -r 0ce10724f655 -r e88d6aa5a5b7 usr.sbin/dhcp/client/dhclient.c
--- a/usr.sbin/dhcp/client/dhclient.c   Fri Jul 07 16:22:15 2000 +0000
+++ b/usr.sbin/dhcp/client/dhclient.c   Mon Jul 10 19:58:45 2000 +0000
@@ -41,7 +41,7 @@
 
 #ifndef lint
 static char ocopyright[] =
-"$Id: dhclient.c,v 1.26 2000/06/10 18:17:19 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 Internet Software Consortium.  All rights reserved.\n";
+"$Id: dhclient.c,v 1.26.2.1 2000/07/10 19:58:45 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -103,6 +103,7 @@
        omapi_object_t *listener;
        isc_result_t result;
        int persist = 0;
+       int omapi_port;
 
 #ifdef SYSLOG_4_2
        openlog ("dhclient", LOG_NDELAY);
@@ -370,16 +371,20 @@
                return 0;
 
        /* Start up a listener for the object management API protocol. */
-       listener = (omapi_object_t *)0;
-       result = omapi_generic_new (&listener, MDL);
-       if (result != ISC_R_SUCCESS)
-               log_fatal ("Can't allocate new generic object: %s\n",
-                          isc_result_totext (result));
-       result = omapi_protocol_listen (listener,
-                                       OMAPI_PROTOCOL_PORT + 1, 1);
-       if (result != ISC_R_SUCCESS)
-               log_fatal ("Can't start OMAPI protocol: %s",
-                          isc_result_totext (result));
+       if (top_level_config.omapi_port != -1) {
+               listener = (omapi_object_t *)0;
+               result = omapi_generic_new (&listener, MDL);
+               if (result != ISC_R_SUCCESS)
+                       log_fatal ("Can't allocate new generic object: %s\n",
+                                  isc_result_totext (result));
+               result = omapi_protocol_listen (listener,
+                                               (unsigned)
+                                               top_level_config.omapi_port,
+                                               1);
+               if (result != ISC_R_SUCCESS)
+                       log_fatal ("Can't start OMAPI protocol: %s",
+                                  isc_result_totext (result));
+       }
 
        /* Set up the bootp packet handler... */
        bootp_packet_handler = do_packet;
diff -r 0ce10724f655 -r e88d6aa5a5b7 usr.sbin/dhcp/client/scripts/linux
--- a/usr.sbin/dhcp/client/scripts/linux        Fri Jul 07 16:22:15 2000 +0000
+++ b/usr.sbin/dhcp/client/scripts/linux        Mon Jul 10 19:58:45 2000 +0000
@@ -45,8 +45,8 @@
 
 release=`uname -r`
 release=`expr $release : '\(.*\)\..*'`
-relmajor=`echo $release |sed -e 's/^\([^\.]*\)\..*$/\1/'`
-relminor=`echo $release |sed -e 's/^.*\.\([^\.]*\)$/\1/'`
+relminor=`echo $release |sed -e 's/[0-9]*\.\([0-9][0-9]*\)\(\..*\)*$/\1/'`
+relmajor=`echo $release |sed -e 's/\([0-9][0-9]*\)\..*$/\1/'`
 
 if [ x$new_broadcast_address != x ]; then
   new_broadcast_arg="broadcast $new_broadcast_address"
diff -r 0ce10724f655 -r e88d6aa5a5b7 usr.sbin/dhcp/common/alloc.c
--- a/usr.sbin/dhcp/common/alloc.c      Fri Jul 07 16:22:15 2000 +0000
+++ b/usr.sbin/dhcp/common/alloc.c      Mon Jul 10 19:58:45 2000 +0000
@@ -43,7 +43,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: alloc.c,v 1.1.1.6 2000/06/10 18:04:42 mellon Exp $ Copyright (c) 1996-2000 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: alloc.c,v 1.1.1.6.2.1 2000/07/10 19:58:47 mellon Exp $ Copyright (c) 1996-2000 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -192,12 +192,27 @@
        return rval;
 }
 
+struct hash_bucket *free_hash_buckets;
+
 struct hash_bucket *new_hash_bucket (file, line)
        const char *file;
        int line;
 {
-       struct hash_bucket *rval = dmalloc (sizeof (struct hash_bucket),
-                                           file, line);
+       struct hash_bucket *rval;
+       int i;
+       if (!free_hash_buckets) {
+               rval = dmalloc (127 * sizeof (struct hash_bucket),
+                               file, line);
+               if (!rval)
+                       return rval;
+               for (i = 0; i < 127; i++) {
+                       rval -> next = free_hash_buckets;
+                       free_hash_buckets = rval;
+                       rval++;
+               }
+       }
+       rval = free_hash_buckets;
+       free_hash_buckets = rval -> next;
        return rval;
 }
 
@@ -206,7 +221,8 @@
        const char *file;
        int line;
 {
-       dfree ((VOIDPTR)ptr, file, line);
+       ptr -> next = free_hash_buckets;
+       free_hash_buckets = ptr;
 }
 
 struct protocol *new_protocol (file, line)
@@ -755,7 +771,7 @@
        }
 
        (*ptr) -> refcnt--;
-       rc_register (file, line, ptr, bp, bp -> refcnt);
+       rc_register (file, line, ptr, *ptr, (*ptr) -> refcnt);
        if (!(*ptr) -> refcnt)
                dfree ((*ptr), file, line);
        if ((*ptr) -> refcnt < 0) {
diff -r 0ce10724f655 -r e88d6aa5a5b7 usr.sbin/dhcp/common/comapi.c
--- a/usr.sbin/dhcp/common/comapi.c     Fri Jul 07 16:22:15 2000 +0000
+++ b/usr.sbin/dhcp/common/comapi.c     Mon Jul 10 19:58:45 2000 +0000
@@ -50,7 +50,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: comapi.c,v 1.1.1.1 2000/06/10 18:04:43 mellon Exp $ Copyright (c) 1999-2000 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: comapi.c,v 1.1.1.1.2.1 2000/07/10 19:58:47 mellon Exp $ Copyright (c) 1999-2000 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -76,7 +76,7 @@
                                             dhcp_group_stuff_values,
                                             dhcp_group_lookup, 
                                             dhcp_group_create,
-                                            dhcp_group_remove, 0, 0,
+                                            dhcp_group_remove, 0, 0, 0,
                                             sizeof (struct group));
        if (status != ISC_R_SUCCESS)
                log_fatal ("Can't register group object type: %s",
@@ -91,7 +91,7 @@
                                             dhcp_subnet_stuff_values,
                                             dhcp_subnet_lookup, 
                                             dhcp_subnet_create,
-                                            dhcp_subnet_remove, 0, 0,
+                                            dhcp_subnet_remove, 0, 0, 0,
                                             sizeof (struct subnet));
        if (status != ISC_R_SUCCESS)
                log_fatal ("Can't register subnet object type: %s",
@@ -107,7 +107,7 @@
                 dhcp_shared_network_stuff_values,
                 dhcp_shared_network_lookup, 
                 dhcp_shared_network_create,
-                dhcp_shared_network_remove, 0, 0,
+                dhcp_shared_network_remove, 0, 0, 0,
                 sizeof (struct shared_network));
        if (status != ISC_R_SUCCESS)
                log_fatal ("Can't register shared network object type: %s",
@@ -123,7 +123,7 @@
                                             dhcp_interface_lookup, 
                                             dhcp_interface_create,
                                             dhcp_interface_remove,
-                                            0, 0,
+                                            0, 0, 0,
                                             sizeof (struct interface_info));
        if (status != ISC_R_SUCCESS)
                log_fatal ("Can't register interface object type: %s",
diff -r 0ce10724f655 -r e88d6aa5a5b7 usr.sbin/dhcp/common/conflex.c
--- a/usr.sbin/dhcp/common/conflex.c    Fri Jul 07 16:22:15 2000 +0000
+++ b/usr.sbin/dhcp/common/conflex.c    Mon Jul 10 19:58:45 2000 +0000
@@ -43,7 +43,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: conflex.c,v 1.1.1.8 2000/06/10 18:04:43 mellon Exp $ Copyright (c) 1995-2000 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: conflex.c,v 1.1.1.8.2.1 2000/07/10 19:58:47 mellon Exp $ Copyright (c) 1995-2000 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -793,6 +793,8 @@
                        return TOKEN_NEXT;
                break;
              case 'o':
+               if (!strcasecmp (atom + 1, "mapi"))
+                       return OMAPI;
                if (!strcasecmp (atom + 1, "r"))
                        return OR;
                if (!strcasecmp (atom + 1, "n"))
diff -r 0ce10724f655 -r e88d6aa5a5b7 usr.sbin/dhcp/common/discover.c
--- a/usr.sbin/dhcp/common/discover.c   Fri Jul 07 16:22:15 2000 +0000
+++ b/usr.sbin/dhcp/common/discover.c   Mon Jul 10 19:58:45 2000 +0000
@@ -43,7 +43,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: discover.c,v 1.4 2000/06/10 18:17:20 mellon Exp $ Copyright (c) 1995-2000 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: discover.c,v 1.4.2.1 2000/07/10 19:58:47 mellon Exp $ Copyright (c) 1995-2000 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -101,7 +101,7 @@
                        (&dhcp_type_interface, "interface",
                         interface_set_value, interface_get_value,
                         interface_destroy, interface_signal_handler,
-                        interface_stuff_values, 0, 0, 0, 0, 0,
+                        interface_stuff_values, 0, 0, 0, 0, 0, 0,
                         sizeof (struct interface_info));
                if (status != ISC_R_SUCCESS)
                        log_fatal ("Can't create interface object type: %s",
diff -r 0ce10724f655 -r e88d6aa5a5b7 usr.sbin/dhcp/common/dns.c
--- a/usr.sbin/dhcp/common/dns.c        Fri Jul 07 16:22:15 2000 +0000
+++ b/usr.sbin/dhcp/common/dns.c        Mon Jul 10 19:58:45 2000 +0000
@@ -42,7 +42,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: dns.c,v 1.1.1.5 2000/06/10 18:04:46 mellon Exp $ Copyright (c) 2000 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: dns.c,v 1.1.1.5.2.1 2000/07/10 19:58:47 mellon Exp $ Copyright (c) 2000 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -336,10 +336,10 @@
 }
 
 #if defined (NSUPDATE)
-int find_cached_zone (const char *dname, ns_class class,
-                     char *zname, size_t zsize,
-                     struct in_addr *addrs, int naddrs,
-                     struct dns_zone **zcookie)
+ns_rcode find_cached_zone (const char *dname, ns_class class,
+                          char *zname, size_t zsize,
+                          struct in_addr *addrs, int naddrs, int *naddrout,
+                          struct dns_zone **zcookie)



Home | Main Index | Thread Index | Old Index