[pkg-dhcp-devel] Bug#643470: 4.2.2 fails to build with -Werror=unused-but-set-variable

Andrew Pollock apollock at debian.org
Tue Oct 25 06:35:00 UTC 2011


Hello,

Due to a rather fabulous chain of events, I can't build 4.2.2 with GCC 4.6.1
(which is what we're using in Debian to build packages in unstable)

In a nutshell, it looks like configure.ac completely clobbers CFLAGS under
some circumstances, and adds the -Werror flag. The -Werror flag now seems to
imply -Werror=unused-but-set-variable, and well, there's plenty of that in
the DHCP source :-)

Michael Gilbert was kind enough to provide a cleanup patch to fix 4.2.2, but
it's going to be a nightmare to maintain in Debian. Please consider using it
to clean up your codebase.

Please also consider revising the logic in configure.ac. I'm about to trial
a build with that CFLAGS clobbering logic patched out to see if I can get
the package to build.

Please maintain the Cc line to keep our bug tracking system in the loop

----- Forwarded message from Michael Gilbert <michael.s.gilbert at gmail.com> -----

Date: Sun, 23 Oct 2011 15:17:58 -0400
From: Michael Gilbert <michael.s.gilbert at gmail.com>
To: 643470 at bugs.debian.org, control <control at bugs.debian.org>
Subject: Bug#643470: isc-dhcp: FTBFS: comapi.c:425:15: error: variable 'status' set
	but not used [-Werror=unused-but-set-variable]

tag 643470 patch
thanks

I've created a patch that addresses all of the unused-but-set-variable
issues.  See attached.

Best wishes,
Mike

