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 revision 1.5 (requested by mellon):



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

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

diffstat:

 usr.sbin/dhcp/common/comapi.c       |  312 +-----------------------------------
 usr.sbin/dhcp/common/dispatch.c     |   69 ++++---
 usr.sbin/dhcp/includes/cf/netbsd.h  |    2 +-
 usr.sbin/dhcp/server/dhcpd.leases.5 |  278 ++++++++++++++++++++++---------
 4 files changed, 236 insertions(+), 425 deletions(-)

diffs (truncated from 800 to 300 lines):

diff -r fc6a47e03325 -r c76f87c99d04 usr.sbin/dhcp/common/comapi.c
--- a/usr.sbin/dhcp/common/comapi.c     Wed Apr 04 20:55:58 2001 +0000
+++ b/usr.sbin/dhcp/common/comapi.c     Wed Apr 04 20:56:02 2001 +0000
@@ -50,14 +50,12 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: comapi.c,v 1.1.1.1.2.2 2000/10/18 04:11:01 tv Exp $ Copyright (c) 1999-2000 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: comapi.c,v 1.1.1.1.2.3 2001/04/04 20:56:02 he Exp $ Copyright (c) 1999-2000 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
 #include <omapip/omapip_p.h>
 
-int (*dhcp_interface_shutdown_hook) (struct interface_info *);
-
 omapi_object_type_t *dhcp_type_interface;
 omapi_object_type_t *dhcp_type_group;
 omapi_object_type_t *dhcp_type_shared_network;
@@ -113,22 +111,7 @@
                log_fatal ("Can't register shared network object type: %s",
                           isc_result_totext (status));
 
-       status = omapi_object_type_register (&dhcp_type_interface,
-                                            "interface",
-                                            dhcp_interface_set_value,
-                                            dhcp_interface_get_value,
-                                            dhcp_interface_destroy,
-                                            dhcp_interface_signal_handler,
-                                            dhcp_interface_stuff_values,
-                                            dhcp_interface_lookup, 
-                                            dhcp_interface_create,
-                                            dhcp_interface_remove,
-                                            0, 0, 0,
-                                            sizeof (struct interface_info),
-                                            0);
-       if (status != ISC_R_SUCCESS)
-               log_fatal ("Can't register interface object type: %s",
-                          isc_result_totext (status));
+       interface_setup ();
 }
 
 isc_result_t dhcp_group_set_value  (omapi_object_t *h,
@@ -284,7 +267,7 @@
                if (!group -> name) {
                        char hnbuf [64];
                        sprintf (hnbuf, "ng%08lx%08lx",
-                                cur_time, (unsigned long)group);
+                                (unsigned long)cur_time, (unsigned long)group);
                        group -> name = dmalloc (strlen (hnbuf) + 1, MDL);
                        if (!group -> name)
                                return ISC_R_NOMEMORY;
@@ -724,292 +707,3 @@
        return ISC_R_NOTIMPLEMENTED;
 }
 
