From 8ade30f3f14cb88151f2f5f47f044831c9ccc0ae Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Sat, 27 Feb 2010 21:54:47 -0500 Subject: [PATCH] Windows: rx lowlevel nat ping 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 Reviewed-by: Derrick Brashear Reviewed-by: Jeffrey Altman --- src/WINNT/afsd/cm_conn.c | 10 ++++++++++ src/WINNT/afsd/cm_conn.h | 3 +++ src/libafsrpc/afsrpc.def | 1 + 3 files changed, 14 insertions(+) diff --git a/src/WINNT/afsd/cm_conn.c b/src/WINNT/afsd/cm_conn.c index a5cbd56bee..d3e38024a1 100644 --- a/src/WINNT/afsd/cm_conn.c +++ b/src/WINNT/afsd/cm_conn.c @@ -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 */ diff --git a/src/WINNT/afsd/cm_conn.h b/src/WINNT/afsd/cm_conn.h index 5e0b6732a2..c80c8b518a 100644 --- a/src/WINNT/afsd/cm_conn.h +++ b/src/WINNT/afsd/cm_conn.h @@ -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; diff --git a/src/libafsrpc/afsrpc.def b/src/libafsrpc/afsrpc.def index 015023ae42..d4f2682746 100755 --- a/src/libafsrpc/afsrpc.def +++ b/src/libafsrpc/afsrpc.def @@ -258,6 +258,7 @@ EXPORTS xdr_serverList @263 xdr_Capabilities @264 xdrlen_create @265 + rx_SetConnSecondsUntilNatPing @266 ; for performance testing rx_TSFPQGlobSize @2001 DATA