viced-avoid-infinite-loop-with-altaddr-unset-20080508
authorJeffrey Altman <jaltman@secure-endpoints.com>
Thu, 8 May 2008 22:17:49 +0000 (22:17 +0000)
committerDerrick Brashear <shadow@dementia.org>
Thu, 8 May 2008 22:17:49 +0000 (22:17 +0000)
LICENSE IPL10

if we return leaving a non HOSTDELETED host while it does not have ALTADDR set,
a loop can happen. avoid it by simply setting ALTADDR again when we're done,
if we believe some addresses are still good this is fine.

src/viced/host.c

index 28ba0e1..66598ed 100644 (file)
@@ -1566,6 +1566,7 @@ h_GetHost_r(struct rx_connection *tcon)
                  */
                 removeAddress_r(host, haddr, hport);
                 host->hostFlags &= ~HWHO_INPROGRESS;
+                host->hostFlags |= ALTADDR;
                 h_Unlock_r(host);
                if (!held)
                     h_Release_r(host);
@@ -1601,6 +1602,7 @@ h_GetHost_r(struct rx_connection *tcon)
                    removeAddress_r(host, host->host, host->port);
                }
                host->hostFlags &= ~HWHO_INPROGRESS;
+                host->hostFlags |= ALTADDR;
                h_Unlock_r(host);
                if (!held)
                    h_Release_r(host);
@@ -1670,6 +1672,7 @@ h_GetHost_r(struct rx_connection *tcon)
                         afs_inet_ntoa_r(haddr, hoststr), ntohs(hport), code));
                 removeAddress_r(host, haddr, hport);
                 host->hostFlags &= ~HWHO_INPROGRESS;
+                host->hostFlags |= ALTADDR;
                 h_Unlock_r(host);
                 if (!held)
                     h_Release_r(host);