viced: Verify primary host address 70/15070/4
authorAndrew Deason <adeason@sinenomine.net>
Fri, 8 Jul 2022 22:14:26 +0000 (17:14 -0500)
committerBenjamin Kaduk <kaduk@mit.edu>
Thu, 11 Aug 2022 15:55:04 +0000 (11:55 -0400)
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.

Change-Id: Id88276dfd121194141cb493924bab8d50cb8fcf3
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>

src/viced/host.c

index e430973..de8d6b9 100644 (file)
@@ -3291,6 +3291,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,
@@ -3302,8 +3306,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)) {