2
0
mirror of https://gitlab.isc.org/isc-projects/dhcp synced 2025-08-29 13:28:14 +00:00

- Log messages when failover peer names mismatch have been improved to

point out the problem.
This commit is contained in:
David Hankins 2007-09-17 17:18:49 +00:00
parent ab3a540fbe
commit fa9b593de7
2 changed files with 34 additions and 9 deletions

View File

@ -52,11 +52,15 @@ The system has only been tested on Linux, FreeBSD, and Solaris, and
may not work on other platforms. Please report any problems and may not work on other platforms. Please report any problems and
suggested fixes to <dhcp-users@isc.org>. suggested fixes to <dhcp-users@isc.org>.
Changes since 4.0.0a3 Changes since 4.0.0a3
- The DHCP server no longer requires a "ddns-update-style" statement, - The DHCP server no longer requires a "ddns-update-style" statement,
and now defaults to "none", which means DNS updates are disabled. and now defaults to "none", which means DNS updates are disabled.
- Log messages when failover peer names mismatch have been improved to
point out the problem.
Changes since 4.0.0a2 Changes since 4.0.0a2
- Fix for startup where there are no IPv4 addresses on an interface. - Fix for startup where there are no IPv4 addresses on an interface.

View File

@ -276,6 +276,8 @@ isc_result_t dhcp_failover_link_signal (omapi_object_t *h,
dhcp_failover_link_t *link; dhcp_failover_link_t *link;
omapi_object_t *c; omapi_object_t *c;
dhcp_failover_state_t *s, *state = (dhcp_failover_state_t *)0; dhcp_failover_state_t *s, *state = (dhcp_failover_state_t *)0;
char *sname;
int slen;
if (h -> type != dhcp_type_failover_link) { if (h -> type != dhcp_type_failover_link) {
/* XXX shouldn't happen. Put an assert here? */ /* XXX shouldn't happen. Put an assert here? */
@ -490,19 +492,32 @@ isc_result_t dhcp_failover_link_signal (omapi_object_t *h,
if (dhcp_failover_state_match_by_name(s, if (dhcp_failover_state_match_by_name(s,
&link->imsg->relationship_name)) &link->imsg->relationship_name))
state = s; state = s;
} }
/* If we can't find a failover protocol state /* If we can't find a failover protocol state
for this remote host, drop the connection */ for this remote host, drop the connection */
if (!state) { if (!state) {
errmsg = "unknown server"; errmsg = "unknown failover relationship name";
reason = FTR_INVALID_PARTNER; reason = FTR_INVALID_PARTNER;
badconnect: badconnect:
/* XXX Send a refusal message first? /* XXX Send a refusal message first?
XXX Look in protocol spec for guidance. */ XXX Look in protocol spec for guidance. */
log_error ("Failover CONNECT from %s: %s",
state? state->name : "unknown", errmsg); if (state != NULL) {
sname = state->name;
slen = strlen(sname);
} else if (link->imsg->options_present &
FTB_RELATIONSHIP_NAME) {
sname = link->imsg->relationship_name.data;
slen = link->imsg->relationship_name.count;
} else {
sname = "unknown";
slen = strlen(sname);
}
log_error("Failover CONNECT from %.*s: %s",
slen, sname, errmsg);
dhcp_failover_send_connectack dhcp_failover_send_connectack
((omapi_object_t *)link, state, ((omapi_object_t *)link, state,
reason, errmsg); reason, errmsg);
@ -572,7 +587,7 @@ isc_result_t dhcp_failover_link_signal (omapi_object_t *h,
break; break;
default: default:
/* XXX should never get here. Assertion? */ log_fatal("Impossible case at %s:%d.", MDL);
break; break;
} }
return ISC_R_SUCCESS; return ISC_R_SUCCESS;
@ -1260,6 +1275,7 @@ isc_result_t dhcp_failover_state_signal (omapi_object_t *o,
link); link);
} else if (link -> imsg -> type == FTM_CONNECTACK) { } else if (link -> imsg -> type == FTM_CONNECTACK) {
const char *errmsg; const char *errmsg;
char errbuf[1024];
int reason; int reason;
cancel_timeout (dhcp_failover_link_startup_timeout, cancel_timeout (dhcp_failover_link_startup_timeout,
@ -1282,14 +1298,19 @@ isc_result_t dhcp_failover_state_signal (omapi_object_t *o,
omapi_disconnect (link -> outer, 1); omapi_disconnect (link -> outer, 1);
return ISC_R_SUCCESS; return ISC_R_SUCCESS;
} }
if (!dhcp_failover_state_match_by_name(state, if (!dhcp_failover_state_match_by_name(state,
&link->imsg->relationship_name)) { &link->imsg->relationship_name)) {
errmsg = "unknown server"; /* XXX: Overflow results in log truncation, safe. */
snprintf(errbuf, sizeof(errbuf), "remote failover "
"relationship name %.*s does not match",
link->imsg->relationship_name.count,
link->imsg->relationship_name.data);
errmsg = errbuf;
reason = FTR_INVALID_PARTNER; reason = FTR_INVALID_PARTNER;
badconnectack: badconnectack:
log_error ("Failover CONNECTACK from %s: %s", log_error("Failover CONNECTACK from %s: %s",
state ? state->name : "unknown", errmsg); state->name, errmsg);
dhcp_failover_send_disconnect ((omapi_object_t *)link, dhcp_failover_send_disconnect ((omapi_object_t *)link,
reason, errmsg); reason, errmsg);
omapi_disconnect (link -> outer, 0); omapi_disconnect (link -> outer, 0);