auth: failback to afs3-vlserver for afs3-prserver
authorJeffrey Altman <jaltman@your-file-system.com>
Wed, 18 May 2011 17:51:53 +0000 (13:51 -0400)
committerJeffrey Altman <jaltman@openafs.org>
Thu, 19 May 2011 10:00:31 +0000 (03:00 -0700)
If the DNS SRV lookup is for afs3-prserver or afs3-kaserver,
fallback to a lookup for afs3-vlserver since those services
are traditionally hosted on the same machine as the vlserver.

FIXES 129887

Change-Id: Iec553415cd4f491ea5c32923c4023619bf6320e8
Reviewed-on: http://gerrit.openafs.org/4676
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>

src/auth/cellconfig.c

index d1c54d3..896c5e7 100644 (file)
@@ -1193,6 +1193,21 @@ afsconf_GetAfsdbInfo(char *acellName, char *aservice,
                                ports, ipRanks, &numServers, &ttl,
                                &realCellName);
 
+    /* If we couldn't find an entry for the requested service
+     * and that service happens to be the prservice or kaservice
+     * then fallback to searching for afs3-vlserver and assigning
+     * the port number here. */
+    if (code < 0 && (afsdbport == htons(7002) || afsdbport == htons(7004))) {
+        code = afsconf_LookupServer("afs3-vlserver", "udp",
+                                    (const char *)acellName, afsdbport,
+                                    cellHostAddrs, cellHostNames,
+                                    ports, ipRanks, &numServers, &ttl,
+                                    &realCellName);
+        if (code >= 0) {
+            for (i = 0; i < numServers; i++)
+                ports[i] = afsdbport;
+        }
+    }
     if (code == 0) {
        acellInfo->timeout = ttl;
        acellInfo->numServers = numServers;
@@ -1255,7 +1270,7 @@ afsconf_GetAfsdbInfo(char *acellName, char *aservice,
      * and that service happens to be the prservice or kaservice
      * then fallback to searching for afs3-vlserver and assigning
      * the port number here. */
-    if (rc < 0 && tservice == htons(7002) || tservice == htons(7004)) {
+    if (rc < 0 && (tservice == htons(7002) || tservice == htons(7004))) {
         rc = getAFSServer("afs3-vlserver", "udp", acellName, tservice,
                            cellHostAddrs, cellHostNames, ports, ipRanks, &numServers,
                            &ttl);