--- isc-dhcp-4.2.2.orig/dst/prandom.c
+++ isc-dhcp-4.2.2/dst/prandom.c
@@ -694,7 +694,6 @@
 {
 	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 
@@ -709,7 +708,6 @@
 /* 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:
only in patch2:
unchanged:
--- isc-dhcp-4.2.2.orig/client/clparse.c
+++ isc-dhcp-4.2.2/client/clparse.c
@@ -59,7 +59,9 @@
 {
 	struct client_config *config;
 	struct interface_info *ip;
-	struct parse *parse;
+#ifdef LATER
+	struct parse *parse = NULL;
+#endif
 	isc_result_t status;
 	unsigned code;
 
@@ -159,7 +161,6 @@
 					(struct interface_info *)0,
 					&top_level_config);
 
-	parse = NULL;
 	if (status != ISC_R_SUCCESS) {
 		;
 #ifdef LATER
only in patch2:
unchanged:
--- isc-dhcp-4.2.2.orig/client/dhclient.c
+++ isc-dhcp-4.2.2/client/dhclient.c
@@ -1818,7 +1818,6 @@
 {
 	struct client_state *client = cpp;
 
-	int result;
 	int interval;
 	int increase = 1;
 	struct timeval tv;
@@ -1901,7 +1900,7 @@
 	      ntohs (sockaddr_broadcast.sin_port), (long)(client -> interval));
 
 	/* Send out a packet. */
-	result = send_packet (client -> interface, (struct packet *)0,
+	send_packet (client -> interface, (struct packet *)0,
 			      &client -> packet,
 			      client -> packet_length,
 			      inaddr_any, &sockaddr_broadcast,
@@ -2037,7 +2036,6 @@
 {
 	struct client_state *client = cpp;
 
-	int result;
 	int interval;
 	struct sockaddr_in destination;
 	struct in_addr from;
@@ -2169,7 +2167,7 @@
 
 	if (destination.sin_addr.s_addr != INADDR_BROADCAST &&
 	    fallback_interface)
-		result = send_packet (fallback_interface,
+		send_packet (fallback_interface,
 				      (struct packet *)0,
 				      &client -> packet,
 				      client -> packet_length,
@@ -2177,7 +2175,7 @@
 				      (struct hardware *)0);
 	else
 		/* Send out a packet. */
-		result = send_packet (client -> interface, (struct packet *)0,
+		send_packet (client -> interface, (struct packet *)0,
 				      &client -> packet,
 				      client -> packet_length,
 				      from, &destination,
@@ -2194,15 +2192,13 @@
 {
 	struct client_state *client = cpp;
 
-	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));
 
 	/* Send out a packet. */
-	result = send_packet (client -> interface, (struct packet *)0,
+	send_packet (client -> interface, (struct packet *)0,
 			      &client -> packet,
 			      client -> packet_length,
 			      inaddr_any, &sockaddr_broadcast,
@@ -2214,7 +2210,6 @@
 {
 	struct client_state *client = cpp;
 
-	int result;
 	struct sockaddr_in destination;
 	struct in_addr from;
 
@@ -2245,7 +2240,7 @@
 	      ntohs (destination.sin_port));
 
 	if (fallback_interface)
-		result = send_packet (fallback_interface,
+		send_packet (fallback_interface,
 				      (struct packet *)0,
 				      &client -> packet,
 				      client -> packet_length,
@@ -2253,7 +2248,7 @@
 				      (struct hardware *)0);
 	else
 		/* Send out a packet. */
-		result = send_packet (client -> interface, (struct packet *)0,
+		send_packet (client -> interface, (struct packet *)0,
 				      &client -> packet,
 				      client -> packet_length,
 				      from, &destination,
only in patch2:
unchanged:
--- isc-dhcp-4.2.2.orig/common/parse.c
+++ isc-dhcp-4.2.2/common/parse.c
@@ -903,7 +903,7 @@
 	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,
@@ -941,7 +941,6 @@
 		return((TIME)0);
 	}
 	token = next_token(&val, NULL, cfile); /* consume day of week */
-	wday = atoi(val);
 
 	/* Year... */
 	token = peek_token(&val, NULL, cfile);
@@ -3329,11 +3328,10 @@
 int parse_boolean (cfile)
 	struct parse *cfile;
 {
-	enum dhcp_token token;
 	const char *val;
 	int rv;
 
-	token = next_token (&val, (unsigned *)0, cfile);
+	next_token (&val, (unsigned *)0, cfile);
 	if (!strcasecmp (val, "true")
 	    || !strcasecmp (val, "on"))
 		rv = 1;
only in patch2:
unchanged:
--- isc-dhcp-4.2.2.orig/common/socket.c
+++ isc-dhcp-4.2.2/common/socket.c
@@ -987,21 +987,26 @@
 	char buf [1540];
 	struct sockaddr_in from;
 	SOCKLEN_T flen = sizeof from;
+#if defined (DEBUG)
 	int status;
+#endif
 	struct interface_info *interface;
 
 	if (object -> type != dhcp_type_interface)
 		return DHCP_R_INVALIDARG;
 	interface = (struct interface_info *)object;
 
+#if defined (DEBUG)
 	status = recvfrom (interface -> wfdesc, buf, sizeof buf, 0,
 			   (struct sockaddr *)&from, &flen);
-#if defined (DEBUG)
 	/* Only report fallback discard errors if we're debugging. */
 	if (status < 0) {
 		log_error ("fallback_discard: %m");
 		return ISC_R_UNEXPECTED;
 	}
+#else
+	recvfrom (interface -> wfdesc, buf, sizeof buf, 0,
+			   (struct sockaddr *)&from, &flen);
 #endif
 	return ISC_R_SUCCESS;
 }
only in patch2:
unchanged:
--- isc-dhcp-4.2.2.orig/common/print.c
+++ isc-dhcp-4.2.2/common/print.c
@@ -479,10 +479,9 @@
 {
 	static char dq_buf [DQLEN + 1];
 	int i;
-	char *s, *last;
+	char *s;
 
 	s = &dq_buf [0];
-	last = s;
 	
 	i = 0;
 
only in patch2:
unchanged:
--- isc-dhcp-4.2.2.orig/common/comapi.c
+++ isc-dhcp-4.2.2/common/comapi.c
@@ -422,7 +422,6 @@
 				omapi_object_t *id)
 {
 	struct group_object *group;
-	isc_result_t status;
 	if (lp -> type != dhcp_type_group)
 		return DHCP_R_INVALIDARG;
 	group = (struct group_object *)lp;
@@ -433,7 +432,7 @@
 			return ISC_R_IOERROR;
 	}
 
-	status = dhcp_group_destroy ((omapi_object_t *)group, MDL);
+	dhcp_group_destroy ((omapi_object_t *)group, MDL);
 
 	return ISC_R_SUCCESS;
 }
@@ -511,12 +510,10 @@
 isc_result_t dhcp_control_signal_handler (omapi_object_t *h,
 					const char *name, va_list ap)
 {
-	dhcp_control_object_t *control;
 	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) {
@@ -612,12 +609,10 @@
 				     omapi_data_string_t *name,
 				     omapi_typed_data_t *value)
 {
-	struct subnet *subnet;
 	isc_result_t status;
 
 	if (h -> type != dhcp_type_subnet)
 		return DHCP_R_INVALIDARG;
-	subnet = (struct subnet *)h;
 
 	/* No values to set yet. */
 
@@ -637,12 +632,10 @@
 				    omapi_data_string_t *name,
 				    omapi_value_t **value)
 {
-	struct subnet *subnet;
 	isc_result_t status;
 
 	if (h -> type != dhcp_type_subnet)
 		return DHCP_R_INVALIDARG;
-	subnet = (struct subnet *)h;
 
 	/* No values to get yet. */
 
@@ -658,11 +651,9 @@
 
 isc_result_t dhcp_subnet_destroy (omapi_object_t *h, const char *file, int line)
 {
-	struct subnet *subnet;
 
 	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)
@@ -685,13 +676,11 @@
 isc_result_t dhcp_subnet_signal_handler (omapi_object_t *h,
 					 const char *name, va_list ap)
 {
-	struct subnet *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. */
 
@@ -711,12 +700,10 @@
 				       omapi_object_t *id,
 				       omapi_object_t *h)
 {
-	struct subnet *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. */
 
@@ -761,12 +748,10 @@
 					     omapi_data_string_t *name,
 					     omapi_typed_data_t *value)
 {
-	struct shared_network *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. */
 
@@ -787,12 +772,10 @@
 					    omapi_data_string_t *name,
 					    omapi_value_t **value)
 {
-	struct shared_network *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. */
 
@@ -809,14 +792,14 @@
 isc_result_t dhcp_shared_network_destroy (omapi_object_t *h,
 					  const char *file, int line)
 {
+#if defined (DEBUG_MEMORY_LEAKAGE) || \
+		defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
 	struct shared_network *shared_network;
 
 	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)
 	if (shared_network -> next)
 		shared_network_dereference (&shared_network -> next,
 					    file, line);
@@ -849,13 +832,11 @@
 						 const char *name,
 						 va_list ap)
 {
-	struct shared_network *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. */
 
@@ -875,12 +856,10 @@
 					       omapi_object_t *id,
 					       omapi_object_t *h)
 {
-	struct shared_network *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. */
 
only in patch2:
unchanged:
--- isc-dhcp-4.2.2.orig/common/options.c
+++ isc-dhcp-4.2.2/common/options.c
@@ -2249,7 +2249,6 @@
 	struct buffer *lbp = NULL;
 	struct option *option = NULL;
 	struct option_cache *op;
-	int status = 1;
 
 	/* Code sizes of 8, 16, and 32 bits are allowed. */
 	switch(universe->tag_size) {
@@ -2300,7 +2299,6 @@
 	if (!option_cache_allocate (opp, MDL)) {
 		log_error("No memory for option code %s.%s.",
 			  universe->name, option->name);
-		status = 0;
 		goto cleanup;
 	}
 
@@ -2315,7 +2313,6 @@
 		if (!buffer_allocate (&lbp, length + terminatep, MDL)) {
 			log_error ("no memory for option buffer.");
 
-			status = 0;
 			goto cleanup;
 		}
 		memcpy (lbp -> data, buffer, length + terminatep);
only in patch2:
unchanged:
--- isc-dhcp-4.2.2.orig/omapip/handle.c
+++ isc-dhcp-4.2.2/omapip/handle.c
@@ -252,7 +252,6 @@
 					    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)
@@ -282,7 +281,6 @@
 	   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));
 }
only in patch2:
unchanged:
--- isc-dhcp-4.2.2.orig/omapip/listener.c
+++ isc-dhcp-4.2.2/omapip/listener.c
@@ -352,7 +352,6 @@
 	u_int16_t *remote_port;
 	u_int16_t *local_port;
 	omapi_connection_object_t *obj;
-	isc_result_t status;
 	struct sockaddr_in remote_addr;
 
 	addr = (struct in_addr *)buf;
@@ -367,8 +366,7 @@
 				   omapi_listener_object_t, lp) {
 		if (lp -> address.sin_port == *local_port) {
 			obj = (omapi_connection_object_t *)0;
-			status = omapi_listener_connect (&obj,
-							 lp, 0, &remote_addr);
+			omapi_listener_connect (&obj, lp, 0, &remote_addr);
 			omapi_listener_dereference (&lp, MDL);
 			return;
 		}
only in patch2:
unchanged:
--- isc-dhcp-4.2.2.orig/server/omapi.c
+++ isc-dhcp-4.2.2/server/omapi.c
@@ -480,12 +480,10 @@
 isc_result_t dhcp_lease_signal_handler (omapi_object_t *h,
 					const char *name, va_list ap)
 {
-	struct lease *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;
@@ -1175,14 +1173,17 @@
 
 isc_result_t dhcp_host_destroy (omapi_object_t *h, const char *file, int line)
 {
+#if defined (DEBUG_MEMORY_LEAKAGE) || \
+		defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
 	struct host_decl *host;
+#endif
 
 	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)
+	host = (struct host_decl *)h;
 	if (host -> n_ipaddr)
 		host_dereference (&host -> n_ipaddr, file, line);
 	if (host -> n_dynamic)
@@ -1594,12 +1595,10 @@
 				   omapi_data_string_t *name,
 				   omapi_typed_data_t *value)
 {
-	struct pool *pool;
 	isc_result_t status;
 
 	if (h -> type != dhcp_type_pool)
 		return DHCP_R_INVALIDARG;
-	pool = (struct pool *)h;
 
 	/* No values to set yet. */
 
@@ -1619,12 +1618,10 @@
 				  omapi_data_string_t *name,
 				  omapi_value_t **value)
 {
-	struct pool *pool;
 	isc_result_t status;
 
 	if (h -> type != dhcp_type_pool)
 		return DHCP_R_INVALIDARG;
-	pool = (struct pool *)h;
 
 	/* No values to get yet. */
 
@@ -1640,18 +1637,18 @@
 
 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 pool *pool;
 	struct permit *pc, *pn;
 #endif
 
 	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)
+	pool = (struct pool *)h;
 	if (pool -> next)
 		pool_dereference (&pool -> next, file, line);
 	if (pool -> group)
@@ -1692,13 +1689,11 @@
 isc_result_t dhcp_pool_signal_handler (omapi_object_t *h,
 				       const char *name, va_list ap)
 {
-	struct pool *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. */
 
@@ -1718,12 +1713,10 @@
 				     omapi_object_t *id,
 				     omapi_object_t *h)
 {
-	struct pool *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. */
 
@@ -1951,14 +1944,17 @@
 
 isc_result_t dhcp_class_destroy (omapi_object_t *h, const char *file, int line)
 {
+#if defined (DEBUG_MEMORY_LEAKAGE) || \
+		defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
 	struct class *class;
+#endif
 
 	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)
+	class = (struct class *)h;
 	if (class -> nic)
 		class_dereference (&class -> nic, file, line);
 	if (class -> superclass)
@@ -2083,12 +2079,10 @@
 				      omapi_object_t *id,
 				      omapi_object_t *h)
 {
-	struct class *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. */
 
only in patch2:
unchanged:
--- isc-dhcp-4.2.2.orig/server/failover.c
+++ isc-dhcp-4.2.2/server/failover.c
@@ -2412,7 +2412,6 @@
 	struct shared_network *s;
 	struct pool *p;
 	binding_state_t peer_lease_state;
-	binding_state_t my_lease_state;
 	struct lease **lq;
 	int (*log_func)(const char *, ...);
 	const char *result, *reqlog;
@@ -2436,12 +2435,10 @@
 		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;
 			lq = &p->free;
 		} else {
 			lts = (p->backup_leases - p->free_leases) / 2;
 			peer_lease_state = FTS_FREE;
-			my_lease_state = FTS_BACKUP;
 			lq = &p->backup;
 		}
 
@@ -3258,12 +3255,10 @@
 					omapi_object_t *h)
 {
 	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;
@@ -4271,10 +4266,10 @@
 {
 	dhcp_failover_state_t *state = vstate;
 	dhcp_failover_link_t *link;
-	isc_result_t status;
 
 #if defined(DEBUG_FAILOVER_MESSAGES) && \
     defined(DEBUG_FAILOVER_CONTACT_MESSAGES)
+	isc_result_t status;
 	char obuf [64];
 	unsigned obufix = 0;
 
@@ -4293,19 +4288,23 @@
 	    link -> outer -> type != omapi_type_connection)
 		return;
 
+#if defined(DEBUG_FAILOVER_MESSAGES) && \
+    defined(DEBUG_FAILOVER_CONTACT_MESSAGES)
 	status = (dhcp_failover_put_message
 		  (link, link -> outer,
 		   FTM_CONTACT, link->xid++,
 		   (failover_option_t *)0));
-
-#if defined(DEBUG_FAILOVER_MESSAGES) && \
-    defined(DEBUG_FAILOVER_CONTACT_MESSAGES)
 	if (status != ISC_R_SUCCESS)
 		failover_print(obuf, &obufix, sizeof(obuf), " (failed)");
 	failover_print(obuf, &obufix, sizeof(obuf), ")");
 	if (obufix) {
 		log_debug ("%s", obuf);
 	}
+#else
+	(dhcp_failover_put_message
+		  (link, link -> outer,
+		   FTM_CONTACT, link->xid++,
+		   (failover_option_t *)0));
 #endif
 	return;
 }
@@ -4313,9 +4312,9 @@
 isc_result_t dhcp_failover_send_state (dhcp_failover_state_t *state)
 {
 	dhcp_failover_link_t *link;
-	isc_result_t status;
 
 #if defined (DEBUG_FAILOVER_MESSAGES)	
+	isc_result_t status;
 	char obuf [64];
 	unsigned obufix = 0;
 	
@@ -4333,6 +4332,7 @@
 	    link -> outer -> type != omapi_type_connection)
 		return DHCP_R_INVALIDARG;
 
+#if defined (DEBUG_FAILOVER_MESSAGES)
 	status = (dhcp_failover_put_message
 		  (link, link -> outer,
 		   FTM_STATE, link->xid++,
@@ -4346,14 +4346,26 @@
 		     ? FTF_SERVER_STARTUP : 0)),
 		   dhcp_failover_make_option (FTO_STOS, FMA, state -> me.stos),
 		   (failover_option_t *)0));
-
-#if defined (DEBUG_FAILOVER_MESSAGES)
 	if (status != ISC_R_SUCCESS)
 		failover_print (FMA, " (failed)");
 	failover_print (FMA, ")");
 	if (obufix) {
 		log_debug ("%s", obuf);
 	}
+#else
+	dhcp_failover_put_message
+		  (link, link -> outer,
+		   FTM_STATE, link->xid++,
+		   dhcp_failover_make_option (FTO_SERVER_STATE, FMA,
+					      (state -> me.state == startup
+					       ? state -> saved_state
+					       : state -> me.state)),
+		   dhcp_failover_make_option
+		   (FTO_SERVER_FLAGS, FMA,
+		    (state -> service_state == service_startup
+		     ? FTF_SERVER_STARTUP : 0)),
+		   dhcp_failover_make_option (FTO_STOS, FMA, state -> me.stos),
+		   (failover_option_t *)0);
 #endif
 	return ISC_R_SUCCESS;
 }
@@ -4490,7 +4502,6 @@
 					    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];
@@ -4505,7 +4516,6 @@
 	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;
 
only in patch2:
unchanged:
--- isc-dhcp-4.2.2.orig/server/dhcp.c
+++ isc-dhcp-4.2.2/server/dhcp.c
@@ -419,7 +419,6 @@
 #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,
@@ -473,7 +472,6 @@
 		 * safe.
 		 */
 		sprintf (smbuf, " (%s)", piaddr (sip));
-		have_server_identifier = 1;
 	} else
 		smbuf [0] = 0;
 
@@ -1328,7 +1326,6 @@
 {
 	struct sockaddr_in to;
 	struct in_addr from;
-	int result;
 	struct dhcp_packet raw;
 	unsigned char nak = DHCPNAK;
 	struct packet outgoing;
@@ -1461,7 +1458,7 @@
 			to.sin_port = remote_port; /* for testing. */
 
 		if (fallback_interface) {
-			result = send_packet(fallback_interface, packet, &raw,
+			send_packet(fallback_interface, packet, &raw,
 					     outgoing.packet_length, from, &to,
 					     NULL);
 			return;
@@ -1472,7 +1469,7 @@
 	}
 
 	errno = 0;
-	result = send_packet(packet->interface, packet, &raw,
+	send_packet(packet->interface, packet, &raw,
 			     outgoing.packet_length, from, &to, NULL);
 }
 
@@ -3020,7 +3017,6 @@
 	struct sockaddr_in to;
 	struct in_addr from;
 	struct hardware hto;
-	int result;
 	struct lease_state *state = lease -> state;
 	int nulltp, bootpp, unicastp = 1;
 	struct data_string d1;
@@ -3164,7 +3160,7 @@
 			to.sin_port = remote_port; /* For debugging. */
 
 		if (fallback_interface) {
-			result = send_packet (fallback_interface,
+			send_packet (fallback_interface,
 					      (struct packet *)0,
 					      &raw, packet_length,
 					      raw.siaddr, &to,
@@ -3197,7 +3193,7 @@
 		to.sin_port = remote_port;
 
 		if (fallback_interface) {
-			result = send_packet (fallback_interface,
+			send_packet (fallback_interface,
 					      (struct packet *)0,
 					      &raw, packet_length,
 					      raw.siaddr, &to,
@@ -3226,7 +3222,7 @@
 
 	memcpy (&from, state -> from.iabuf, sizeof from);
 
-	result = send_packet (state -> ip,
+	send_packet (state -> ip,
 			      (struct packet *)0, &raw, packet_length,
 			      from, &to,
 			      unicastp ? &hto : (struct hardware *)0);
only in patch2:
unchanged:
--- isc-dhcp-4.2.2.orig/server/ddns.c
+++ isc-dhcp-4.2.2/server/ddns.c
@@ -80,7 +80,6 @@
 	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;
@@ -524,7 +523,7 @@
 	 * the ddns messages.  Currently we don't.
 	 */
 	if (do_remove) {
-		rcode1 = ddns_removals(lease, lease6, ddns_cb);
+		ddns_removals(lease, lease6, ddns_cb);
 	}
 	else {
 		ddns_fwd_srv_connector(lease, lease6, scope, ddns_cb,
only in patch2:
unchanged:
--- isc-dhcp-4.2.2.orig/server/dhcpv6.c
+++ isc-dhcp-4.2.2/server/dhcpv6.c
@@ -4617,7 +4617,6 @@
 	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));
@@ -4724,7 +4723,6 @@
 	 */
 	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,
@@ -5136,7 +5134,6 @@
 	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;
@@ -5203,7 +5200,6 @@
 	 */
 	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,
only in patch2:
unchanged:
--- isc-dhcp-4.2.2.orig/server/db.c
+++ isc-dhcp-4.2.2/server/db.c
@@ -1013,13 +1013,12 @@
 void db_startup (testp)
 	int testp;
 {
-	isc_result_t status;
 
 #if defined (TRACING)
 	if (!trace_playback ()) {
 #endif
 		/* Read in the existing lease file... */
-		status = read_conf_file (path_dhcpd_db,
+		read_conf_file (path_dhcpd_db,
 					 (struct group *)0, 0, 1);
 		/* XXX ignore status? */
 #if defined (TRACING)
only in patch2:
unchanged:
--- isc-dhcp-4.2.2.orig/server/bootp.c
+++ isc-dhcp-4.2.2/server/bootp.c
@@ -42,7 +42,6 @@
 void bootp (packet)
 	struct packet *packet;
 {
-	int result;
 	struct host_decl *hp = (struct host_decl *)0;
 	struct host_decl *host = (struct host_decl *)0;
 	struct packet outgoing;
@@ -384,7 +383,7 @@
 		to.sin_port = local_port;
 
 		if (fallback_interface) {
-			result = send_packet (fallback_interface,
+			send_packet (fallback_interface,
 					      (struct packet *)0,
 					      &raw, outgoing.packet_length,
 					      from, &to, &hto);
@@ -407,7 +406,7 @@
 	}
 
 	errno = 0;
-	result = send_packet (packet -> interface,
+	send_packet (packet -> interface,
 			      packet, &raw, outgoing.packet_length,
 			      from, &to, &hto);
       out:
only in patch2:
unchanged:
--- isc-dhcp-4.2.2.orig/includes/cdefs.h
+++ isc-dhcp-4.2.2/includes/cdefs.h
@@ -52,8 +52,7 @@
 #else
 #define IGNORE_RET(x)			\
 	do {				\
-		int ignore_return;	\
-		ignore_return = x;	\
+		x;			\
 	} while (0)
 #endif
 


----- End forwarded message -----





More information about the pkg-dhcp-devel mailing list