checking programs to eliminate false positives.
[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
- Fix the code that checks for an existing DDNS transaction to cancel
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
*
* Permission to use, copy, modify, and distribute this software for any
{
struct client_config *config;
struct interface_info *ip;
- struct parse *parse;
isc_result_t status;
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. */
memset(default_requested_options, 0, sizeof(default_requested_options));
(struct interface_info *)0,
&top_level_config);
- parse = NULL;
if (status != ISC_R_SUCCESS) {
;
#ifdef LATER
ntohs (sockaddr_broadcast.sin_port), (long)(client -> interval));
/* Send out a packet. */
- result = send_packet (client -> interface, (struct packet *)0,
- &client -> packet,
- client -> packet_length,
- inaddr_any, &sockaddr_broadcast,
- (struct hardware *)0);
+ result = send_packet(client->interface, NULL, &client->packet,
+ client->packet_length, inaddr_any,
+ &sockaddr_broadcast, NULL);
+ if (result < 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
ntohs (destination.sin_port));
if (destination.sin_addr.s_addr != INADDR_BROADCAST &&
- fallback_interface)
- result = send_packet (fallback_interface,
- (struct packet *)0,
- &client -> packet,
- client -> packet_length,
- from, &destination,
- (struct hardware *)0);
- else
+ fallback_interface) {
+ result = send_packet(fallback_interface, NULL, &client->packet,
+ client->packet_length, from, &destination,
+ NULL);
+ if (result < 0) {
+ log_error("%s:%d: Failed to send %d byte long packet "
+ "over %s interface.", MDL,
+ client->packet_length,
+ fallback_interface->name);
+ }
+ }
+ else {
/* Send out a packet. */
- result = send_packet (client -> interface, (struct packet *)0,
- &client -> packet,
- client -> packet_length,
- from, &destination,
- (struct hardware *)0);
+ result = send_packet(client->interface, NULL, &client->packet,
+ client->packet_length, from, &destination,
+ NULL);
+ if (result < 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_usec = ((tv.tv_sec - cur_tv.tv_sec) > 1) ?
int result;
log_info ("DHCPDECLINE on %s to %s port %d",
- client -> name ? client -> name : client -> interface -> name,
- inet_ntoa (sockaddr_broadcast.sin_addr),
- ntohs (sockaddr_broadcast.sin_port));
+ client->name ? client->name : client->interface->name,
+ inet_ntoa(sockaddr_broadcast.sin_addr),
+ ntohs(sockaddr_broadcast.sin_port));
/* Send out a packet. */
- result = send_packet (client -> interface, (struct packet *)0,
- &client -> packet,
- client -> packet_length,
- inaddr_any, &sockaddr_broadcast,
- (struct hardware *)0);
+ result = send_packet(client->interface, NULL, &client->packet,
+ client->packet_length, inaddr_any,
+ &sockaddr_broadcast, NULL);
+ if (result < 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)
inet_ntoa (destination.sin_addr),
ntohs (destination.sin_port));
- if (fallback_interface)
- result = send_packet (fallback_interface,
- (struct packet *)0,
- &client -> packet,
- client -> packet_length,
- from, &destination,
- (struct hardware *)0);
- else
+ if (fallback_interface) {
+ result = send_packet(fallback_interface, NULL, &client->packet,
+ client->packet_length, from, &destination,
+ NULL);
+ if (result < 0) {
+ log_error("%s:%d: Failed to send %d byte long packet"
+ " over %s interface.", MDL,
+ client->packet_length,
+ fallback_interface->name);
+ }
+ } else {
/* Send out a packet. */
- result = send_packet (client -> interface, (struct packet *)0,
- &client -> packet,
- client -> packet_length,
- from, &destination,
- (struct hardware *)0);
+ result = send_packet(client->interface, NULL, &client->packet,
+ client->packet_length, from, &destination,
+ NULL);
+ if (result < 0) {
+ log_error ("%s:%d: Failed to send %d byte long packet"
+ " over %s interface.", MDL,
+ client->packet_length,
+ client->interface->name);
+ }
+
+ }
}
void
lease->server_name);
}
}
-
for (i = 0; i < lease -> options -> universe_count; i++) {
option_space_foreach ((struct packet *)0, (struct lease *)0,
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) 1999-2003 by Internet Software Consortium
*
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_signal_handler (omapi_object_t *h,
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;
if (h -> type != dhcp_type_control)
return DHCP_R_INVALIDARG;
- control = (dhcp_control_object_t *)h;
/* Try to find some inner object that can take the value. */
if (h -> inner && h -> inner -> type -> get_value) {
status = omapi_get_value_str (ref, id, "handle", &tv);
if (status == ISC_R_SUCCESS) {
status = omapi_handle_td_lookup (lp, 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 ((*lp) -> type != dhcp_type_control) {
omapi_object_dereference (lp, MDL);
omapi_data_string_t *name,
omapi_typed_data_t *value)
{
- struct subnet *subnet;
+ /* In this function h should be a (struct subnet *) */
+
isc_result_t status;
if (h -> type != dhcp_type_subnet)
return DHCP_R_INVALIDARG;
- subnet = (struct subnet *)h;
/* No values to set yet. */
if (status == ISC_R_SUCCESS || status == DHCP_R_UNCHANGED)
return status;
}
-
+
return ISC_R_NOTFOUND;
}
omapi_data_string_t *name,
omapi_value_t **value)
{
- struct subnet *subnet;
+ /* In this function h should be a (struct subnet *) */
+
isc_result_t status;
if (h -> type != dhcp_type_subnet)
return DHCP_R_INVALIDARG;
- subnet = (struct subnet *)h;
/* No values to get yet. */
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;
+#endif
if (h -> type != dhcp_type_subnet)
return DHCP_R_INVALIDARG;
- subnet = (struct subnet *)h;
#if defined (DEBUG_MEMORY_LEAKAGE) || \
defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
+ subnet = (struct subnet *)h;
if (subnet -> next_subnet)
subnet_dereference (&subnet -> next_subnet, file, line);
if (subnet -> next_sibling)
isc_result_t dhcp_subnet_signal_handler (omapi_object_t *h,
const char *name, va_list ap)
{
- struct subnet *subnet;
+ /* In this function h should be a (struct subnet *) */
+
isc_result_t status;
int updatep = 0;
if (h -> type != dhcp_type_subnet)
return DHCP_R_INVALIDARG;
- subnet = (struct subnet *)h;
/* Can't write subnets yet. */
omapi_object_t *id,
omapi_object_t *h)
{
- struct subnet *subnet;
+ /* In this function h should be a (struct subnet *) */
+
isc_result_t status;
if (h -> type != dhcp_type_subnet)
return DHCP_R_INVALIDARG;
- subnet = (struct subnet *)h;
/* Can't stuff subnet values yet. */
omapi_data_string_t *name,
omapi_typed_data_t *value)
{
- struct shared_network *shared_network;
+ /* In this function h should be a (struct shared_network *) */
+
isc_result_t status;
if (h -> type != dhcp_type_shared_network)
return DHCP_R_INVALIDARG;
- shared_network = (struct shared_network *)h;
/* No values to set yet. */
if (status == ISC_R_SUCCESS || status == DHCP_R_UNCHANGED)
return status;
}
-
+
return ISC_R_NOTFOUND;
}
omapi_data_string_t *name,
omapi_value_t **value)
{
- struct shared_network *shared_network;
+ /* In this function h should be a (struct shared_network *) */
+
isc_result_t status;
if (h -> type != dhcp_type_shared_network)
return DHCP_R_INVALIDARG;
- shared_network = (struct shared_network *)h;
/* No values to get yet. */
isc_result_t dhcp_shared_network_destroy (omapi_object_t *h,
const char *file, int line)
{
+ /* In this function h should be a (struct shared_network *) */
+
+#if defined (DEBUG_MEMORY_LEAKAGE) || \
+ defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
struct shared_network *shared_network;
+#endif
if (h -> type != dhcp_type_shared_network)
return DHCP_R_INVALIDARG;
- shared_network = (struct shared_network *)h;
#if defined (DEBUG_MEMORY_LEAKAGE) || \
defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
+ shared_network = (struct shared_network *)h;
if (shared_network -> next)
shared_network_dereference (&shared_network -> next,
file, line);
const char *name,
va_list ap)
{
- struct shared_network *shared_network;
+ /* In this function h should be a (struct shared_network *) */
+
isc_result_t status;
int updatep = 0;
if (h -> type != dhcp_type_shared_network)
return DHCP_R_INVALIDARG;
- shared_network = (struct shared_network *)h;
/* Can't write shared_networks yet. */
omapi_object_t *id,
omapi_object_t *h)
{
- struct shared_network *shared_network;
+ /* In this function h should be a (struct shared_network *) */
+
isc_result_t status;
if (h -> type != dhcp_type_shared_network)
return DHCP_R_INVALIDARG;
- shared_network = (struct shared_network *)h;
/* Can't stuff shared_network values yet. */
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
*
* Permission to use, copy, modify, and distribute this software for any
cleanup:
option_dereference(&option, MDL);
- return 1;
+ return status;
}
static void
struct parse *cfile;
{
int guess;
- int tzoff, wday, year, mon, mday, hour, min, sec;
+ int tzoff, year, mon, mday, hour, min, sec;
const char *val;
enum dhcp_token token;
static int months[11] = { 31, 59, 90, 120, 151, 181,
return((TIME)0);
}
token = next_token(&val, NULL, cfile); /* consume day of week */
- wday = atoi(val);
+ /* we are not using this for anything */
/* Year... */
token = peek_token(&val, NULL, cfile);
int parse_boolean (cfile)
struct parse *cfile;
{
- enum dhcp_token token;
const char *val;
int rv;
- token = next_token (&val, (unsigned *)0, cfile);
+ (void)next_token(&val, NULL, cfile);
if (!strcasecmp (val, "true")
|| !strcasecmp (val, "on"))
rv = 1;
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) 1995-2003 by Internet Software Consortium
*
{
static char dq_buf [DQLEN + 1];
int i;
- char *s, *last;
+ char *s;
s = &dq_buf [0];
- last = s;
i = 0;
log_error ("fallback_discard: %m");
return ISC_R_UNEXPECTED;
}
+#else
+ /* ignore the fact that status value is never used */
+ IGNORE_UNUSED(status);
#endif
return ISC_R_SUCCESS;
}
#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
/*
- * 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) 1995-1998 by Trusted Information Systems, Inc.
*
* Permission to use, copy modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
{
int dir = 0, b;
int bytes, n, cmd = 0, dig = 0;
- int start =0;
/*
* now get the initial seed to put into the quick random function from
* the address of the work structure
/* pick a random number in the range of 0..7 based on that random number
* perform some operations that yield random data
*/
- start = work->filled;
n = (dst_s_quick_random(bytes) >> DST_SHIFT) & 0x07;
switch (n) {
case 0:
/*
* 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) 1996-2003 by Internet Software Consortium
*
* the warning by the use of void. In conjunction with the use of -Werror
* these warnings prohibit the compilation of the package. This macro
* 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)
#define IGNORE_RET(x) (void) x
#else
#define IGNORE_RET(x) \
do { \
- int ignore_return; \
- ignore_return = x; \
+ int __attribute__((unused)) ignore_return ;\
+ ignore_return = x; \
} while (0)
#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__ */
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) 1999-2003 by Internet Software Consortium
*
omapi_handle_table_t *table,
int op)
{
- omapi_handle_table_t *inner;
omapi_handle_t scale, index;
if (!table || table->first > h || table->limit <= h)
handle must be the subtable of this table whose index into this
table's array of children is the handle divided by the scale. */
index = (h - table->first) / scale;
- inner = table->children[index].table;
return(omapi_handle_lookup_in(o, h, table->children[index].table, op));
}
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) 1999-2003 by Internet Software Consortium
*
status = ISC_R_UNEXPECTED;
goto error_exit;
}
-
+
#if defined (HAVE_SETFD)
if (fcntl (obj -> socket, F_SETFD, 1) < 0) {
status = ISC_R_UNEXPECTED;
status = ISC_R_UNEXPECTED;
goto error_exit;
}
-
+
/* Try to bind to the wildcard address using the port number
we were given. */
i = bind (obj -> socket,
obj = (omapi_connection_object_t *)0;
status = omapi_listener_connect (&obj,
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);
return;
}
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
*
* Permission to use, copy, modify, and distribute this software for any
to.sin_port = local_port;
if (fallback_interface) {
- result = send_packet (fallback_interface,
- (struct packet *)0,
- &raw, outgoing.packet_length,
- from, &to, &hto);
+ result = send_packet (fallback_interface, NULL, &raw,
+ outgoing.packet_length, 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;
}
}
errno = 0;
- result = send_packet (packet -> interface,
- packet, &raw, outgoing.packet_length,
- from, &to, &hto);
+ result = send_packet(packet->interface, packet, &raw,
+ outgoing.packet_length, 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:
+
if (options)
option_state_dereference (&options, MDL);
if (lease)
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
*
* Permission to use, copy, modify, and distribute this software for any
/* Read in the existing lease file... */
status = read_conf_file (path_dhcpd_db,
(struct group *)0, 0, 1);
- /* XXX ignore status? */
+ if (status != ISC_R_SUCCESS) {
+ /* XXX ignore status? */
+ ;
+ }
+
#if defined (TRACING)
}
#endif
struct option_cache *oc;
int s1, s2;
int result = 0;
- isc_result_t rcode1 = ISC_R_SUCCESS;
int server_updates_a = 1;
//int server_updates_ptr = 1;
struct buffer *bp = (struct buffer *)0;
* the ddns messages. Currently we don't.
*/
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 {
ddns_fwd_srv_connector(lease, lease6, scope, ddns_cb,
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
*
* Permission to use, copy, modify, and distribute this software for any
#if defined (FAILOVER_PROTOCOL)
dhcp_failover_state_t *peer;
#endif
- int have_server_identifier = 0;
int have_requested_addr = 0;
oc = lookup_option (&dhcp_universe, packet -> options,
* safe.
*/
sprintf (smbuf, " (%s)", piaddr (sip));
- have_server_identifier = 1;
} else
smbuf [0] = 0;
struct sockaddr_in to;
struct in_addr from;
isc_boolean_t zeroed_ciaddr;
+ struct interface_info *interface;
+ int result;
/* 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
packet -> options, options,
&global_scope, oc, MDL)) {
struct universe *u = (struct universe *)0;
-
+
if (!universe_hash_lookup (&u, universe_hash,
(const char *)d1.data, d1.len,
MDL)) {
packet->interface->name);
errno = 0;
- send_packet ((fallback_interface
- ? fallback_interface : packet -> interface),
- &outgoing, &raw, outgoing.packet_length,
- from, &to, (struct hardware *)0);
+ interface = (fallback_interface ? fallback_interface
+ : packet -> interface);
+ result = send_packet(interface, &outgoing, &raw,
+ 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)
subnet_dereference (&subnet, MDL);
}
result = send_packet(fallback_interface, packet, &raw,
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,
+ fallback_interface->name);
+ }
+
return;
}
} else {
errno = 0;
result = send_packet(packet->interface, packet, &raw,
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)
to.sin_port = remote_port; /* For debugging. */
if (fallback_interface) {
- result = send_packet (fallback_interface,
- (struct packet *)0,
- &raw, packet_length,
- raw.siaddr, &to,
- (struct hardware *)0);
+ result = send_packet(fallback_interface, NULL, &raw,
+ packet_length, raw.siaddr, &to,
+ NULL);
+ if (result < 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);
lease -> state = (struct lease_state *)0;
to.sin_port = remote_port;
if (fallback_interface) {
- result = send_packet (fallback_interface,
- (struct packet *)0,
- &raw, packet_length,
- raw.siaddr, &to,
- (struct hardware *)0);
+ result = send_packet(fallback_interface, NULL, &raw,
+ packet_length, raw.siaddr, &to,
+ NULL);
+ if (result < 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);
lease -> state = (struct lease_state *)0;
return;
memcpy (&from, state -> from.iabuf, sizeof from);
- result = send_packet (state -> ip,
- (struct packet *)0, &raw, packet_length,
- from, &to,
- unicastp ? &hto : (struct hardware *)0);
+ result = send_packet(state->ip, NULL, &raw, packet_length,
+ from, &to, unicastp ? &hto : NULL);
+ if (result < 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
now that we're done with them. */
/*
- * 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
* purpose with or without fee is hereby granted, provided that the above
struct option_state *host_opt_state;
struct data_string iaaddr;
struct data_string fixed_addr;
- int iaaddr_is_found;
char reply_data[65536];
struct dhcpv6_packet *reply = (struct dhcpv6_packet *)reply_data;
int reply_ofs = (int)(offsetof(struct dhcpv6_packet, options));
*/
for (ia = lookup_option(&dhcpv6_universe, packet->options, D6O_IA_NA);
ia != NULL; ia = ia->next) {
- iaaddr_is_found = 0;
if (!get_encapsulated_IA_state(&cli_enc_opt_state,
&cli_enc_opt_data,
struct host_decl *host;
struct option_state *host_opt_state;
struct data_string iaprefix;
- int iaprefix_is_found;
char reply_data[65536];
int reply_ofs;
struct iasubopt *prefix;
*/
for (ia = lookup_option(&dhcpv6_universe, packet->options, D6O_IA_PD);
ia != NULL; ia = ia->next) {
- iaprefix_is_found = 0;
if (!get_encapsulated_IA_state(&cli_enc_opt_state,
&cli_enc_opt_data,
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
*
* Permission to use, copy, modify, and distribute this software for any
* ``http://www.nominum.com''.
*/
+#include "cdefs.h"
#include "dhcpd.h"
#include <omapip/omapip_p.h>
struct shared_network *s;
struct pool *p;
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;
int (*log_func)(const char *, ...);
const char *result, *reqlog;
if (p->failover_peer->i_am == primary) {
lts = (p->free_leases - p->backup_leases) / 2;
peer_lease_state = FTS_BACKUP;
- my_lease_state = FTS_FREE;
+ /* my_lease_state = FTS_FREE; */
lq = &p->free;
} else {
lts = (p->backup_leases - p->free_leases) / 2;
peer_lease_state = FTS_FREE;
- my_lease_state = FTS_BACKUP;
+ /* my_lease_state = FTS_BACKUP; */
lq = &p->backup;
}
omapi_object_t *id,
omapi_object_t *h)
{
+ /* In this function c should be a (omapi_connection_object_t *) */
+
dhcp_failover_state_t *s;
- omapi_connection_object_t *conn;
isc_result_t status;
if (c -> type != omapi_type_connection)
return DHCP_R_INVALIDARG;
- conn = (omapi_connection_object_t *)c;
if (h -> type != dhcp_type_failover_state)
return DHCP_R_INVALIDARG;
if (obufix) {
log_debug ("%s", obuf);
}
+#else
+ IGNORE_UNUSED(status);
#endif
return;
}
if (obufix) {
log_debug ("%s", obuf);
}
+#else
+ IGNORE_UNUSED(status);
#endif
return ISC_R_SUCCESS;
}
const char *message)
{
dhcp_failover_link_t *link;
- dhcp_failover_state_t *state;
isc_result_t status;
#if defined (DEBUG_FAILOVER_MESSAGES)
char obuf [64];
if (!l || l -> type != dhcp_type_failover_link)
return DHCP_R_INVALIDARG;
link = (dhcp_failover_link_t *)l;
- state = link -> state_object;
if (!l -> outer || l -> outer -> type != omapi_type_connection)
return DHCP_R_INVALIDARG;
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
*
* Permission to use, copy, modify, and distribute this software for any
isc_result_t dhcp_lease_signal_handler (omapi_object_t *h,
const char *name, va_list ap)
{
- struct lease *lease;
+ /* h should point to (struct lease *) */
isc_result_t status;
if (h -> type != dhcp_type_lease)
return DHCP_R_INVALIDARG;
- lease = (struct lease *)h;
if (!strcmp (name, "updated"))
return ISC_R_SUCCESS;
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)
return DHCP_R_INVALIDARG;
- host = (struct host_decl *)h;
#if defined (DEBUG_MEMORY_LEAKAGE) || \
defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
+ struct host_decl *host = (struct host_decl *)h;
if (host -> n_ipaddr)
host_dereference (&host -> n_ipaddr, file, line);
if (host -> n_dynamic)
tv -> value -> u.buffer.value,
tv -> value -> u.buffer.len, MDL);
omapi_value_dereference (&tv, MDL);
-
+
if (*lp && *lp != (omapi_object_t *)host) {
omapi_object_dereference (lp, MDL);
if (host)
omapi_data_string_t *name,
omapi_typed_data_t *value)
{
- struct pool *pool;
+ /* h should point to (struct pool *) */
isc_result_t status;
if (h -> type != dhcp_type_pool)
return DHCP_R_INVALIDARG;
- pool = (struct pool *)h;
/* No values to set yet. */
omapi_data_string_t *name,
omapi_value_t **value)
{
- struct pool *pool;
+ /* h should point to (struct pool *) */
isc_result_t status;
if (h -> type != dhcp_type_pool)
return DHCP_R_INVALIDARG;
- pool = (struct pool *)h;
/* No values to get yet. */
isc_result_t dhcp_pool_destroy (omapi_object_t *h, const char *file, int line)
{
- struct pool *pool;
#if defined (DEBUG_MEMORY_LEAKAGE) || \
defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
struct permit *pc, *pn;
if (h -> type != dhcp_type_pool)
return DHCP_R_INVALIDARG;
- pool = (struct pool *)h;
#if defined (DEBUG_MEMORY_LEAKAGE) || \
defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
+ struct pool *pool = (struct pool *)h;
if (pool -> next)
pool_dereference (&pool -> next, file, line);
if (pool -> group)
isc_result_t dhcp_pool_signal_handler (omapi_object_t *h,
const char *name, va_list ap)
{
- struct pool *pool;
+ /* h should point to (struct pool *) */
isc_result_t status;
int updatep = 0;
if (h -> type != dhcp_type_pool)
return DHCP_R_INVALIDARG;
- pool = (struct pool *)h;
/* Can't write pools yet. */
omapi_object_t *id,
omapi_object_t *h)
{
- struct pool *pool;
+ /* h should point to (struct pool *) */
isc_result_t status;
if (h -> type != dhcp_type_pool)
return DHCP_R_INVALIDARG;
- pool = (struct pool *)h;
/* Can't stuff pool values yet. */
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)
return DHCP_R_INVALIDARG;
- class = (struct class *)h;
#if defined (DEBUG_MEMORY_LEAKAGE) || \
defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
+ struct class *class = (struct class *)h;
if (class -> nic)
class_dereference (&class -> nic, file, line);
if (class -> superclass)
if (updatep)
return ISC_R_SUCCESS;
-
+
return ISC_R_NOTFOUND;
}
omapi_object_t *id,
omapi_object_t *h)
{
- struct class *class;
+ /* h should point to (struct class *) */
isc_result_t status;
if (h -> type != dhcp_type_class)
return DHCP_R_INVALIDARG;
- class = (struct class *)h;
/* Can't stuff class values yet. */