Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/dhcp Belated import of recent DHCP core dumps, etc....
details: https://anonhg.NetBSD.org/src/rev/108fbaadc40a
branches: trunk
changeset: 487644:108fbaadc40a
user: mellon <mellon%NetBSD.org@localhost>
date: Sat Jun 10 18:04:36 2000 +0000
description:
Belated import of recent DHCP core dumps, etc. Approved by releng.
diffstat:
usr.sbin/dhcp/client/scripts/linux | 4 +-
usr.sbin/dhcp/client/scripts/nextstep | 15 +-
usr.sbin/dhcp/client/scripts/openbsd | 12 +-
usr.sbin/dhcp/client/scripts/solaris | 9 +
usr.sbin/dhcp/common/alloc.c | 301 +--
usr.sbin/dhcp/common/comapi.c | 1015 ++++++++++++
usr.sbin/dhcp/common/conflex.c | 60 +-
usr.sbin/dhcp/common/dlpi.c | 10 +-
usr.sbin/dhcp/common/dns.c | 136 +-
usr.sbin/dhcp/common/execute.c | 4 +-
usr.sbin/dhcp/common/icmp.c | 5 +-
usr.sbin/dhcp/common/lpf.c | 10 +-
usr.sbin/dhcp/common/memory.c | 137 +-
usr.sbin/dhcp/common/nit.c | 10 +-
usr.sbin/dhcp/common/parse.c | 38 +-
usr.sbin/dhcp/common/socket.c | 4 +-
usr.sbin/dhcp/common/tree.c | 6 +-
usr.sbin/dhcp/common/upf.c | 10 +-
usr.sbin/dhcp/dhcpctl/dhcpctl.c | 8 +-
usr.sbin/dhcp/dhcpctl/dhcpctl.h | 7 +-
usr.sbin/dhcp/includes/dhctoken.h | 27 +-
usr.sbin/dhcp/includes/failover.h | 68 +-
usr.sbin/dhcp/includes/hash.h | 59 +-
usr.sbin/dhcp/includes/minires/minires.h | 7 +-
usr.sbin/dhcp/includes/omapip/omapip.h | 92 +-
usr.sbin/dhcp/includes/omapip/omapip_p.h | 39 +-
usr.sbin/dhcp/includes/site.h | 20 +-
usr.sbin/dhcp/minires/res_findzonecut.c | 8 +-
usr.sbin/dhcp/minires/res_update.c | 22 +-
usr.sbin/dhcp/omapip/alloc.c | 118 +
usr.sbin/dhcp/omapip/connection.c | 291 ++-
usr.sbin/dhcp/omapip/dispatch.c | 158 +-
usr.sbin/dhcp/omapip/generic.c | 16 +-
usr.sbin/dhcp/omapip/listener.c | 95 +-
usr.sbin/dhcp/omapip/message.c | 3 +
usr.sbin/dhcp/omapip/protocol.c | 143 +-
usr.sbin/dhcp/omapip/support.c | 70 +-
usr.sbin/dhcp/omapip/test.c | 1 +
usr.sbin/dhcp/server/class.c | 41 +-
usr.sbin/dhcp/server/confpars.c | 1024 ++++++++---
usr.sbin/dhcp/server/db.c | 157 +-
usr.sbin/dhcp/server/failover.c | 2477 +++++++++++++++++++++++++++--
usr.sbin/dhcp/server/mdb.c | 1649 +++++++++++--------
usr.sbin/dhcp/server/omapi.c | 764 +++-----
usr.sbin/dhcp/server/salloc.c | 131 +
usr.sbin/dhcp/server/stables.c | 43 +-
46 files changed, 6852 insertions(+), 2472 deletions(-)
diffs (truncated from 13329 to 300 lines):
diff -r e950a6aa8e80 -r 108fbaadc40a usr.sbin/dhcp/client/scripts/linux
--- a/usr.sbin/dhcp/client/scripts/linux Sat Jun 10 17:01:15 2000 +0000
+++ b/usr.sbin/dhcp/client/scripts/linux Sat Jun 10 18:04:36 2000 +0000
@@ -99,10 +99,12 @@
current_hostname=`hostname`
if [ x$current_hostname = x ] || \
[ x$current_hostname = x$old_host_name ]; then
- if [ x$new_host_name != x$old_host_name ]; then
+ if [ x$current_hostname = x ] || \
+ [ x$new_host_name != x$old_host_name ]; then
hostname $new_host_name
fi
fi
+
if [ x$old_ip_address != x ] && [ x$alias_ip_address != x ] && \
[ x$alias_ip_address != x$old_ip_address ]; then
# Possible new alias. Remove old alias.
diff -r e950a6aa8e80 -r 108fbaadc40a usr.sbin/dhcp/client/scripts/nextstep
--- a/usr.sbin/dhcp/client/scripts/nextstep Sat Jun 10 17:01:15 2000 +0000
+++ b/usr.sbin/dhcp/client/scripts/nextstep Sat Jun 10 18:04:36 2000 +0000
@@ -13,8 +13,19 @@
fi
if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \
[ x$reason = xREBIND ] || [ x$reason = xREBOOT ]; then
- if [ x$old_ip_address != x ] && [ x$old_ip_address != x$new_ip_address ]; then
- ifconfig $interface $new_ip_address netmask $new_subnet_mask >/dev/null 2>&1
+ current_hostname=`hostname`
+ if [ x$current_hostname = x ] || \
+ [ x$current_hostname = x$old_host_name ]; then
+ if [ x$current_hostname = x ] || \
+ [ x$new_host_name != x$old_host_name ]; then
+ hostname $new_host_name
+ fi
+ fi
+
+ if [ x$old_ip_address != x ] && [ x$old_ip_address != x$new_ip_address ]
+ then
+ ifconfig $interface $new_ip_address netmask $new_subnet_mask \
+ >/dev/null 2>&1
route add $new_ip_address 127.1 0 >/dev/null 2>&1
for router in $new_routers ; do
route add default $router 1 >/dev/null 2>&1
diff -r e950a6aa8e80 -r 108fbaadc40a usr.sbin/dhcp/client/scripts/openbsd
--- a/usr.sbin/dhcp/client/scripts/openbsd Sat Jun 10 17:01:15 2000 +0000
+++ b/usr.sbin/dhcp/client/scripts/openbsd Sat Jun 10 18:04:36 2000 +0000
@@ -72,12 +72,22 @@
if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \
[ x$reason = xREBIND ] || [ x$reason = xREBOOT ]; then
+ current_hostname=`hostname`
+ if [ x$current_hostname = x ] || \
+ [ x$current_hostname = x$old_host_name ]; then
+ if [ x$current_hostname = x ] || \
+ [ x$new_host_name != x$old_host_name ]; then
+ hostname $new_host_name
+ fi
+ fi
+
if [ x$old_ip_address != x ] && [ x$alias_ip_address != x ] && \
[ x$alias_ip_address != x$old_ip_address ]; then
ifconfig $interface inet -alias $alias_ip_address > /dev/null 2>&1
route delete $alias_ip_address 127.0.0.1 > /dev/null 2>&1
fi
- if [ x$old_ip_address != x ] && [ x$old_ip_address != x$new_ip_address ]; then
+ if [ x$old_ip_address != x ] && [ x$old_ip_address != x$new_ip_address ]
+ then
ifconfig $interface inet -alias $old_ip_address $medium
route delete $old_ip_address 127.1 >/dev/null 2>&1
for router in $old_routers; do
diff -r e950a6aa8e80 -r 108fbaadc40a usr.sbin/dhcp/client/scripts/solaris
--- a/usr.sbin/dhcp/client/scripts/solaris Sat Jun 10 17:01:15 2000 +0000
+++ b/usr.sbin/dhcp/client/scripts/solaris Sat Jun 10 18:04:36 2000 +0000
@@ -81,6 +81,15 @@
if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \
[ x$reason = xREBIND ] || [ x$reason = xREBOOT ]; then
+ current_hostname=`hostname`
+ if [ x$current_hostname = x ] || \
+ [ x$current_hostname = x$old_host_name ]; then
+ if [ x$current_hostname = x ] || \
+ [ x$new_host_name != x$old_host_name ]; then
+ hostname $new_host_name
+ fi
+ fi
+
if [ x$old_ip_address != x ] && [ x$alias_ip_address != x ] && \
[ x$alias_ip_address != x$old_ip_address ]; then
$ifconfig ${interface}:1 inet 0 down > /dev/null 2>&1
diff -r e950a6aa8e80 -r 108fbaadc40a usr.sbin/dhcp/common/alloc.c
--- a/usr.sbin/dhcp/common/alloc.c Sat Jun 10 17:01:15 2000 +0000
+++ b/usr.sbin/dhcp/common/alloc.c Sat Jun 10 18:04:36 2000 +0000
@@ -43,7 +43,7 @@
#ifndef lint
static char copyright[] =
-"$Id: alloc.c,v 1.1.1.5 2000/04/22 07:11:32 mellon Exp $ Copyright (c) 1996-2000 The Internet Software Consortium. All rights reserved.\n";
+"$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";
#endif /* not lint */
#include "dhcpd.h"
@@ -52,6 +52,121 @@
struct dhcp_packet *dhcp_free_list;
struct packet *packet_free_list;
+OMAPI_OBJECT_ALLOC (subnet, struct subnet, dhcp_type_subnet)
+OMAPI_OBJECT_ALLOC (shared_network, struct shared_network,
+ dhcp_type_shared_network)
+OMAPI_OBJECT_ALLOC (group_object, struct group_object, dhcp_type_group)
+
+int group_allocate (ptr, file, line)
+ struct group **ptr;
+ const char *file;
+ int line;
+{
+ int size;
+
+ if (!ptr) {
+ log_error ("%s(%d): null pointer", file, line);
+#if defined (POINTER_DEBUG)
+ abort ();
+#else
+ return 0;
+#endif
+ }
+ if (*ptr) {
+ log_error ("%s(%d): non-null pointer", file, line);
+#if defined (POINTER_DEBUG)
+ abort ();
+#else
+ *ptr = (struct group *)0;
+#endif
+ }
+
+ *ptr = dmalloc (sizeof **ptr, file, line);
+ if (*ptr) {
+ memset (*ptr, 0, sizeof **ptr);
+ (*ptr) -> refcnt = 1;
+ return 1;
+ }
+ return 0;
+}
+
+int group_reference (ptr, bp, file, line)
+ struct group **ptr;
+ struct group *bp;
+ const char *file;
+ int line;
+{
+ if (!ptr) {
+ log_error ("%s(%d): null pointer", file, line);
+#if defined (POINTER_DEBUG)
+ abort ();
+#else
+ return 0;
+#endif
+ }
+ if (*ptr) {
+ log_error ("%s(%d): non-null pointer", file, line);
+#if defined (POINTER_DEBUG)
+ abort ();
+#else
+ *ptr = (struct group *)0;
+#endif
+ }
+ *ptr = bp;
+ bp -> refcnt++;
+ rc_register (file, line, ptr, bp, bp -> refcnt);
+ dmalloc_reuse (bp, file, line, 1);
+ return 1;
+}
+
+int group_dereference (ptr, file, line)
+ struct group **ptr;
+ const char *file;
+ int line;
+{
+ int i;
+ struct group *group;
+
+ if (!ptr || !*ptr) {
+ log_error ("%s(%d): null pointer", file, line);
+#if defined (POINTER_DEBUG)
+ abort ();
+#else
+ return 0;
+#endif
+ }
+
+ group = *ptr;
+ *ptr = (struct group *)0;
+ --group -> refcnt;
+ rc_register (file, line, ptr, group, group -> refcnt);
+ if (group -> refcnt > 0)
+ return 1;
+
+ if (group -> refcnt < 0) {
+ log_error ("%s(%d): negative refcnt!", file, line);
+#if defined (DEBUG_RC_HISTORY)
+ dump_rc_history ();
+#endif
+#if defined (POINTER_DEBUG)
+ abort ();
+#else
+ return 0;
+#endif
+ }
+
+ if (group -> object)
+ group_object_dereference (&group -> object, MDL);
+ if (group -> subnet)
+ subnet_dereference (&group -> subnet, MDL);
+ if (group -> shared_network)
+ shared_network_dereference (&group -> shared_network, MDL);
+ if (group -> statements)
+ executable_statement_dereference (&group -> statements, MDL);
+ dfree (group, file, line);
+ return 1;
+}
+
struct dhcp_packet *new_dhcp_packet (file, line)
const char *file;
int line;
@@ -86,57 +201,12 @@
return rval;
}
-struct lease *new_leases (n, file, line)
- unsigned n;
- const char *file;
- int line;
-{
- struct lease *rval = dmalloc (n * sizeof (struct lease), file, line);
- return rval;
-}
-
-struct lease *new_lease (file, line)
- const char *file;
- int line;
-{
- struct lease *rval = dmalloc (sizeof (struct lease), file, line);
- return rval;
-}
-
-struct subnet *new_subnet (file, line)
+void free_hash_bucket (ptr, file, line)
+ struct hash_bucket *ptr;
const char *file;
int line;
{
- struct subnet *rval = dmalloc (sizeof (struct subnet), file, line);
- return rval;
-}
-
-struct class *new_class (file, line)
- const char *file;
- int line;
-{
- struct class *rval = dmalloc (sizeof (struct class), file, line);
- return rval;
-}
-
-struct shared_network *new_shared_network (file, line)
- const char *file;
- int line;
-{
- struct shared_network *rval =
- dmalloc (sizeof (struct shared_network), file, line);
- return rval;
-}
-
-struct group *new_group (file, line)
- const char *file;
- int line;
-{
- struct group *rval =
- dmalloc (sizeof (struct group), file, line);
- if (rval)
- memset (rval, 0, sizeof *rval);
- return rval;
+ dfree ((VOIDPTR)ptr, file, line);
}
struct protocol *new_protocol (file, line)
@@ -147,32 +217,6 @@
return rval;
}
-struct lease_state *free_lease_states;
-
-struct lease_state *new_lease_state (file, line)
- const char *file;
- int line;
-{
- struct lease_state *rval;
-
- if (free_lease_states) {
- rval = free_lease_states;
- free_lease_states =
- (struct lease_state *)(free_lease_states -> next);
- dmalloc_reuse (rval, file, line, 0);
Home |
Main Index |
Thread Index |
Old Index