-isc_result_t dhcp_interface_set_value  (omapi_object_t *h,
-                                       omapi_object_t *id,
-                                       omapi_data_string_t *name,
-                                       omapi_typed_data_t *value)
-{
-       struct interface_info *interface;
-       isc_result_t status;
-       int foo;
-
-       if (h -> type != dhcp_type_interface)
-               return ISC_R_INVALIDARG;
-       interface = (struct interface_info *)h;
-
-       if (!omapi_ds_strcmp (name, "name")) {
-               if ((value -> type == omapi_datatype_data ||
-                    value -> type == omapi_datatype_string) &&
-                   value -> u.buffer.len < sizeof interface -> name) {
-                       memcpy (interface -> name,
-                               value -> u.buffer.value,
-                               value -> u.buffer.len);
-                       interface -> name [value -> u.buffer.len] = 0;
-               } else
-                       return ISC_R_INVALIDARG;
-               return ISC_R_SUCCESS;
-       }
-
-       /* Try to find some inner object that can take the value. */
-       if (h -> inner && h -> inner -> type -> set_value) {
-               status = ((*(h -> inner -> type -> set_value))
-                         (h -> inner, id, name, value));
-               if (status == ISC_R_SUCCESS || status == ISC_R_UNCHANGED)
-                       return status;
-       }
-                         
-       return ISC_R_NOTFOUND;
-}
-
-
-isc_result_t dhcp_interface_get_value (omapi_object_t *h,
-                                      omapi_object_t *id,
-                                      omapi_data_string_t *name,
-                                      omapi_value_t **value)
-{
-       return ISC_R_NOTIMPLEMENTED;
-}
-
-isc_result_t dhcp_interface_destroy (omapi_object_t *h,
-                                        const char *file, int line)
-{
-       struct interface_info *interface;
-       isc_result_t status;
-
-       if (h -> type != dhcp_type_interface)
-               return ISC_R_INVALIDARG;
-       interface = (struct interface_info *)h;
-
-       if (interface -> ifp)
-               dfree (interface -> ifp, file, line);
-       return ISC_R_SUCCESS;
-}
-
-isc_result_t dhcp_interface_signal_handler (omapi_object_t *h,
-                                           const char *name, va_list ap)
-{
-       struct interface_info *ip, *interface;
-       struct client_config *config;
-       struct client_state *client;
-       isc_result_t status;
-
-       if (h -> type != dhcp_type_interface)
-               return ISC_R_INVALIDARG;
-
-       /* 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 0
-       interface = (struct interface_info *)h;
-
-       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
-                  interfaces that weren't specified! */
-               if (ip -> flags & INTERFACE_RUNNING ||
-                  (ip -> flags & (INTERFACE_REQUESTED |
-                                    INTERFACE_AUTOMATIC)) !=
-                    INTERFACE_REQUESTED)
-                       continue;
-               script_init (ip -> client,
-                            "PREINIT", (struct string_list *)0);
-               if (ip -> client -> alias)
-                       script_write_params (ip -> client, "alias_",
-                                            ip -> client -> alias);
-               script_go (ip -> client);
-       }
-       
-       discover_interfaces (interfaces_requested
-                            ? DISCOVER_REQUESTED
-                            : DISCOVER_RUNNING);
-
-       for (ip = interfaces; ip; ip = ip -> next) {
-               if (ip -> flags & INTERFACE_RUNNING)
-                       continue;
-               ip -> flags |= INTERFACE_RUNNING;
-               for (client = ip -> client; client; client = client -> next) {
-                       client -> state = S_INIT;
-                       /* Set up a timeout to start the initialization
-                          process. */
-                       add_timeout (cur_time + random () % 5,
-                                    state_reboot, client, 0, 0);
-               }
-       }
-       return ISC_R_SUCCESS;
-#endif
-       /* Try to find some inner object that can take the value. */
-       if (h -> inner && h -> inner -> type -> get_value) {
-               status = ((*(h -> inner -> type -> signal_handler))
-                         (h -> inner, name, ap));
-               if (status == ISC_R_SUCCESS)
-                       return status;
-       }
-       return ISC_R_NOTFOUND;
-}
-
-isc_result_t dhcp_interface_stuff_values (omapi_object_t *c,
-                                         omapi_object_t *id,
-                                         omapi_object_t *h)
-{
-       struct interface_info *interface;
-       isc_result_t status;
-
-       if (h -> type != dhcp_type_interface)
-               return ISC_R_INVALIDARG;
-       interface = (struct interface_info *)h;
-
-       /* Write out all the values. */
-
-       status = omapi_connection_put_name (c, "state");
-       if (status != ISC_R_SUCCESS)
-               return status;
-       if (interface -> flags && INTERFACE_REQUESTED)
-           status = omapi_connection_put_string (c, "up");
-       else
-           status = omapi_connection_put_string (c, "down");
-       if (status != ISC_R_SUCCESS)
-               return status;
-
-       /* Write out the inner object, if any. */
-       if (h -> inner && h -> inner -> type -> stuff_values) {
-               status = ((*(h -> inner -> type -> stuff_values))
-                         (c, id, h -> inner));
-               if (status == ISC_R_SUCCESS)
-                       return status;
-       }
-
-       return ISC_R_SUCCESS;
-}
-
-isc_result_t dhcp_interface_lookup (omapi_object_t **ip,
-                                   omapi_object_t *id,
-                                   omapi_object_t *ref)
-{
-       omapi_value_t *tv = (omapi_value_t *)0;
-       isc_result_t status;
-       struct interface_info *interface;
-
-       /* First see if we were sent a handle. */
-       status = omapi_get_value_str (ref, id, "handle", &tv);
-       if (status == ISC_R_SUCCESS) {
-               status = omapi_handle_td_lookup (ip, tv -> value);
-
-               omapi_value_dereference (&tv, MDL);
-               if (status != ISC_R_SUCCESS)
-                       return status;
-
-               /* Don't return the object if the type is wrong. */
-               if ((*ip) -> type != dhcp_type_interface) {
-                       omapi_object_dereference (ip, MDL);
-                       return ISC_R_INVALIDARG;
-               }
-       }
-
-       /* Now look for an interface name. */
-       status = omapi_get_value_str (ref, id, "name", &tv);
-       if (status == ISC_R_SUCCESS) {
-               for (interface = interfaces; interface;
-                    interface = interface -> next) {
-                   if (strncmp (interface -> name,
-                                (char *)tv -> value -> u.buffer.value,
-                                tv -> value -> u.buffer.len) == 0)
-                           break;
-               }
-               omapi_value_dereference (&tv, MDL);
-               if (*ip && *ip != (omapi_object_t *)interface) {
-                       omapi_object_dereference (ip, MDL);
-                       return ISC_R_KEYCONFLICT;
-               } else if (!interface) {
-                       if (*ip)
-                               omapi_object_dereference (ip, MDL);
-                       return ISC_R_NOTFOUND;
-               } else if (!*ip)
-                       /* XXX fix so that hash lookup itself creates
-                          XXX the reference. */
-                       omapi_object_reference (ip,
-                                               (omapi_object_t *)interface,
-                                               MDL);
-       }
-
-       /* If we get to here without finding an interface, no valid key was
-          specified. */
-       if (!*ip)
-               return ISC_R_NOKEYS;
-       return ISC_R_SUCCESS;
-}
-
-/* actually just go discover the interface */
-isc_result_t dhcp_interface_create (omapi_object_t **lp,
-                                   omapi_object_t *id)
-{
-       struct interface_info *hp;
-       isc_result_t status;
-       
-       hp = (struct interface_info *)0;
-       status = interface_allocate (&hp, MDL);
-       if (status != ISC_R_SUCCESS)
-               return status;
-       hp -> flags = INTERFACE_REQUESTED;
-       status = interface_reference ((struct interface_info **)lp, hp, MDL);
-       interface_dereference (&hp, MDL);
-       return status;
-}
-
-isc_result_t dhcp_interface_remove (omapi_object_t *lp,
-                                   omapi_object_t *id)
-{
-       struct interface_info *interface, *ip, *last;
-
-       interface = (struct interface_info *)lp;



Home | Main Index | Thread Index | Old Index