Windows: if no known IP addrs, query the addr list
authorJeffrey Altman <jaltman@your-file-system.com>
Fri, 9 Oct 2015 14:20:41 +0000 (10:20 -0400)
committerJeffrey Altman <jaltman@your-file-system.com>
Fri, 16 Oct 2015 21:02:53 +0000 (17:02 -0400)
If cm_noIPAddrs == 0, then no servers will be probed.   If
syscfg_GetIFInfo() fails then cm_noIPAddrs is set to 0.  Therefore,
also set cm_LanAdapterChangeDetected to non-zero if syscfg_GetIFInfo()
fails so that the interface info can be queried again prior to a server
probe attempt.

Change-Id: I6639441fa6266671cfb875256eb23c3b018e67c9
Reviewed-on: http://gerrit.openafs.org/12055
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

src/WINNT/afsd/cm_server.c

index 8b327aa..fa3a7e9 100644 (file)
@@ -765,6 +765,17 @@ void cm_CheckServers(afs_uint32 flags, cm_cell_t *cellp)
     DWORD dummyLen;
     DWORD multi = 1;
 
+    lock_ObtainRead(&cm_syscfgLock);
+    if (cm_LanAdapterChangeDetected) {
+       lock_ConvertRToW(&cm_syscfgLock);
+       if (cm_LanAdapterChangeDetected) {
+           code = cm_UpdateIFInfo();
+       }
+       lock_ReleaseWrite(&cm_syscfgLock);
+    } else {
+       lock_ReleaseRead(&cm_syscfgLock);
+    }
+
     code = RegOpenKeyEx(HKEY_LOCAL_MACHINE, AFSREG_CLT_SVC_PARAM_SUBKEY,
                          0, KEY_QUERY_VALUE, &parmKey);
     if (code == ERROR_SUCCESS) {
@@ -861,7 +872,9 @@ afs_int32 cm_UpdateIFInfo(void)
     code = syscfg_GetIFInfo(&cm_noIPAddr,
                             cm_IPAddr, cm_SubnetMask,
                             cm_NetMtu, cm_NetFlags);
-    cm_LanAdapterChangeDetected = 0;
+
+    cm_LanAdapterChangeDetected = (code != 0);
+
     return code;
 }