--- embedaddon/dhcp/server/failover.c 2012/10/09 09:06:55 1.1.1.1 +++ embedaddon/dhcp/server/failover.c 2013/07/22 12:54:39 1.1.1.1.2.1 @@ -894,8 +894,7 @@ isc_result_t dhcp_failover_link_get_value (omapi_objec return omapi_make_int_value (value, name, (int)link -> peer_port, MDL); } else if (!omapi_ds_strcmp (name, "link-state")) { - if (link -> state < 0 || - link -> state >= dhcp_flink_state_max) + if (link -> state >= dhcp_flink_state_max) return omapi_make_string_value (value, name, "invalid link state", MDL); @@ -955,8 +954,7 @@ isc_result_t dhcp_failover_link_stuff_values (omapi_ob status = omapi_connection_put_name (c, "link-state"); if (status != ISC_R_SUCCESS) return status; - if (link -> state < 0 || - link -> state >= dhcp_flink_state_max) + if (link -> state >= dhcp_flink_state_max) status = omapi_connection_put_string (c, "invalid link state"); else status = (omapi_connection_put_string @@ -4972,18 +4970,17 @@ failover_lease_is_better(dhcp_failover_state_t *state, isc_result_t dhcp_failover_process_bind_update (dhcp_failover_state_t *state, failover_message_t *msg) { - struct lease *lt, *lease; + struct lease *lt = NULL, *lease = NULL; struct iaddr ia; int reason = FTR_MISC_REJECT; const char *message; int new_binding_state; int send_to_backup = 0; - int required_options; + int required_options = FTB_ASSIGNED_IP_ADDRESS | FTB_BINDING_STATUS; isc_boolean_t chaddr_changed = ISC_FALSE; isc_boolean_t ident_changed = ISC_FALSE; /* Validate the binding update. */ - required_options = FTB_ASSIGNED_IP_ADDRESS | FTB_BINDING_STATUS; if ((msg->options_present & required_options) != required_options) { message = "binding update lacks required options"; reason = FTR_MISSING_BINDINFO; @@ -4993,8 +4990,6 @@ isc_result_t dhcp_failover_process_bind_update (dhcp_f ia.len = sizeof msg -> assigned_addr; memcpy (ia.iabuf, &msg -> assigned_addr, ia.len); - lease = (struct lease *)0; - lt = (struct lease *)0; if (!find_lease_by_ip_addr (&lease, ia, MDL)) { message = "unknown IP address"; reason = FTR_ILLEGAL_IP_ADDR;