Windows: rx lowlevel nat ping
authorJeffrey Altman <jaltman@your-file-system.com>
Sun, 28 Feb 2010 02:54:47 +0000 (21:54 -0500)
committerJeffrey Altman <jaltman@openafs.org>
Sun, 28 Feb 2010 14:27:15 +0000 (06:27 -0800)
sha1 d24078658d183ea2e72e61c1888e9900bac0ec32 added support
for a low-level nat ping using rx version replies.

Export rx_SetConnSecondsUntilNatPing from afsrpc.dll.

Add NatPingInterval registry value to
  HKLM\SYSTEM\CurrentControlSet\Services\TransarcAFSDaemon\Parameters
to permit Nat Ping to be enabled.  The default value is 0 seconds.

Change-Id: I5122ea81e1a61934eba3c836632039c76f6c45e3
Reviewed-on: http://gerrit.openafs.org/1487
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>

src/WINNT/afsd/cm_conn.c
src/WINNT/afsd/cm_conn.h
src/libafsrpc/afsrpc.def

index a5cbd56..d3e3802 100644 (file)
@@ -27,6 +27,7 @@ DWORD RDRtimeout = CM_CONN_DEFAULTRDRTIMEOUT;
 unsigned short ConnDeadtimeout = CM_CONN_CONNDEADTIME;
 unsigned short HardDeadtimeout = CM_CONN_HARDDEADTIME;
 unsigned short IdleDeadtimeout = CM_CONN_IDLEDEADTIME;
+unsigned short NatPingInterval = CM_CONN_NATPINGINTERVAL;
 
 #define LANMAN_WKS_PARAM_KEY "SYSTEM\\CurrentControlSet\\Services\\lanmanworkstation\\parameters"
 #define LANMAN_WKS_SESSION_TIMEOUT "SessTimeout"
@@ -121,6 +122,13 @@ void cm_InitConn(void)
                 IdleDeadtimeout = (unsigned short)dwValue;
                 afsi_log("IdleDeadTimeout is %d", IdleDeadtimeout);
             }
+           dummyLen = sizeof(DWORD);
+           code = RegQueryValueEx(parmKey, "NatPingInterval", NULL, NULL,
+                                   (BYTE *) &dwValue, &dummyLen);
+           if (code == ERROR_SUCCESS) {
+                NatPingInterval = (unsigned short)dwValue;
+            }
+            afsi_log("NatPingInterval is %d", NatPingInterval);
             RegCloseKey(parmKey);
        }
 
@@ -1103,6 +1111,8 @@ static void cm_NewRXConnection(cm_conn_t *tcp, cm_ucell_t *ucellp,
     rx_SetConnDeadTime(tcp->rxconnp, ConnDeadtimeout);
     rx_SetConnHardDeadTime(tcp->rxconnp, HardDeadtimeout);
     rx_SetConnIdleDeadTime(tcp->rxconnp, IdleDeadtimeout);
+    if (NatPingInterval)
+        rx_SetConnSecondsUntilNatPing(tcp->rxconnp, NatPingInterval);
     tcp->ucgen = ucellp->gen;
     if (secObjp)
         rxs_Release(secObjp);   /* Decrement the initial refCount */
index 5e0b673..c80c8b5 100644 (file)
@@ -20,6 +20,9 @@
 #ifndef CM_CONN_IDLEDEADTIME
 #define CM_CONN_IDLEDEADTIME             0
 #endif
+#ifndef CM_CONN_NATPINGINTERVAL
+#define CM_CONN_NATPINGINTERVAL          0
+#endif
 
 extern unsigned short ConnDeadtimeout;
 extern unsigned short HardDeadtimeout;
index 015023a..d4f2682 100755 (executable)
@@ -258,6 +258,7 @@ EXPORTS
         xdr_serverList                          @263
         xdr_Capabilities                        @264
         xdrlen_create                           @265
+        rx_SetConnSecondsUntilNatPing           @266
 
 ; for performance testing
         rx_TSFPQGlobSize                        @2001 DATA