Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
ISC Open Source Projects
dhcp
Commits
31bbee78
Commit
31bbee78
authored
May 17, 2001
by
Ted Lemon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sync with 3.0rc7
parent
cb7cfe5c
Changes
21
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
441 additions
and
159 deletions
+441
-159
common/conflex.c
common/conflex.c
+3
-1
common/discover.c
common/discover.c
+11
-2
dhcpctl/dhcpctl.c
dhcpctl/dhcpctl.c
+37
-0
dhcpctl/dhcpctl.h
dhcpctl/dhcpctl.h
+2
-0
dhcpctl/omshell.c
dhcpctl/omshell.c
+110
-14
includes/cf/linux.h
includes/cf/linux.h
+1
-1
includes/dhcpd.h
includes/dhcpd.h
+3
-2
includes/dhctoken.h
includes/dhctoken.h
+2
-1
includes/version.h
includes/version.h
+1
-1
omapip/alloc.c
omapip/alloc.c
+37
-29
omapip/connection.c
omapip/connection.c
+2
-0
omapip/hash.c
omapip/hash.c
+2
-2
omapip/message.c
omapip/message.c
+34
-8
omapip/protocol.c
omapip/protocol.c
+60
-1
omapip/support.c
omapip/support.c
+9
-4
server/bootp.c
server/bootp.c
+2
-5
server/db.c
server/db.c
+5
-2
server/dhcp.c
server/dhcp.c
+11
-41
server/failover.c
server/failover.c
+52
-26
server/mdb.c
server/mdb.c
+28
-3
server/omapi.c
server/omapi.c
+29
-16
No files found.
common/conflex.c
View file @
31bbee78
...
...
@@ -43,7 +43,7 @@
#ifndef lint
static
char
copyright
[]
=
"$Id: conflex.c,v 1.9
2
2001/05/
02 06:32:54
mellon Exp $ Copyright (c) 1995-2001 The Internet Software Consortium. All rights reserved.
\n
"
;
"$Id: conflex.c,v 1.9
3
2001/05/
17 19:03:43
mellon Exp $ Copyright (c) 1995-2001 The Internet Software Consortium. All rights reserved.
\n
"
;
#endif
/* not lint */
#include "dhcpd.h"
...
...
@@ -926,6 +926,8 @@ static enum dhcp_token intern (atom, dfv)
return
TOKEN_RESET
;
if
(
!
strcasecmp
(
atom
+
1
,
"eserved"
))
return
TOKEN_RESERVED
;
if
(
!
strcasecmp
(
atom
+
1
,
"emove"
))
return
REMOVE
;
break
;
case
's'
:
if
(
!
strcasecmp
(
atom
+
1
,
"tate"
))
...
...
common/discover.c
View file @
31bbee78
...
...
@@ -43,7 +43,7 @@
#ifndef lint
static
char
copyright
[]
=
"$Id: discover.c,v 1.4
2
2001/05/
02 06:36:5
4 mellon Exp $ Copyright (c) 1995-2001 The Internet Software Consortium. All rights reserved.
\n
"
;
"$Id: discover.c,v 1.4
3
2001/05/
17 19:03:4
4 mellon Exp $ Copyright (c) 1995-2001 The Internet Software Consortium. All rights reserved.
\n
"
;
#endif
/* not lint */
#include "dhcpd.h"
...
...
@@ -184,6 +184,15 @@ void discover_interfaces (state)
if
(
i
<
0
)
log_fatal
(
"ioctl: SIOCGIFCONF: %m"
);
#ifdef SIOCGIFCONF_ZERO_PROBE
/* Workaround for SIOCGIFCONF bug on some Linux versions. */
if
(
ic
.
ifc_ifcu
.
ifcu_buf
==
0
&&
ic
.
ifc_len
==
0
)
{
ic
.
ifc_len
=
sizeof
buf
;
ic
.
ifc_ifcu
.
ifcu_buf
=
(
caddr_t
)
buf
;
goto
gifconf_again
;
}
#endif
/* If the SIOCGIFCONF resulted in more data than would fit in
a buffer, allocate a bigger buffer. */
if
((
ic
.
ifc_ifcu
.
ifcu_buf
==
buf
...
...
@@ -198,7 +207,7 @@ void discover_interfaces (state)
#ifdef SIOCGIFCONF_ZERO_PROBE
}
else
if
(
ic
.
ifc_ifcu
.
ifcu_buf
==
0
)
{
ic
.
ifc_ifcu
.
ifcu_buf
=
(
caddr_t
)
buf
;
i
f
.
ifc_len
=
sizeof
buf
;
i
c
.
ifc_len
=
sizeof
buf
;
goto
gifconf_again
;
#endif
}
...
...
dhcpctl/dhcpctl.c
View file @
31bbee78
...
...
@@ -321,6 +321,43 @@ dhcpctl_status dhcpctl_set_string_value (dhcpctl_handle h, const char *value,
return
status
;
}
/* dhcpctl_set_buffer_value
Sets a NUL-terminated ASCII value on an object referred to by
a dhcpctl_handle. like dhcpctl_set_value, but saves the
trouble of creating a data_string for a NUL-terminated string.
Does not update the server - just sets the value on the handle. */
dhcpctl_status
dhcpctl_set_data_value
(
dhcpctl_handle
h
,
const
char
*
value
,
unsigned
len
,
const
char
*
value_name
)
{
isc_result_t
status
;
omapi_typed_data_t
*
tv
=
(
omapi_typed_data_t
*
)
0
;
omapi_data_string_t
*
name
=
(
omapi_data_string_t
*
)
0
;
int
ip
;
unsigned
ll
;
ll
=
strlen
(
value_name
);
status
=
omapi_data_string_new
(
&
name
,
ll
,
MDL
);
if
(
status
!=
ISC_R_SUCCESS
)
return
status
;
memcpy
(
name
->
value
,
value_name
,
ll
);
status
=
omapi_typed_data_new
(
MDL
,
&
tv
,
omapi_datatype_data
,
len
,
value
);
if
(
status
!=
ISC_R_SUCCESS
)
{
omapi_data_string_dereference
(
&
name
,
MDL
);
return
status
;
}
memcpy
(
tv
->
u
.
buffer
.
value
,
value
,
len
);
status
=
omapi_set_value
(
h
,
(
omapi_object_t
*
)
0
,
name
,
tv
);
omapi_data_string_dereference
(
&
name
,
MDL
);
omapi_typed_data_dereference
(
&
tv
,
MDL
);
return
status
;
}
/* dhcpctl_set_boolean_value
Sets a boolean value on an object - like dhcpctl_set_value,
...
...
dhcpctl/dhcpctl.h
View file @
31bbee78
...
...
@@ -85,6 +85,8 @@ dhcpctl_status dhcpctl_set_value (dhcpctl_handle,
dhcpctl_data_string
,
const
char
*
);
dhcpctl_status
dhcpctl_set_string_value
(
dhcpctl_handle
,
const
char
*
,
const
char
*
);
dhcpctl_status
dhcpctl_set_data_value
(
dhcpctl_handle
,
const
char
*
,
unsigned
,
const
char
*
);
dhcpctl_status
dhcpctl_set_boolean_value
(
dhcpctl_handle
,
int
,
const
char
*
);
dhcpctl_status
dhcpctl_set_int_value
(
dhcpctl_handle
,
int
,
const
char
*
);
dhcpctl_status
dhcpctl_object_update
(
dhcpctl_handle
,
dhcpctl_handle
);
...
...
dhcpctl/omshell.c
View file @
31bbee78
...
...
@@ -107,6 +107,13 @@ int main (int argc, char **argv, char **envp)
usage
(
argv
[
0
]);
}
/* Initially, log errors to stderr as well as to syslogd. */
#ifdef SYSLOG_4_2
openlog
(
"dhcpd"
,
LOG_NDELAY
);
log_priority
=
DHCPD_LOG_FACILITY
;
#else
openlog
(
"dhcpd"
,
LOG_NDELAY
,
DHCPD_LOG_FACILITY
);
#endif
status
=
dhcpctl_initialize
();
if
(
status
!=
ISC_R_SUCCESS
)
{
fprintf
(
stderr
,
"dhcpctl_initialize: %s
\n
"
,
...
...
@@ -208,7 +215,7 @@ int main (int argc, char **argv, char **envp)
if
(
se
)
port
=
ntohs
(
se
->
s_port
);
else
{
printf
(
"unknown service name: %s"
,
val
);
printf
(
"unknown service name: %s
\n
"
,
val
);
break
;
}
}
else
if
(
token
==
NUMBER
)
{
...
...
@@ -287,7 +294,7 @@ int main (int argc, char **argv, char **envp)
s
=
dmalloc
(
strlen
(
val
)
+
1
,
MDL
);
if
(
!
server
)
{
printf
(
"no memory to store server name."
);
printf
(
"no memory to store server name.
\n
"
);
skip_to_semi
(
cfile
);
break
;
}
...
...
@@ -305,13 +312,13 @@ int main (int argc, char **argv, char **envp)
case
KEY
:
token
=
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
if
(
!
is_identifier
(
token
))
{
printf
(
"usage: key <name> <value>"
);
printf
(
"usage: key <name> <value>
\n
"
);
skip_to_semi
(
cfile
);
break
;
}
s
=
dmalloc
(
strlen
(
val
)
+
1
,
MDL
);
if
(
!
s
)
{
printf
(
"no memory for key name."
);
printf
(
"no memory for key name.
\n
"
);
skip_to_semi
(
cfile
);
break
;
}
...
...
@@ -379,7 +386,7 @@ int main (int argc, char **argv, char **envp)
}
if
(
!
connected
)
{
printf
(
"not connected."
);
printf
(
"not connected.
\n
"
);
skip_to_semi
(
cfile
);
break
;
}
...
...
@@ -408,7 +415,7 @@ int main (int argc, char **argv, char **envp)
}
if
(
!
connected
)
{
printf
(
"not connected."
);
printf
(
"not connected.
\n
"
);
skip_to_semi
(
cfile
);
break
;
}
...
...
@@ -434,7 +441,7 @@ int main (int argc, char **argv, char **envp)
}
if
(
!
connected
)
{
printf
(
"not connected."
);
printf
(
"not connected.
\n
"
);
skip_to_semi
(
cfile
);
break
;
}
...
...
@@ -450,23 +457,77 @@ int main (int argc, char **argv, char **envp)
switch
(
token
)
{
case
STRING
:
dhcpctl_set_string_value
(
oh
,
val
,
s1
);
token
=
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
break
;
case
NUMBER
:
dhcpctl_set_int_value
(
oh
,
atoi
(
val
),
s1
);
strcpy
(
buf
,
val
);
token
=
peek_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
/* Colon-seperated hex list? */
if
(
token
==
COLON
)
goto
cshl
;
else
if
(
token
==
DOT
)
{
s
=
buf
;
val
=
buf
;
do
{
int
intval
=
atoi
(
val
);
if
(
intval
>
255
)
{
parse_warn
(
cfile
,
"dotted octet > 255: %s"
,
val
);
skip_to_semi
(
cfile
);
goto
badnum
;
}
*
s
++
=
intval
;
token
=
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
if
(
token
!=
DOT
)
break
;
token
=
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
}
while
(
token
==
NUMBER
);
dhcpctl_set_data_value
(
oh
,
buf
,
(
unsigned
)(
s
-
buf
),
s1
);
break
;
}
dhcpctl_set_int_value
(
oh
,
atoi
(
buf
),
s1
);
token
=
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
badnum:
break
;
case
NUMBER_OR_NAME
:
strcpy
(
buf
,
val
);
cshl:
s
=
buf
;
val
=
buf
;
do
{
convert_num
(
cfile
,
s
,
val
,
16
,
8
);
++
s
;
token
=
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
if
(
token
!=
COLON
)
break
;
token
=
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
}
while
(
token
==
NUMBER
||
token
==
NUMBER_OR_NAME
);
dhcpctl_set_data_value
(
oh
,
buf
,
(
unsigned
)(
s
-
buf
),
s1
);
break
;
default:
printf
(
"invalid value.
\n
"
);
skip_to_semi
(
cfile
);
}
token
=
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
if
(
token
!=
END_OF_FILE
&&
token
!=
EOL
)
goto
set_usage
;
break
;
case
TOKEN_CREATE
:
case
TOKEN_OPEN
:
i
=
token
;
token
=
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
if
(
token
!=
END_OF_FILE
&&
token
!=
EOL
)
{
printf
(
"usage: %s
\n
"
,
val
);
...
...
@@ -475,14 +536,21 @@ int main (int argc, char **argv, char **envp)
}
if
(
!
connected
)
{
printf
(
"not connected."
);
printf
(
"not connected.
\n
"
);
skip_to_semi
(
cfile
);
break
;
}
i
=
0
;
if
(
token
==
TOKEN_CREATE
)
if
(
!
oh
)
{
printf
(
"you must make a new object first!
\n
"
);
skip_to_semi
(
cfile
);
break
;
}
if
(
i
==
TOKEN_CREATE
)
i
=
DHCPCTL_CREATE
|
DHCPCTL_EXCL
;
else
i
=
0
;
status
=
dhcpctl_open_object
(
oh
,
connection
,
i
);
if
(
status
==
ISC_R_SUCCESS
)
...
...
@@ -507,7 +575,7 @@ int main (int argc, char **argv, char **envp)
}
if
(
!
connected
)
{
printf
(
"not connected."
);
printf
(
"not connected.
\n
"
);
skip_to_semi
(
cfile
);
break
;
}
...
...
@@ -524,9 +592,37 @@ int main (int argc, char **argv, char **envp)
break
;
}
break
;
case
REMOVE
:
token
=
next_token
(
&
val
,
(
unsigned
*
)
0
,
cfile
);
if
(
token
!=
END_OF_FILE
&&
token
!=
EOL
)
{
printf
(
"usage: %s
\n
"
,
val
);
skip_to_semi
(
cfile
);
break
;
}
if
(
!
connected
)
{
printf
(
"not connected.
\n
"
);
skip_to_semi
(
cfile
);
break
;
}
status
=
dhcpctl_object_remove
(
connection
,
oh
);
if
(
status
==
ISC_R_SUCCESS
)
status
=
dhcpctl_wait_for_completion
(
oh
,
&
waitstatus
);
if
(
status
==
ISC_R_SUCCESS
)
status
=
waitstatus
;
if
(
status
!=
ISC_R_SUCCESS
)
{
printf
(
"can't destroy object: %s
\n
"
,
isc_result_totext
(
status
));
break
;
}
break
;
}
}
while
(
token
!=
END_OF_FILE
);
}
while
(
1
);
exit
(
0
);
}
includes/cf/linux.h
View file @
31bbee78
...
...
@@ -125,7 +125,7 @@ extern int h_errno;
# define USE_LPF
# endif
# if !defined (__sparc__)
/* XXX hopefully this will be fixed someday */
# define SIOCGIFCONF_
NULL_BUF_GIVES_CORRECT_LEN
# define SIOCGIFCONF_
ZERO_PROBE
# endif
# define LINUX_SLASHPROC_DISCOVERY
# define PROCDEV_DEVICE "/proc/net/dev"
...
...
includes/dhcpd.h
View file @
31bbee78
...
...
@@ -2475,11 +2475,12 @@ void update_partner PROTO ((struct lease *));
int
load_balance_mine
(
struct
packet
*
,
dhcp_failover_state_t
*
);
binding_state_t
normal_binding_state_transition_check
(
struct
lease
*
,
dhcp_failover_state_t
*
,
binding_state_t
);
binding_state_t
,
u_int32_t
);
binding_state_t
conflict_binding_state_transition_check
(
struct
lease
*
,
dhcp_failover_state_t
*
,
binding_state_t
);
binding_state_t
,
u_int32_t
);
int
lease_mine_to_reallocate
(
struct
lease
*
);
OMAPI_OBJECT_ALLOC_DECL
(
dhcp_failover_state
,
dhcp_failover_state_t
,
...
...
includes/dhctoken.h
View file @
31bbee78
...
...
@@ -312,7 +312,8 @@ enum dhcp_token {
END_OF_FILE
=
607
,
RECOVER_WAIT
=
608
,
SERVER
=
609
,
CONNECT
=
610
CONNECT
=
610
,
REMOVE
=
611
};
#define is_identifier(x) ((x) >= FIRST_TOKEN && \
...
...
includes/version.h
View file @
31bbee78
/* Current version of ISC DHCP Distribution. */
#define DHCP_VERSION "V3.
0rc4
"
#define DHCP_VERSION "V3.
1-unreleased
"
omapip/alloc.c
View file @
31bbee78
...
...
@@ -293,35 +293,34 @@ void dmalloc_dump_outstanding ()
somewhere. */
if
(
dp
->
file
)
{
#if defined (DEBUG_RC_HISTORY)
int
i
,
count
,
inhistory
=
0
,
noted
=
0
;
/* If we have the info, see if this is actually
new garbage. */
if
(
rc_history_count
<
RC_HISTORY_MAX
)
{
int
i
,
printit
=
0
,
inhistory
=
0
,
prefcnt
=
0
;
i
=
rc_history_index
-
rc_history_count
;
if
(
i
<
0
)
i
+=
RC_HISTORY_MAX
;
do
{
if
(
rc_history
[
i
].
addr
==
dp
+
1
)
{
if
(
rc_history
[
i
].
refcnt
==
1
&&
prefcnt
==
0
&&
!
printit
)
{
printit
=
1
;
inhistory
=
1
;
log_info
(
" %s(%d): %d"
,
dp
->
file
,
dp
->
line
,
dp
->
size
);
}
prefcnt
=
rc_history
[
i
].
refcnt
;
if
(
printit
)
print_rc_hist_entry
(
i
);
}
if
(
++
i
==
RC_HISTORY_MAX
)
i
=
0
;
}
while
(
i
!=
rc_history_index
);
if
(
!
inhistory
)
log_info
(
" %s(%d): %d"
,
dp
->
file
,
dp
->
line
,
dp
->
size
);
count
=
rc_history_count
;
}
else
count
=
RC_HISTORY_MAX
;
i
=
rc_history_index
-
1
;
if
(
i
<
0
)
i
+=
RC_HISTORY_MAX
;
do
{
if
(
rc_history
[
i
].
addr
==
dp
+
1
)
{
inhistory
=
1
;
if
(
!
noted
)
{
log_info
(
" %s(%d): %d"
,
dp
->
file
,
dp
->
line
,
dp
->
size
);
noted
=
1
;
}
print_rc_hist_entry
(
i
);
if
(
!
rc_history
[
i
].
refcnt
)
break
;
}
if
(
--
i
<
0
)
i
=
RC_HISTORY_MAX
-
1
;
}
while
(
count
--
);
if
(
!
inhistory
)
#endif
log_info
(
" %s(%d): %d"
,
dp
->
file
,
dp
->
line
,
dp
->
size
);
...
...
@@ -516,16 +515,20 @@ isc_result_t omapi_object_dereference (omapi_object_t **h,
extra_references
=
0
;
for
(
p
=
(
*
h
)
->
inner
;
p
&&
!
extra_references
;
p
=
p
->
inner
)
{
extra_references
+=
p
->
refcnt
-
1
;
if
(
p
->
inner
)
extra_references
+=
p
->
refcnt
;
if
(
p
->
inner
&&
p
->
inner
->
outer
==
p
)
--
extra_references
;
if
(
p
->
outer
)
--
extra_references
;
if
(
p
->
handle
)
--
extra_references
;
}
for
(
p
=
(
*
h
)
->
outer
;
p
&&
!
extra_references
;
p
=
p
->
outer
)
{
extra_references
+=
p
->
refcnt
-
1
;
if
(
p
->
outer
)
extra_references
+=
p
->
refcnt
;
if
(
p
->
outer
&&
p
->
outer
->
inner
==
p
)
--
extra_references
;
if
(
p
->
inner
)
--
extra_references
;
if
(
p
->
handle
)
--
extra_references
;
...
...
@@ -549,6 +552,11 @@ isc_result_t omapi_object_dereference (omapi_object_t **h,
((
*
h
)
->
type
->
freer
(
*
h
,
file
,
line
));
else
dfree
(
*
h
,
file
,
line
);
}
else
{
(
*
h
)
->
refcnt
--
;
if
(
!
(
*
h
)
->
type
->
freer
)
rc_register
(
file
,
line
,
h
,
*
h
,
(
*
h
)
->
refcnt
);
}
}
else
{
(
*
h
)
->
refcnt
--
;
...
...
omapip/connection.c
View file @
31bbee78
...
...
@@ -273,6 +273,7 @@ void omapi_connection_register (omapi_connection_object_t *obj,
return
;
}
#if defined (TRACING)
if
(
trace_record
())
{
/* Connection registration packet:
...
...
@@ -305,6 +306,7 @@ void omapi_connection_register (omapi_connection_object_t *obj,
status
=
trace_write_packet_iov
(
trace_connect
,
iov_count
,
iov
,
file
,
line
);
}
#endif
}
static
void
trace_connect_input
(
trace_type_t
*
ttype
,
...
...
omapip/hash.c
View file @
31bbee78
...
...
@@ -3,7 +3,7 @@
Routines for manipulating hash tables... */
/*
* Copyright (c) 1995-200
0
Internet Software Consortium.
* Copyright (c) 1995-200
1
Internet Software Consortium.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
...
...
@@ -43,7 +43,7 @@
#ifndef lint
static
char
copyright
[]
=
"$Id: hash.c,v 1.
1
200
0
/0
8/01 22:55:07 neild
Exp $ Copyright (c) 1995-2000 The Internet Software Consortium. All rights reserved.
\n
"
;
"$Id: hash.c,v 1.
2
200
1
/0
5/17 19:03:57 mellon
Exp $ Copyright (c) 1995-2000 The Internet Software Consortium. All rights reserved.
\n
"
;
#endif
/* not lint */
#include <omapip/omapip_p.h>
...
...
omapip/message.c
View file @
31bbee78
...
...
@@ -54,13 +54,10 @@ isc_result_t omapi_message_new (omapi_object_t **o, const char *file, int line)
omapi_object_t
*
g
;
isc_result_t
status
;
m
=
dmalloc
(
sizeof
*
m
,
file
,
line
);
if
(
!
m
)
return
ISC_R_NOMEMORY
;
memset
(
m
,
0
,
sizeof
*
m
);
m
->
type
=
omapi_type_message
;
rc_register
(
file
,
line
,
&
m
,
m
,
m
->
refcnt
);
m
->
refcnt
=
1
;
m
=
(
omapi_message_object_t
*
)
0
;
status
=
omapi_message_allocate
(
&
m
,
file
,
line
);
if
(
status
!=
ISC_R_SUCCESS
)
return
status
;
g
=
(
omapi_object_t
*
)
0
;
status
=
omapi_generic_new
(
&
g
,
file
,
line
);
...
...
@@ -84,7 +81,7 @@ isc_result_t omapi_message_new (omapi_object_t **o, const char *file, int line)
}
status
=
omapi_object_reference
(
o
,
(
omapi_object_t
*
)
m
,
file
,
line
);
omapi_
object
_dereference
(
(
omapi_object_t
**
)
&
m
,
file
,
line
);
omapi_
message
_dereference
(
&
m
,
file
,
line
);
omapi_object_dereference
(
&
g
,
file
,
line
);
if
(
status
!=
ISC_R_SUCCESS
)
return
status
;
...
...
@@ -369,7 +366,36 @@ static const char *omapi_message_op_name(int op) {
}
#endif
static
isc_result_t
omapi_message_process_internal
(
omapi_object_t
*
,
omapi_object_t
*
);
isc_result_t
omapi_message_process
(
omapi_object_t
*
mo
,
omapi_object_t
*
po
)
{
isc_result_t
status
;
#if defined (DEBUG_MEMORY_LEAKAGE)
unsigned
long
previous_outstanding
=
dmalloc_outstanding
;
#endif
status
=
omapi_message_process_internal
(
mo
,
po
);
#if defined (DEBUG_MEMORY_LEAKAGE) && 0
log_info
(
"generation %ld: %ld new, %ld outstanding, %ld long-term"
,
dmalloc_generation
,
dmalloc_outstanding
-
previous_outstanding
,
dmalloc_outstanding
,
dmalloc_longterm
);
#endif
#if (defined (DEBUG_MEMORY_LEAKAGE) || defined (DEBUG_MALLOC_POOL)) && 0
dmalloc_dump_outstanding
();
#endif
#if defined (DEBUG_RC_HISTORY_EXHAUSTIVELY) && 0
dump_rc_history
();
#endif
return
status
;
}
static
isc_result_t
omapi_message_process_internal
(
omapi_object_t
*
mo
,
omapi_object_t
*
po
)
{
omapi_message_object_t
*
message
,
*
m
;
omapi_object_t
*
object
=
(
omapi_object_t
*
)
0
;
...
...
omapip/protocol.c
View file @
31bbee78
...
...
@@ -357,6 +357,10 @@ isc_result_t omapi_protocol_signal_handler (omapi_object_t *h,
u_int16_t
nlen
;
u_int32_t
vlen
;
u_int32_t
th
;
#if defined (DEBUG_MEMORY_LEAKAGE)
unsigned
long
previous_outstanding
=
0xBEADCAFE
;
unsigned
long
connect_outstanding
=
0xBEADCAFE
;
#endif
if
(
h
->
type
!=
omapi_type_protocol
)
{
/* XXX shouldn't happen. Put an assert here? */
...
...
@@ -365,6 +369,9 @@ isc_result_t omapi_protocol_signal_handler (omapi_object_t *h,
p
=
(
omapi_protocol_object_t
*
)
h
;
if
(
!
strcmp
(
name
,
"connect"
))
{
#if defined (DEBUG_MEMORY_LEAKAGE)
connect_outstanding
=
dmalloc_outstanding
;
#endif
/* Send the introductory message. */
status
=
omapi_protocol_send_intro
(
h
,
OMAPI_PROTOCOL_VERSION
,
...
...
@@ -389,6 +396,26 @@ isc_result_t omapi_protocol_signal_handler (omapi_object_t *h,
}
}
/* If we get a disconnect, dump memory usage. */
if
(
!
strcmp
(
name
,
"disconnect"
)
#if defined (DEBUG_MEMORY_LEAKAGE)
&&
connect_outstanding
!=
0xBEADCAFE
#endif
)
{
#if defined (DEBUG_MEMORY_LEAKAGE)
log_info
(
"generation %ld: %ld new, %ld outstanding, %ld%s"
,
dmalloc_generation
,
dmalloc_outstanding
-
previous_outstanding
,
dmalloc_outstanding
,
dmalloc_longterm
,
" long-term"
);
#endif
#if (defined (DEBUG_MEMORY_LEAKAGE) || defined (DEBUG_MALLOC_POOL))
dmalloc_dump_outstanding
();
#endif
#if defined (DEBUG_RC_HISTORY_EXHAUSTIVELY)
dump_rc_history
();
#endif
}
/* Not a signal we recognize? */
if
(
strcmp
(
name
,
"ready"
))
{
if
(
p
->
inner
&&
p
->
inner
->
type
->
signal_handler
)
...
...
@@ -449,6 +476,24 @@ isc_result_t omapi_protocol_signal_handler (omapi_object_t *h,
/* If we already have the data, fall through. */
case
omapi_protocol_header_wait
:
#if defined (DEBUG_MEMORY_LEAKAGE)
if
(
previous_outstanding
!=
0xBEADCAFE
)
{
log_info
(
"%s %ld: %ld new, %ld outstanding, %ld%s"
,
"generation"
,
dmalloc_generation
,
dmalloc_outstanding
-
previous_outstanding
,
dmalloc_outstanding
,
dmalloc_longterm
,
" long-term"
);
#endif