From: Damien Neil Date: Tue, 27 Feb 2001 01:17:34 +0000 (+0000) Subject: Allow failover_state objects to have their local-state field to be changed X-Git-Tag: V3-BETA-2-PATCH-19~33 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=311dbab63df64019ba1c1bbc0650afb061143d60;p=thirdparty%2Fdhcp.git Allow failover_state objects to have their local-state field to be changed via OMAPI. In addition, attempts to set other fields in a state object will return success without modifying the object; this is very ugly, but required to allow an open -> modify -> update sequence of OMAPI operations to work properly. --- diff --git a/server/failover.c b/server/failover.c index 0320740a5..e42bf88a3 100644 --- a/server/failover.c +++ b/server/failover.c @@ -43,7 +43,7 @@ #ifndef lint static char copyright[] = -"$Id: failover.c,v 1.36 2001/02/22 07:30:21 mellon Exp $ Copyright (c) 1999-2001 The Internet Software Consortium. All rights reserved.\n"; +"$Id: failover.c,v 1.37 2001/02/27 01:17:34 neild Exp $ Copyright (c) 1999-2001 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -2245,9 +2245,61 @@ isc_result_t dhcp_failover_state_set_value (omapi_object_t *h, omapi_data_string_t *name, omapi_typed_data_t *value) { + isc_result_t status; + if (h -> type != dhcp_type_failover_state) return ISC_R_INVALIDARG; - + + /* This list of successful returns is completely wrong, but the + fastest way to make dhcpctl do something vaguely sane when + you try to change the local state. */ + + if (!omapi_ds_strcmp (name, "name")) { + return ISC_R_SUCCESS; + } else if (!omapi_ds_strcmp (name, "peer_name")) { + return ISC_R_SUCCESS; + } else if (!omapi_ds_strcmp (name, "partner-address")) { + return ISC_R_SUCCESS; + } else if (!omapi_ds_strcmp (name, "local-address")) { + return ISC_R_SUCCESS; + } else if (!omapi_ds_strcmp (name, "partner-port")) { + return ISC_R_SUCCESS; + } else if (!omapi_ds_strcmp (name, "local-port")) { + return ISC_R_SUCCESS; + } else if (!omapi_ds_strcmp (name, "max-outstanding-updates")) { + return ISC_R_SUCCESS; + } else if (!omapi_ds_strcmp (name, "mclt")) { + return ISC_R_SUCCESS; + } else if (!omapi_ds_strcmp (name, "load-balance-max-secs")) { + return ISC_R_SUCCESS; + } else if (!omapi_ds_strcmp (name, "load-balance-hba")) { + return ISC_R_SUCCESS; + } else if (!omapi_ds_strcmp (name, "partner-state")) { + return ISC_R_SUCCESS; + } else if (!omapi_ds_strcmp (name, "local-state")) { + long l; + status = omapi_get_int_value (&l, value); + if (status != ISC_R_SUCCESS) + return status; + return dhcp_failover_set_state ((dhcp_failover_state_t *)h, l); + } else if (!omapi_ds_strcmp (name, "partner-stos")) { + return ISC_R_SUCCESS; + } else if (!omapi_ds_strcmp (name, "local-stos")) { + return ISC_R_SUCCESS; + } else if (!omapi_ds_strcmp (name, "hierarchy")) { + return ISC_R_SUCCESS; + } else if (!omapi_ds_strcmp (name, "last-packet-sent")) { + return ISC_R_SUCCESS; + } else if (!omapi_ds_strcmp (name, "last-timestamp-received")) { + return ISC_R_SUCCESS; + } else if (!omapi_ds_strcmp (name, "skew")) { + return ISC_R_SUCCESS; + } else if (!omapi_ds_strcmp (name, "max-response-delay")) { + return ISC_R_SUCCESS; + } else if (!omapi_ds_strcmp (name, "cur-unacked-updates")) { + return ISC_R_SUCCESS; + } + if (h -> inner && h -> inner -> type -> set_value) return (*(h -> inner -> type -> set_value)) (h -> inner, id, name, value);