viced: Verify primary host address

Currently, h_stateVerifyHost verifies that all of the valid entries on
h->z.interface are on the host address hashtable. If we don't have a
h->z.interface, we check the primary address h->z.host/h->z.port
instead.

But if we do have a h->z.interface, we don't check h->z.host/h->z.port
at all. Normally, the primary address should always be included in the
h->z.interface list (in a 'valid==1' entry), and so checking the
primary address is redundant. However, currently it is possible in
some edge cases for the primary address to be missing from the
hashtable and to not be listed as a valid address in h->z.interface.
In such cases, we don't flag an error or even log a warning, since we
don't check the primary address separately. (These cases are bugs, and
will be addressed in future commits.)

To detect this case, change h_stateVerifyHost to always check
h->z.host, just like we do for the entries in h->z.interface.

Reviewed-on: https://gerrit.openafs.org/15070
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Marcio Brito Barbosa <mbarbosa@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 9d144491d94e7e19e2d710601a37045ef1ef1fdc)

Change-Id: Icdd65c081372e1057df67401643973e1ac6f016e
Reviewed-on: https://gerrit.openafs.org/15509
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
This commit is contained in:
Andrew Deason 2022-07-08 17:14:26 -05:00 committed by Stephan Wiesand
parent 6fc1d81eb7
commit d80485cd95

View File

@ -3294,6 +3294,10 @@ h_stateVerifyHost(struct host * h, void* rock)
return H_ENUMERATE_BAIL(0);
}
if (h_stateVerifyAddrHash(state, h, h->z.host, h->z.port, 1)) {
state->bail = 1;
}
if (h->z.interface) {
for (i = h->z.interface->numberOfInterfaces-1; i >= 0; i--) {
if (h_stateVerifyAddrHash(state, h, h->z.interface->interface[i].addr,
@ -3305,8 +3309,6 @@ h_stateVerifyHost(struct host * h, void* rock)
if (h_stateVerifyUuidHash(state, h)) {
state->bail = 1;
}
} else if (h_stateVerifyAddrHash(state, h, h->z.host, h->z.port, 1)) {
state->bail = 1;
}
if (cb_stateVerifyHCBList(state, h)) {