2
0
mirror of https://gitlab.isc.org/isc-projects/dhcp synced 2025-08-30 05:47:45 +00:00

Fixed many compilation problems ("set, but not used" warnings) for

gcc 4.6 that may affect Ubuntu 11.10 users. [ISC-Bugs #27588]
This commit is contained in:
Tomek Mrugalski 2012-03-09 11:18:14 +00:00
parent 9a266235e6
commit dd9237c309
19 changed files with 257 additions and 157 deletions

View File

@ -94,6 +94,9 @@ work on other platforms. Please report any problems and suggested fixes to
checking programs to eliminate false positives. checking programs to eliminate false positives.
[ISC-Bugs 27539] [ISC-Bugs 27539]
- Fixed many compilation problems ("set, but not used" warnings) for
gcc 4.6 that may affect Ubuntu 11.10 users. [ISC-Bugs #27588]
Changes since 4.2.2 Changes since 4.2.2
- Fix the code that checks for an existing DDNS transaction to cancel - Fix the code that checks for an existing DDNS transaction to cancel

View File

@ -3,7 +3,7 @@
Parser for dhclient config and lease files... */ Parser for dhclient config and lease files... */
/* /*
* Copyright (c) 2004-2011 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2004-2012 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1996-2003 by Internet Software Consortium * Copyright (c) 1996-2003 by Internet Software Consortium
* *
* Permission to use, copy, modify, and distribute this software for any * Permission to use, copy, modify, and distribute this software for any
@ -59,10 +59,18 @@ isc_result_t read_client_conf ()
{ {
struct client_config *config; struct client_config *config;
struct interface_info *ip; struct interface_info *ip;
struct parse *parse;
isc_result_t status; isc_result_t status;
unsigned code; unsigned code;
/*
* TODO: LATER constant is very undescriptive. We should review it and
* change it to something more descriptive or even better remove it
* completely as it is currently not used.
*/
#ifdef LATER
struct parse *parse = NULL;
#endif
/* Initialize the default request list. */ /* Initialize the default request list. */
memset(default_requested_options, 0, sizeof(default_requested_options)); memset(default_requested_options, 0, sizeof(default_requested_options));
@ -159,7 +167,6 @@ isc_result_t read_client_conf ()
(struct interface_info *)0, (struct interface_info *)0,
&top_level_config); &top_level_config);
parse = NULL;
if (status != ISC_R_SUCCESS) { if (status != ISC_R_SUCCESS) {
; ;
#ifdef LATER #ifdef LATER

View File

@ -1899,11 +1899,14 @@ void send_discover (cpp)
ntohs (sockaddr_broadcast.sin_port), (long)(client -> interval)); ntohs (sockaddr_broadcast.sin_port), (long)(client -> interval));
/* Send out a packet. */ /* Send out a packet. */
result = send_packet (client -> interface, (struct packet *)0, result = send_packet(client->interface, NULL, &client->packet,
&client -> packet, client->packet_length, inaddr_any,
client -> packet_length, &sockaddr_broadcast, NULL);
inaddr_any, &sockaddr_broadcast, if (result < 0) {
(struct hardware *)0); log_error("%s:%d: Failed to send %d byte long packet over %s "
"interface.", MDL, client->packet_length,
client->interface->name);
}
/* /*
* If we used 0 microseconds here, and there were other clients on the * If we used 0 microseconds here, and there were other clients on the
@ -2166,20 +2169,29 @@ void send_request (cpp)
ntohs (destination.sin_port)); ntohs (destination.sin_port));
if (destination.sin_addr.s_addr != INADDR_BROADCAST && if (destination.sin_addr.s_addr != INADDR_BROADCAST &&
fallback_interface) fallback_interface) {
result = send_packet (fallback_interface, result = send_packet(fallback_interface, NULL, &client->packet,
(struct packet *)0, client->packet_length, from, &destination,
&client -> packet, NULL);
client -> packet_length, if (result < 0) {
from, &destination, log_error("%s:%d: Failed to send %d byte long packet "
(struct hardware *)0); "over %s interface.", MDL,
else client->packet_length,
fallback_interface->name);
}
}
else {
/* Send out a packet. */ /* Send out a packet. */
result = send_packet (client -> interface, (struct packet *)0, result = send_packet(client->interface, NULL, &client->packet,
&client -> packet, client->packet_length, from, &destination,
client -> packet_length, NULL);
from, &destination, if (result < 0) {
(struct hardware *)0); log_error("%s:%d: Failed to send %d byte long packet"
" over %s interface.", MDL,
client->packet_length,
client->interface->name);
}
}
tv.tv_sec = cur_tv.tv_sec + client->interval; tv.tv_sec = cur_tv.tv_sec + client->interval;
tv.tv_usec = ((tv.tv_sec - cur_tv.tv_sec) > 1) ? tv.tv_usec = ((tv.tv_sec - cur_tv.tv_sec) > 1) ?
@ -2195,16 +2207,19 @@ void send_decline (cpp)
int result; int result;
log_info ("DHCPDECLINE on %s to %s port %d", log_info ("DHCPDECLINE on %s to %s port %d",
client -> name ? client -> name : client -> interface -> name, client->name ? client->name : client->interface->name,
inet_ntoa (sockaddr_broadcast.sin_addr), inet_ntoa(sockaddr_broadcast.sin_addr),
ntohs (sockaddr_broadcast.sin_port)); ntohs(sockaddr_broadcast.sin_port));
/* Send out a packet. */ /* Send out a packet. */
result = send_packet (client -> interface, (struct packet *)0, result = send_packet(client->interface, NULL, &client->packet,
&client -> packet, client->packet_length, inaddr_any,
client -> packet_length, &sockaddr_broadcast, NULL);
inaddr_any, &sockaddr_broadcast, if (result < 0) {
(struct hardware *)0); log_error("%s:%d: Failed to send %d byte long packet over %s"
" interface.", MDL, client->packet_length,
client->interface->name);
}
} }
void send_release (cpp) void send_release (cpp)
@ -2242,20 +2257,29 @@ void send_release (cpp)
inet_ntoa (destination.sin_addr), inet_ntoa (destination.sin_addr),
ntohs (destination.sin_port)); ntohs (destination.sin_port));
if (fallback_interface) if (fallback_interface) {
result = send_packet (fallback_interface, result = send_packet(fallback_interface, NULL, &client->packet,
(struct packet *)0, client->packet_length, from, &destination,
&client -> packet, NULL);
client -> packet_length, if (result < 0) {
from, &destination, log_error("%s:%d: Failed to send %d byte long packet"
(struct hardware *)0); " over %s interface.", MDL,
else client->packet_length,
fallback_interface->name);
}
} else {
/* Send out a packet. */ /* Send out a packet. */
result = send_packet (client -> interface, (struct packet *)0, result = send_packet(client->interface, NULL, &client->packet,
&client -> packet, client->packet_length, from, &destination,
client -> packet_length, NULL);
from, &destination, if (result < 0) {
(struct hardware *)0); log_error ("%s:%d: Failed to send %d byte long packet"
" over %s interface.", MDL,
client->packet_length,
client->interface->name);
}
}
} }
void void
@ -3220,7 +3244,6 @@ void script_write_params (client, prefix, lease)
} }
} }
for (i = 0; i < lease -> options -> universe_count; i++) { for (i = 0; i < lease -> options -> universe_count; i++) {
option_space_foreach ((struct packet *)0, (struct lease *)0, option_space_foreach ((struct packet *)0, (struct lease *)0,
client, (struct option_state *)0, client, (struct option_state *)0,

View File

@ -3,6 +3,7 @@
OMAPI object interfaces for the DHCP server. */ OMAPI object interfaces for the DHCP server. */
/* /*
* Copyright (c) 2012 Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 2004-2007,2009 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2004-2007,2009 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1999-2003 by Internet Software Consortium * Copyright (c) 1999-2003 by Internet Software Consortium
* *
@ -435,7 +436,7 @@ isc_result_t dhcp_group_remove (omapi_object_t *lp,
status = dhcp_group_destroy ((omapi_object_t *)group, MDL); status = dhcp_group_destroy ((omapi_object_t *)group, MDL);
return ISC_R_SUCCESS; return status;
} }
isc_result_t dhcp_control_set_value (omapi_object_t *h, isc_result_t dhcp_control_set_value (omapi_object_t *h,
@ -511,12 +512,12 @@ isc_result_t dhcp_control_destroy (omapi_object_t *h,
isc_result_t dhcp_control_signal_handler (omapi_object_t *h, isc_result_t dhcp_control_signal_handler (omapi_object_t *h,
const char *name, va_list ap) const char *name, va_list ap)
{ {
dhcp_control_object_t *control; /* In this function h should be a (dhcp_control_object_t *) */
isc_result_t status; isc_result_t status;
if (h -> type != dhcp_type_control) if (h -> type != dhcp_type_control)
return DHCP_R_INVALIDARG; return DHCP_R_INVALIDARG;
control = (dhcp_control_object_t *)h;
/* Try to find some inner object that can take the value. */ /* Try to find some inner object that can take the value. */
if (h -> inner && h -> inner -> type -> get_value) { if (h -> inner && h -> inner -> type -> get_value) {
@ -612,12 +613,12 @@ isc_result_t dhcp_subnet_set_value (omapi_object_t *h,
omapi_data_string_t *name, omapi_data_string_t *name,
omapi_typed_data_t *value) omapi_typed_data_t *value)
{ {
struct subnet *subnet; /* In this function h should be a (struct subnet *) */
isc_result_t status; isc_result_t status;
if (h -> type != dhcp_type_subnet) if (h -> type != dhcp_type_subnet)
return DHCP_R_INVALIDARG; return DHCP_R_INVALIDARG;
subnet = (struct subnet *)h;
/* No values to set yet. */ /* No values to set yet. */
@ -637,12 +638,12 @@ isc_result_t dhcp_subnet_get_value (omapi_object_t *h, omapi_object_t *id,
omapi_data_string_t *name, omapi_data_string_t *name,
omapi_value_t **value) omapi_value_t **value)
{ {
struct subnet *subnet; /* In this function h should be a (struct subnet *) */
isc_result_t status; isc_result_t status;
if (h -> type != dhcp_type_subnet) if (h -> type != dhcp_type_subnet)
return DHCP_R_INVALIDARG; return DHCP_R_INVALIDARG;
subnet = (struct subnet *)h;
/* No values to get yet. */ /* No values to get yet. */
@ -658,14 +659,17 @@ isc_result_t dhcp_subnet_get_value (omapi_object_t *h, omapi_object_t *id,
isc_result_t dhcp_subnet_destroy (omapi_object_t *h, const char *file, int line) isc_result_t dhcp_subnet_destroy (omapi_object_t *h, const char *file, int line)
{ {
#if defined (DEBUG_MEMORY_LEAKAGE) || \
defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
struct subnet *subnet; struct subnet *subnet;
#endif
if (h -> type != dhcp_type_subnet) if (h -> type != dhcp_type_subnet)
return DHCP_R_INVALIDARG; return DHCP_R_INVALIDARG;
subnet = (struct subnet *)h;
#if defined (DEBUG_MEMORY_LEAKAGE) || \ #if defined (DEBUG_MEMORY_LEAKAGE) || \
defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT) defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
subnet = (struct subnet *)h;
if (subnet -> next_subnet) if (subnet -> next_subnet)
subnet_dereference (&subnet -> next_subnet, file, line); subnet_dereference (&subnet -> next_subnet, file, line);
if (subnet -> next_sibling) if (subnet -> next_sibling)
@ -685,13 +689,13 @@ isc_result_t dhcp_subnet_destroy (omapi_object_t *h, const char *file, int line)
isc_result_t dhcp_subnet_signal_handler (omapi_object_t *h, isc_result_t dhcp_subnet_signal_handler (omapi_object_t *h,
const char *name, va_list ap) const char *name, va_list ap)
{ {
struct subnet *subnet; /* In this function h should be a (struct subnet *) */
isc_result_t status; isc_result_t status;
int updatep = 0; int updatep = 0;
if (h -> type != dhcp_type_subnet) if (h -> type != dhcp_type_subnet)
return DHCP_R_INVALIDARG; return DHCP_R_INVALIDARG;
subnet = (struct subnet *)h;
/* Can't write subnets yet. */ /* Can't write subnets yet. */
@ -711,12 +715,12 @@ isc_result_t dhcp_subnet_stuff_values (omapi_object_t *c,
omapi_object_t *id, omapi_object_t *id,
omapi_object_t *h) omapi_object_t *h)
{ {
struct subnet *subnet; /* In this function h should be a (struct subnet *) */
isc_result_t status; isc_result_t status;
if (h -> type != dhcp_type_subnet) if (h -> type != dhcp_type_subnet)
return DHCP_R_INVALIDARG; return DHCP_R_INVALIDARG;
subnet = (struct subnet *)h;
/* Can't stuff subnet values yet. */ /* Can't stuff subnet values yet. */
@ -761,12 +765,12 @@ isc_result_t dhcp_shared_network_set_value (omapi_object_t *h,
omapi_data_string_t *name, omapi_data_string_t *name,
omapi_typed_data_t *value) omapi_typed_data_t *value)
{ {
struct shared_network *shared_network; /* In this function h should be a (struct shared_network *) */
isc_result_t status; isc_result_t status;
if (h -> type != dhcp_type_shared_network) if (h -> type != dhcp_type_shared_network)
return DHCP_R_INVALIDARG; return DHCP_R_INVALIDARG;
shared_network = (struct shared_network *)h;
/* No values to set yet. */ /* No values to set yet. */
@ -787,12 +791,12 @@ isc_result_t dhcp_shared_network_get_value (omapi_object_t *h,
omapi_data_string_t *name, omapi_data_string_t *name,
omapi_value_t **value) omapi_value_t **value)
{ {
struct shared_network *shared_network; /* In this function h should be a (struct shared_network *) */
isc_result_t status; isc_result_t status;
if (h -> type != dhcp_type_shared_network) if (h -> type != dhcp_type_shared_network)
return DHCP_R_INVALIDARG; return DHCP_R_INVALIDARG;
shared_network = (struct shared_network *)h;
/* No values to get yet. */ /* No values to get yet. */
@ -809,14 +813,19 @@ isc_result_t dhcp_shared_network_get_value (omapi_object_t *h,
isc_result_t dhcp_shared_network_destroy (omapi_object_t *h, isc_result_t dhcp_shared_network_destroy (omapi_object_t *h,
const char *file, int line) const char *file, int line)
{ {
struct shared_network *shared_network; /* In this function h should be a (struct shared_network *) */
if (h -> type != dhcp_type_shared_network)
return DHCP_R_INVALIDARG;
shared_network = (struct shared_network *)h;
#if defined (DEBUG_MEMORY_LEAKAGE) || \ #if defined (DEBUG_MEMORY_LEAKAGE) || \
defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT) defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
struct shared_network *shared_network;
#endif
if (h -> type != dhcp_type_shared_network)
return DHCP_R_INVALIDARG;
#if defined (DEBUG_MEMORY_LEAKAGE) || \
defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
shared_network = (struct shared_network *)h;
if (shared_network -> next) if (shared_network -> next)
shared_network_dereference (&shared_network -> next, shared_network_dereference (&shared_network -> next,
file, line); file, line);
@ -849,13 +858,13 @@ isc_result_t dhcp_shared_network_signal_handler (omapi_object_t *h,
const char *name, const char *name,
va_list ap) va_list ap)
{ {
struct shared_network *shared_network; /* In this function h should be a (struct shared_network *) */
isc_result_t status; isc_result_t status;
int updatep = 0; int updatep = 0;
if (h -> type != dhcp_type_shared_network) if (h -> type != dhcp_type_shared_network)
return DHCP_R_INVALIDARG; return DHCP_R_INVALIDARG;
shared_network = (struct shared_network *)h;
/* Can't write shared_networks yet. */ /* Can't write shared_networks yet. */
@ -875,12 +884,12 @@ isc_result_t dhcp_shared_network_stuff_values (omapi_object_t *c,
omapi_object_t *id, omapi_object_t *id,
omapi_object_t *h) omapi_object_t *h)
{ {
struct shared_network *shared_network; /* In this function h should be a (struct shared_network *) */
isc_result_t status; isc_result_t status;
if (h -> type != dhcp_type_shared_network) if (h -> type != dhcp_type_shared_network)
return DHCP_R_INVALIDARG; return DHCP_R_INVALIDARG;
shared_network = (struct shared_network *)h;
/* Can't stuff shared_network values yet. */ /* Can't stuff shared_network values yet. */

View File

@ -3,7 +3,7 @@
DHCP options parsing and reassembly. */ DHCP options parsing and reassembly. */
/* /*
* Copyright (c) 2004-2011 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2004-2012 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1995-2003 by Internet Software Consortium * Copyright (c) 1995-2003 by Internet Software Consortium
* *
* Permission to use, copy, modify, and distribute this software for any * Permission to use, copy, modify, and distribute this software for any
@ -2361,7 +2361,7 @@ prepare_option_buffer(struct universe *universe, struct buffer *bp,
cleanup: cleanup:
option_dereference(&option, MDL); option_dereference(&option, MDL);
return 1; return status;
} }
static void static void

View File

@ -907,7 +907,7 @@ parse_date_core(cfile)
struct parse *cfile; struct parse *cfile;
{ {
int guess; int guess;
int tzoff, wday, year, mon, mday, hour, min, sec; int tzoff, year, mon, mday, hour, min, sec;
const char *val; const char *val;
enum dhcp_token token; enum dhcp_token token;
static int months[11] = { 31, 59, 90, 120, 151, 181, static int months[11] = { 31, 59, 90, 120, 151, 181,
@ -945,7 +945,7 @@ parse_date_core(cfile)
return((TIME)0); return((TIME)0);
} }
token = next_token(&val, NULL, cfile); /* consume day of week */ token = next_token(&val, NULL, cfile); /* consume day of week */
wday = atoi(val); /* we are not using this for anything */
/* Year... */ /* Year... */
token = peek_token(&val, NULL, cfile); token = peek_token(&val, NULL, cfile);
@ -3390,11 +3390,10 @@ int parse_boolean_expression (expr, cfile, lose)
int parse_boolean (cfile) int parse_boolean (cfile)
struct parse *cfile; struct parse *cfile;
{ {
enum dhcp_token token;
const char *val; const char *val;
int rv; int rv;
token = next_token (&val, (unsigned *)0, cfile); (void)next_token(&val, NULL, cfile);
if (!strcasecmp (val, "true") if (!strcasecmp (val, "true")
|| !strcasecmp (val, "on")) || !strcasecmp (val, "on"))
rv = 1; rv = 1;

View File

@ -3,7 +3,7 @@
Turn data structures into printable text. */ Turn data structures into printable text. */
/* /*
* Copyright (c) 2009-2011 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2009-2012 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 2004-2007 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2004-2007 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1995-2003 by Internet Software Consortium * Copyright (c) 1995-2003 by Internet Software Consortium
* *
@ -479,10 +479,9 @@ char *print_dotted_quads (len, data)
{ {
static char dq_buf [DQLEN + 1]; static char dq_buf [DQLEN + 1];
int i; int i;
char *s, *last; char *s;
s = &dq_buf [0]; s = &dq_buf [0];
last = s;
i = 0; i = 0;

View File

@ -1000,6 +1000,9 @@ isc_result_t fallback_discard (object)
log_error ("fallback_discard: %m"); log_error ("fallback_discard: %m");
return ISC_R_UNEXPECTED; return ISC_R_UNEXPECTED;
} }
#else
/* ignore the fact that status value is never used */
IGNORE_UNUSED(status);
#endif #endif
return ISC_R_SUCCESS; return ISC_R_SUCCESS;
} }

View File

@ -1,9 +1,10 @@
#ifndef LINT #ifndef LINT
static const char rcsid[] = "$Header: /tmp/cvstest/DHCP/dst/prandom.c,v 1.9 2009/11/24 02:06:56 sar Exp $"; static const char rcsid[] = "$Header: /tmp/cvstest/DHCP/dst/prandom.c,v 1.10 2012/03/09 11:18:13 tomasz Exp $";
#endif #endif
/* /*
* Portions Copyright (c) 1995-1998 by Trusted Information Systems, Inc. * Portions Copyright (c) 2012 by Internet Systems Consortium, Inc. ("ISC")
* Portions Copyright (c) 2007,2009 by Internet Systems Consortium, Inc. ("ISC") * Portions Copyright (c) 2007,2009 by Internet Systems Consortium, Inc. ("ISC")
* Portions Copyright (c) 1995-1998 by Trusted Information Systems, Inc.
* *
* Permission to use, copy modify, and distribute this software for any * Permission to use, copy modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -694,7 +695,6 @@ own_random(dst_work *work)
{ {
int dir = 0, b; int dir = 0, b;
int bytes, n, cmd = 0, dig = 0; int bytes, n, cmd = 0, dig = 0;
int start =0;
/* /*
* now get the initial seed to put into the quick random function from * now get the initial seed to put into the quick random function from
* the address of the work structure * the address of the work structure
@ -709,7 +709,6 @@ own_random(dst_work *work)
/* pick a random number in the range of 0..7 based on that random number /* pick a random number in the range of 0..7 based on that random number
* perform some operations that yield random data * perform some operations that yield random data
*/ */
start = work->filled;
n = (dst_s_quick_random(bytes) >> DST_SHIFT) & 0x07; n = (dst_s_quick_random(bytes) >> DST_SHIFT) & 0x07;
switch (n) { switch (n) {
case 0: case 0:

View File

@ -4,7 +4,7 @@
/* /*
* Copyright (c) 1995 RadioMail Corporation. All rights reserved. * Copyright (c) 1995 RadioMail Corporation. All rights reserved.
* Copyright (c) 2011 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2011,2012 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 2004,2009 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2004,2009 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1996-2003 by Internet Software Consortium * Copyright (c) 1996-2003 by Internet Software Consortium
* *
@ -46,15 +46,25 @@
* the warning by the use of void. In conjunction with the use of -Werror * the warning by the use of void. In conjunction with the use of -Werror
* these warnings prohibit the compilation of the package. This macro * these warnings prohibit the compilation of the package. This macro
* allows us to assign the return value to a variable and then ignore it. * allows us to assign the return value to a variable and then ignore it.
*
* __attribute__((unused)) is added for avoiding another warning about set,
* but unused variable. This is produced by unused-but-set-variable switch
* that is enabled by default in gcc 4.6.
*/ */
#if !defined(__GNUC__) || (__GNUC__ < 4) #if !defined(__GNUC__) || (__GNUC__ < 4)
#define IGNORE_RET(x) (void) x #define IGNORE_RET(x) (void) x
#else #else
#define IGNORE_RET(x) \ #define IGNORE_RET(x) \
do { \ do { \
int ignore_return; \ int __attribute__((unused)) ignore_return ;\
ignore_return = x; \ ignore_return = x; \
} while (0) } while (0)
#endif #endif
/* This macro is defined to avoid unused-but-set-variable warning
* that is enabled in gcc 4.6
*/
#define IGNORE_UNUSED(x) { x = x; }
#endif /* __ISC_DHCP_CDEFS_H__ */ #endif /* __ISC_DHCP_CDEFS_H__ */

View File

@ -3,7 +3,7 @@
Functions for maintaining handles on objects. */ Functions for maintaining handles on objects. */
/* /*
* Copyright (c) 2009-2010 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2009-2010,2012 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 2004-2007 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2004-2007 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1999-2003 by Internet Software Consortium * Copyright (c) 1999-2003 by Internet Software Consortium
* *
@ -252,7 +252,6 @@ static isc_result_t omapi_handle_lookup_in (omapi_object_t **o,
omapi_handle_table_t *table, omapi_handle_table_t *table,
int op) int op)
{ {
omapi_handle_table_t *inner;
omapi_handle_t scale, index; omapi_handle_t scale, index;
if (!table || table->first > h || table->limit <= h) if (!table || table->first > h || table->limit <= h)
@ -282,7 +281,6 @@ static isc_result_t omapi_handle_lookup_in (omapi_object_t **o,
handle must be the subtable of this table whose index into this handle must be the subtable of this table whose index into this
table's array of children is the handle divided by the scale. */ table's array of children is the handle divided by the scale. */
index = (h - table->first) / scale; index = (h - table->first) / scale;
inner = table->children[index].table;
return(omapi_handle_lookup_in(o, h, table->children[index].table, op)); return(omapi_handle_lookup_in(o, h, table->children[index].table, op));
} }

View File

@ -3,6 +3,7 @@
Subroutines that support the generic listener object. */ Subroutines that support the generic listener object. */
/* /*
* Copyright (c) 2012 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 2004,2007,2009 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2004,2007,2009 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1999-2003 by Internet Software Consortium * Copyright (c) 1999-2003 by Internet Software Consortium
* *
@ -369,6 +370,10 @@ static void trace_listener_accept_input (trace_type_t *ttype,
obj = (omapi_connection_object_t *)0; obj = (omapi_connection_object_t *)0;
status = omapi_listener_connect (&obj, status = omapi_listener_connect (&obj,
lp, 0, &remote_addr); lp, 0, &remote_addr);
if (status != ISC_R_SUCCESS) {
log_error("%s:%d: OMAPI: Failed to connect "
"a listener.", MDL);
}
omapi_listener_dereference (&lp, MDL); omapi_listener_dereference (&lp, MDL);
return; return;
} }

View File

@ -3,7 +3,8 @@
BOOTP Protocol support. */ BOOTP Protocol support. */
/* /*
* Copyright (c) 2004,2005,2007,2009 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2009,2012 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 2004,2005,2007 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1995-2003 by Internet Software Consortium * Copyright (c) 1995-2003 by Internet Software Consortium
* *
* Permission to use, copy, modify, and distribute this software for any * Permission to use, copy, modify, and distribute this software for any
@ -384,10 +385,16 @@ void bootp (packet)
to.sin_port = local_port; to.sin_port = local_port;
if (fallback_interface) { if (fallback_interface) {
result = send_packet (fallback_interface, result = send_packet (fallback_interface, NULL, &raw,
(struct packet *)0, outgoing.packet_length, from,
&raw, outgoing.packet_length, &to, &hto);
from, &to, &hto); if (result < 0) {
log_error ("%s:%d: Failed to send %d byte long "
"packet over %s interface.", MDL,
outgoing.packet_length,
fallback_interface->name);
}
goto out; goto out;
} }
@ -407,10 +414,16 @@ void bootp (packet)
} }
errno = 0; errno = 0;
result = send_packet (packet -> interface, result = send_packet(packet->interface, packet, &raw,
packet, &raw, outgoing.packet_length, outgoing.packet_length, from, &to, &hto);
from, &to, &hto); if (result < 0) {
log_error ("%s:%d: Failed to send %d byte long packet over %s"
" interface.", MDL, outgoing.packet_length,
packet->interface->name);
}
out: out:
if (options) if (options)
option_state_dereference (&options, MDL); option_state_dereference (&options, MDL);
if (lease) if (lease)

View File

@ -3,7 +3,7 @@
Persistent database management routines for DHCPD... */ Persistent database management routines for DHCPD... */
/* /*
* Copyright (c) 2004-2010 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2004-2010,2012 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1995-2003 by Internet Software Consortium * Copyright (c) 1995-2003 by Internet Software Consortium
* *
* Permission to use, copy, modify, and distribute this software for any * Permission to use, copy, modify, and distribute this software for any
@ -1021,7 +1021,11 @@ void db_startup (testp)
/* Read in the existing lease file... */ /* Read in the existing lease file... */
status = read_conf_file (path_dhcpd_db, status = read_conf_file (path_dhcpd_db,
(struct group *)0, 0, 1); (struct group *)0, 0, 1);
if (status != ISC_R_SUCCESS) {
/* XXX ignore status? */ /* XXX ignore status? */
;
}
#if defined (TRACING) #if defined (TRACING)
} }
#endif #endif

View File

@ -81,7 +81,6 @@ ddns_updates(struct packet *packet, struct lease *lease, struct lease *old,
struct option_cache *oc; struct option_cache *oc;
int s1, s2; int s1, s2;
int result = 0; int result = 0;
isc_result_t rcode1 = ISC_R_SUCCESS;
int server_updates_a = 1; int server_updates_a = 1;
//int server_updates_ptr = 1; //int server_updates_ptr = 1;
struct buffer *bp = (struct buffer *)0; struct buffer *bp = (struct buffer *)0;
@ -536,7 +535,11 @@ ddns_updates(struct packet *packet, struct lease *lease, struct lease *old,
* the ddns messages. Currently we don't. * the ddns messages. Currently we don't.
*/ */
if (do_remove) { if (do_remove) {
rcode1 = ddns_removals(lease, lease6, ddns_cb, ISC_TRUE); /*
* We should log a more specific error closer to the actual
* error if we want one. ddns_removal failure not logged here.
*/
(void) ddns_removals(lease, lease6, ddns_cb, ISC_TRUE);
} }
else { else {
ddns_fwd_srv_connector(lease, lease6, scope, ddns_cb, ddns_fwd_srv_connector(lease, lease6, scope, ddns_cb,

View File

@ -3,7 +3,7 @@
DHCP Protocol engine. */ DHCP Protocol engine. */
/* /*
* Copyright (c) 2004-2011 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2004-2012 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1995-2003 by Internet Software Consortium * Copyright (c) 1995-2003 by Internet Software Consortium
* *
* Permission to use, copy, modify, and distribute this software for any * Permission to use, copy, modify, and distribute this software for any
@ -419,7 +419,6 @@ void dhcprequest (packet, ms_nulltp, ip_lease)
#if defined (FAILOVER_PROTOCOL) #if defined (FAILOVER_PROTOCOL)
dhcp_failover_state_t *peer; dhcp_failover_state_t *peer;
#endif #endif
int have_server_identifier = 0;
int have_requested_addr = 0; int have_requested_addr = 0;
oc = lookup_option (&dhcp_universe, packet -> options, oc = lookup_option (&dhcp_universe, packet -> options,
@ -473,7 +472,6 @@ void dhcprequest (packet, ms_nulltp, ip_lease)
* safe. * safe.
*/ */
sprintf (smbuf, " (%s)", piaddr (sip)); sprintf (smbuf, " (%s)", piaddr (sip));
have_server_identifier = 1;
} else } else
smbuf [0] = 0; smbuf [0] = 0;
@ -969,6 +967,8 @@ void dhcpinform (packet, ms_nulltp)
struct sockaddr_in to; struct sockaddr_in to;
struct in_addr from; struct in_addr from;
isc_boolean_t zeroed_ciaddr; isc_boolean_t zeroed_ciaddr;
struct interface_info *interface;
int result;
/* The client should set ciaddr to its IP address, but apparently /* The client should set ciaddr to its IP address, but apparently
it's common for clients not to do this, so we'll use their IP it's common for clients not to do this, so we'll use their IP
@ -1314,10 +1314,17 @@ void dhcpinform (packet, ms_nulltp)
packet->interface->name); packet->interface->name);
errno = 0; errno = 0;
send_packet ((fallback_interface interface = (fallback_interface ? fallback_interface
? fallback_interface : packet -> interface), : packet -> interface);
&outgoing, &raw, outgoing.packet_length, result = send_packet(interface, &outgoing, &raw,
from, &to, (struct hardware *)0); outgoing.packet_length, from, &to, NULL);
if (result < 0) {
log_error ("%s:%d: Failed to send %d byte long packet over %s "
"interface.", MDL, outgoing.packet_length,
interface->name);
}
if (subnet) if (subnet)
subnet_dereference (&subnet, MDL); subnet_dereference (&subnet, MDL);
} }
@ -1464,6 +1471,13 @@ void nak_lease (packet, cip)
result = send_packet(fallback_interface, packet, &raw, result = send_packet(fallback_interface, packet, &raw,
outgoing.packet_length, from, &to, outgoing.packet_length, from, &to,
NULL); NULL);
if (result < 0) {
log_error ("%s:%d: Failed to send %d byte long "
"packet over %s interface.", MDL,
outgoing.packet_length,
fallback_interface->name);
}
return; return;
} }
} else { } else {
@ -1474,6 +1488,12 @@ void nak_lease (packet, cip)
errno = 0; errno = 0;
result = send_packet(packet->interface, packet, &raw, result = send_packet(packet->interface, packet, &raw,
outgoing.packet_length, from, &to, NULL); outgoing.packet_length, from, &to, NULL);
if (result < 0) {
log_error ("%s:%d: Failed to send %d byte long packet over %s "
"interface.", MDL, outgoing.packet_length,
packet->interface->name);
}
} }
void ack_lease (packet, lease, offer, when, msg, ms_nulltp, hp) void ack_lease (packet, lease, offer, when, msg, ms_nulltp, hp)
@ -3214,11 +3234,16 @@ void dhcp_reply (lease)
to.sin_port = remote_port; /* For debugging. */ to.sin_port = remote_port; /* For debugging. */
if (fallback_interface) { if (fallback_interface) {
result = send_packet (fallback_interface, result = send_packet(fallback_interface, NULL, &raw,
(struct packet *)0, packet_length, raw.siaddr, &to,
&raw, packet_length, NULL);
raw.siaddr, &to, if (result < 0) {
(struct hardware *)0); log_error ("%s:%d: Failed to send %d byte long "
"packet over %s interface.", MDL,
packet_length,
fallback_interface->name);
}
free_lease_state (state, MDL); free_lease_state (state, MDL);
lease -> state = (struct lease_state *)0; lease -> state = (struct lease_state *)0;
@ -3247,11 +3272,16 @@ void dhcp_reply (lease)
to.sin_port = remote_port; to.sin_port = remote_port;
if (fallback_interface) { if (fallback_interface) {
result = send_packet (fallback_interface, result = send_packet(fallback_interface, NULL, &raw,
(struct packet *)0, packet_length, raw.siaddr, &to,
&raw, packet_length, NULL);
raw.siaddr, &to, if (result < 0) {
(struct hardware *)0); log_error("%s:%d: Failed to send %d byte long"
" packet over %s interface.", MDL,
packet_length,
fallback_interface->name);
}
free_lease_state (state, MDL); free_lease_state (state, MDL);
lease -> state = (struct lease_state *)0; lease -> state = (struct lease_state *)0;
return; return;
@ -3276,10 +3306,14 @@ void dhcp_reply (lease)
memcpy (&from, state -> from.iabuf, sizeof from); memcpy (&from, state -> from.iabuf, sizeof from);
result = send_packet (state -> ip, result = send_packet(state->ip, NULL, &raw, packet_length,
(struct packet *)0, &raw, packet_length, from, &to, unicastp ? &hto : NULL);
from, &to, if (result < 0) {
unicastp ? &hto : (struct hardware *)0); log_error ("%s:%d: Failed to send %d byte long "
"packet over %s interface.", MDL,
packet_length, state->ip->name);
}
/* Free all of the entries in the option_state structure /* Free all of the entries in the option_state structure
now that we're done with them. */ now that we're done with them. */

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2006-2011 by Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2006-2012 by Internet Systems Consortium, Inc. ("ISC")
* *
* Permission to use, copy, modify, and distribute this software for any * Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above * purpose with or without fee is hereby granted, provided that the above
@ -4617,7 +4617,6 @@ iterate_over_ia_na(struct data_string *reply_ret,
struct option_state *host_opt_state; struct option_state *host_opt_state;
struct data_string iaaddr; struct data_string iaaddr;
struct data_string fixed_addr; struct data_string fixed_addr;
int iaaddr_is_found;
char reply_data[65536]; char reply_data[65536];
struct dhcpv6_packet *reply = (struct dhcpv6_packet *)reply_data; struct dhcpv6_packet *reply = (struct dhcpv6_packet *)reply_data;
int reply_ofs = (int)(offsetof(struct dhcpv6_packet, options)); int reply_ofs = (int)(offsetof(struct dhcpv6_packet, options));
@ -4724,7 +4723,6 @@ iterate_over_ia_na(struct data_string *reply_ret,
*/ */
for (ia = lookup_option(&dhcpv6_universe, packet->options, D6O_IA_NA); for (ia = lookup_option(&dhcpv6_universe, packet->options, D6O_IA_NA);
ia != NULL; ia = ia->next) { ia != NULL; ia = ia->next) {
iaaddr_is_found = 0;
if (!get_encapsulated_IA_state(&cli_enc_opt_state, if (!get_encapsulated_IA_state(&cli_enc_opt_state,
&cli_enc_opt_data, &cli_enc_opt_data,
@ -5136,7 +5134,6 @@ iterate_over_ia_pd(struct data_string *reply_ret,
struct host_decl *host; struct host_decl *host;
struct option_state *host_opt_state; struct option_state *host_opt_state;
struct data_string iaprefix; struct data_string iaprefix;
int iaprefix_is_found;
char reply_data[65536]; char reply_data[65536];
int reply_ofs; int reply_ofs;
struct iasubopt *prefix; struct iasubopt *prefix;
@ -5203,7 +5200,6 @@ iterate_over_ia_pd(struct data_string *reply_ret,
*/ */
for (ia = lookup_option(&dhcpv6_universe, packet->options, D6O_IA_PD); for (ia = lookup_option(&dhcpv6_universe, packet->options, D6O_IA_PD);
ia != NULL; ia = ia->next) { ia != NULL; ia = ia->next) {
iaprefix_is_found = 0;
if (!get_encapsulated_IA_state(&cli_enc_opt_state, if (!get_encapsulated_IA_state(&cli_enc_opt_state,
&cli_enc_opt_data, &cli_enc_opt_data,

View File

@ -3,7 +3,7 @@
Failover protocol support code... */ Failover protocol support code... */
/* /*
* Copyright (c) 2004-2011 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2004-2012 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1999-2003 by Internet Software Consortium * Copyright (c) 1999-2003 by Internet Software Consortium
* *
* Permission to use, copy, modify, and distribute this software for any * Permission to use, copy, modify, and distribute this software for any
@ -32,6 +32,7 @@
* ``http://www.nominum.com''. * ``http://www.nominum.com''.
*/ */
#include "cdefs.h"
#include "dhcpd.h" #include "dhcpd.h"
#include <omapip/omapip_p.h> #include <omapip/omapip_p.h>
@ -2412,7 +2413,8 @@ dhcp_failover_pool_dobalance(dhcp_failover_state_t *state,
struct shared_network *s; struct shared_network *s;
struct pool *p; struct pool *p;
binding_state_t peer_lease_state; binding_state_t peer_lease_state;
binding_state_t my_lease_state; /* binding_state_t my_lease_state; */
/* XXX Why is this my_lease_state never used? */
struct lease **lq; struct lease **lq;
int (*log_func)(const char *, ...); int (*log_func)(const char *, ...);
const char *result, *reqlog; const char *result, *reqlog;
@ -2436,12 +2438,12 @@ dhcp_failover_pool_dobalance(dhcp_failover_state_t *state,
if (p->failover_peer->i_am == primary) { if (p->failover_peer->i_am == primary) {
lts = (p->free_leases - p->backup_leases) / 2; lts = (p->free_leases - p->backup_leases) / 2;
peer_lease_state = FTS_BACKUP; peer_lease_state = FTS_BACKUP;
my_lease_state = FTS_FREE; /* my_lease_state = FTS_FREE; */
lq = &p->free; lq = &p->free;
} else { } else {
lts = (p->backup_leases - p->free_leases) / 2; lts = (p->backup_leases - p->free_leases) / 2;
peer_lease_state = FTS_FREE; peer_lease_state = FTS_FREE;
my_lease_state = FTS_BACKUP; /* my_lease_state = FTS_BACKUP; */
lq = &p->backup; lq = &p->backup;
} }
@ -3257,13 +3259,13 @@ isc_result_t dhcp_failover_state_stuff (omapi_object_t *c,
omapi_object_t *id, omapi_object_t *id,
omapi_object_t *h) omapi_object_t *h)
{ {
/* In this function c should be a (omapi_connection_object_t *) */
dhcp_failover_state_t *s; dhcp_failover_state_t *s;
omapi_connection_object_t *conn;
isc_result_t status; isc_result_t status;
if (c -> type != omapi_type_connection) if (c -> type != omapi_type_connection)
return DHCP_R_INVALIDARG; return DHCP_R_INVALIDARG;
conn = (omapi_connection_object_t *)c;
if (h -> type != dhcp_type_failover_state) if (h -> type != dhcp_type_failover_state)
return DHCP_R_INVALIDARG; return DHCP_R_INVALIDARG;
@ -4306,6 +4308,8 @@ void dhcp_failover_send_contact (void *vstate)
if (obufix) { if (obufix) {
log_debug ("%s", obuf); log_debug ("%s", obuf);
} }
#else
IGNORE_UNUSED(status);
#endif #endif
return; return;
} }
@ -4354,6 +4358,8 @@ isc_result_t dhcp_failover_send_state (dhcp_failover_state_t *state)
if (obufix) { if (obufix) {
log_debug ("%s", obuf); log_debug ("%s", obuf);
} }
#else
IGNORE_UNUSED(status);
#endif #endif
return ISC_R_SUCCESS; return ISC_R_SUCCESS;
} }
@ -4490,7 +4496,6 @@ isc_result_t dhcp_failover_send_disconnect (omapi_object_t *l,
const char *message) const char *message)
{ {
dhcp_failover_link_t *link; dhcp_failover_link_t *link;
dhcp_failover_state_t *state;
isc_result_t status; isc_result_t status;
#if defined (DEBUG_FAILOVER_MESSAGES) #if defined (DEBUG_FAILOVER_MESSAGES)
char obuf [64]; char obuf [64];
@ -4505,7 +4510,6 @@ isc_result_t dhcp_failover_send_disconnect (omapi_object_t *l,
if (!l || l -> type != dhcp_type_failover_link) if (!l || l -> type != dhcp_type_failover_link)
return DHCP_R_INVALIDARG; return DHCP_R_INVALIDARG;
link = (dhcp_failover_link_t *)l; link = (dhcp_failover_link_t *)l;
state = link -> state_object;
if (!l -> outer || l -> outer -> type != omapi_type_connection) if (!l -> outer || l -> outer -> type != omapi_type_connection)
return DHCP_R_INVALIDARG; return DHCP_R_INVALIDARG;

View File

@ -3,7 +3,7 @@
OMAPI object interfaces for the DHCP server. */ OMAPI object interfaces for the DHCP server. */
/* /*
* Copyright (c) 2004-2009 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2004-2009,2012 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1999-2003 by Internet Software Consortium * Copyright (c) 1999-2003 by Internet Software Consortium
* *
* Permission to use, copy, modify, and distribute this software for any * Permission to use, copy, modify, and distribute this software for any
@ -480,12 +480,11 @@ isc_result_t dhcp_lease_destroy (omapi_object_t *h, const char *file, int line)
isc_result_t dhcp_lease_signal_handler (omapi_object_t *h, isc_result_t dhcp_lease_signal_handler (omapi_object_t *h,
const char *name, va_list ap) const char *name, va_list ap)
{ {
struct lease *lease; /* h should point to (struct lease *) */
isc_result_t status; isc_result_t status;
if (h -> type != dhcp_type_lease) if (h -> type != dhcp_type_lease)
return DHCP_R_INVALIDARG; return DHCP_R_INVALIDARG;
lease = (struct lease *)h;
if (!strcmp (name, "updated")) if (!strcmp (name, "updated"))
return ISC_R_SUCCESS; return ISC_R_SUCCESS;
@ -1175,14 +1174,13 @@ isc_result_t dhcp_host_get_value (omapi_object_t *h, omapi_object_t *id,
isc_result_t dhcp_host_destroy (omapi_object_t *h, const char *file, int line) isc_result_t dhcp_host_destroy (omapi_object_t *h, const char *file, int line)
{ {
struct host_decl *host;
if (h -> type != dhcp_type_host) if (h -> type != dhcp_type_host)
return DHCP_R_INVALIDARG; return DHCP_R_INVALIDARG;
host = (struct host_decl *)h;
#if defined (DEBUG_MEMORY_LEAKAGE) || \ #if defined (DEBUG_MEMORY_LEAKAGE) || \
defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT) defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
struct host_decl *host = (struct host_decl *)h;
if (host -> n_ipaddr) if (host -> n_ipaddr)
host_dereference (&host -> n_ipaddr, file, line); host_dereference (&host -> n_ipaddr, file, line);
if (host -> n_dynamic) if (host -> n_dynamic)
@ -1594,12 +1592,11 @@ isc_result_t dhcp_pool_set_value (omapi_object_t *h,
omapi_data_string_t *name, omapi_data_string_t *name,
omapi_typed_data_t *value) omapi_typed_data_t *value)
{ {
struct pool *pool; /* h should point to (struct pool *) */
isc_result_t status; isc_result_t status;
if (h -> type != dhcp_type_pool) if (h -> type != dhcp_type_pool)
return DHCP_R_INVALIDARG; return DHCP_R_INVALIDARG;
pool = (struct pool *)h;
/* No values to set yet. */ /* No values to set yet. */
@ -1619,12 +1616,11 @@ isc_result_t dhcp_pool_get_value (omapi_object_t *h, omapi_object_t *id,
omapi_data_string_t *name, omapi_data_string_t *name,
omapi_value_t **value) omapi_value_t **value)
{ {
struct pool *pool; /* h should point to (struct pool *) */
isc_result_t status; isc_result_t status;
if (h -> type != dhcp_type_pool) if (h -> type != dhcp_type_pool)
return DHCP_R_INVALIDARG; return DHCP_R_INVALIDARG;
pool = (struct pool *)h;
/* No values to get yet. */ /* No values to get yet. */
@ -1640,7 +1636,6 @@ isc_result_t dhcp_pool_get_value (omapi_object_t *h, omapi_object_t *id,
isc_result_t dhcp_pool_destroy (omapi_object_t *h, const char *file, int line) isc_result_t dhcp_pool_destroy (omapi_object_t *h, const char *file, int line)
{ {
struct pool *pool;
#if defined (DEBUG_MEMORY_LEAKAGE) || \ #if defined (DEBUG_MEMORY_LEAKAGE) || \
defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT) defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
struct permit *pc, *pn; struct permit *pc, *pn;
@ -1648,10 +1643,10 @@ isc_result_t dhcp_pool_destroy (omapi_object_t *h, const char *file, int line)
if (h -> type != dhcp_type_pool) if (h -> type != dhcp_type_pool)
return DHCP_R_INVALIDARG; return DHCP_R_INVALIDARG;
pool = (struct pool *)h;
#if defined (DEBUG_MEMORY_LEAKAGE) || \ #if defined (DEBUG_MEMORY_LEAKAGE) || \
defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT) defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
struct pool *pool = (struct pool *)h;
if (pool -> next) if (pool -> next)
pool_dereference (&pool -> next, file, line); pool_dereference (&pool -> next, file, line);
if (pool -> group) if (pool -> group)
@ -1692,13 +1687,12 @@ isc_result_t dhcp_pool_destroy (omapi_object_t *h, const char *file, int line)
isc_result_t dhcp_pool_signal_handler (omapi_object_t *h, isc_result_t dhcp_pool_signal_handler (omapi_object_t *h,
const char *name, va_list ap) const char *name, va_list ap)
{ {
struct pool *pool; /* h should point to (struct pool *) */
isc_result_t status; isc_result_t status;
int updatep = 0; int updatep = 0;
if (h -> type != dhcp_type_pool) if (h -> type != dhcp_type_pool)
return DHCP_R_INVALIDARG; return DHCP_R_INVALIDARG;
pool = (struct pool *)h;
/* Can't write pools yet. */ /* Can't write pools yet. */
@ -1718,12 +1712,11 @@ isc_result_t dhcp_pool_stuff_values (omapi_object_t *c,
omapi_object_t *id, omapi_object_t *id,
omapi_object_t *h) omapi_object_t *h)
{ {
struct pool *pool; /* h should point to (struct pool *) */
isc_result_t status; isc_result_t status;
if (h -> type != dhcp_type_pool) if (h -> type != dhcp_type_pool)
return DHCP_R_INVALIDARG; return DHCP_R_INVALIDARG;
pool = (struct pool *)h;
/* Can't stuff pool values yet. */ /* Can't stuff pool values yet. */
@ -1951,14 +1944,13 @@ isc_result_t dhcp_class_get_value (omapi_object_t *h, omapi_object_t *id,
isc_result_t dhcp_class_destroy (omapi_object_t *h, const char *file, int line) isc_result_t dhcp_class_destroy (omapi_object_t *h, const char *file, int line)
{ {
struct class *class;
if (h -> type != dhcp_type_class && h -> type != dhcp_type_subclass) if (h -> type != dhcp_type_class && h -> type != dhcp_type_subclass)
return DHCP_R_INVALIDARG; return DHCP_R_INVALIDARG;
class = (struct class *)h;
#if defined (DEBUG_MEMORY_LEAKAGE) || \ #if defined (DEBUG_MEMORY_LEAKAGE) || \
defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT) defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
struct class *class = (struct class *)h;
if (class -> nic) if (class -> nic)
class_dereference (&class -> nic, file, line); class_dereference (&class -> nic, file, line);
if (class -> superclass) if (class -> superclass)
@ -2083,12 +2075,11 @@ isc_result_t dhcp_class_stuff_values (omapi_object_t *c,
omapi_object_t *id, omapi_object_t *id,
omapi_object_t *h) omapi_object_t *h)
{ {
struct class *class; /* h should point to (struct class *) */
isc_result_t status; isc_result_t status;
if (h -> type != dhcp_type_class) if (h -> type != dhcp_type_class)
return DHCP_R_INVALIDARG; return DHCP_R_INVALIDARG;
class = (struct class *)h;
/* Can't stuff class values yet. */ /* Can't stuff class values yet. */