imrelp: support for TCP KEEPALIVE added

This commit is contained in:
Rainer Gerhards 2013-12-10 17:01:43 +01:00
parent 8399092b83
commit 02da275527
4 changed files with 42 additions and 2 deletions

View File

@ -1,5 +1,7 @@
---------------------------------------------------------------------------
Version 8.1.4 [devel] 2013-12-06
Version 8.1.4 [devel] 2013-12-??
- imrelp: support for TCP KEEPALIVE added
- bumped librelp dependency to 1.2.2 to support new KEEPALIVE feature
- bugfix: action commitTransaction() processing did not properly handle
suspended actions
- Add directives for numerically specifying GIDs/UIDs

View File

@ -1092,7 +1092,7 @@ AC_ARG_ENABLE(relp,
[enable_relp=no]
)
if test "x$enable_relp" = "xyes"; then
PKG_CHECK_MODULES(RELP, relp >= 1.2.0)
PKG_CHECK_MODULES(RELP, relp >= 1.2.2)
fi
AM_CONDITIONAL(ENABLE_RELP, test x$enable_relp = xyes)

View File

@ -101,6 +101,25 @@ information was contained in
<a href="http://gnutls.org/manual/html_node/Priority-Strings.html">section 6.10 of the GnuTLS manual</a>.
<br><b>Note: this is an expert parameter.</b> Do not use if you do
not exactly know what you are doing.
<li><b>KeepAlive</b> &lt;on/<b>off</b>&gt; (available in 8.1.4+)<br>
enable of disable keep-alive packets at the tcp socket layer. The default is
to disable them.</li>
<li><b>KeepAlive.Probes</b> &lt;number&gt; (available in 8.1.4+)<br>
The number of unacknowledged probes to send before considering the connection dead and notifying the application layer.
The default, 0, means that the operating system defaults are used. This has only
effect if keep-alive is enabled. The functionality may not be available on
all platforms.
<li><b>KeepAlive.Interval</b> &lt;number&gt; (available in 8.1.4+)<br>
The interval between subsequent keepalive probes, regardless of what the connection has exchanged in the meantime.
The default, 0, means that the operating system defaults are used. This has only
effect if keep-alive is enabled. The functionality may not be available on
all platforms.
<li><b>KeepAlive.Time</b> &lt;number&gt; (available in 8.1.4+)<br>
The interval between the last data packet sent (simple ACKs are not considered data) and the first keepalive probe; after the connection is marked to need keepalive, this counter is not used any further.
The default, 0, means that the operating system defaults are used. This has only
effect if keep-alive is enabled. The functionality may not be available on
all platforms.
</li>
</ul>
<b>Caveats/Known Bugs:</b>

View File

@ -76,6 +76,7 @@ static struct configSettings_s {
struct instanceConf_s {
uchar *pszBindPort; /* port to bind to */
sbool bKeepAlive; /* support keep-alive packets */
sbool bEnableTLS;
sbool bEnableTLSZip;
int dhBits;
@ -84,6 +85,9 @@ struct instanceConf_s {
uchar *caCertFile;
uchar *myCertFile;
uchar *myPrivKeyFile;
int iKeepAliveIntvl;
int iKeepAliveProbes;
int iKeepAliveTime;
struct {
int nmemb;
uchar **name;
@ -127,6 +131,10 @@ static struct cnfparamblk modpblk =
/* input instance parameters */
static struct cnfparamdescr inppdescr[] = {
{ "port", eCmdHdlrString, CNFPARAM_REQUIRED },
{ "keepalive", eCmdHdlrBinary, 0 },
{ "keepalive.probes", eCmdHdlrInt, 0 },
{ "keepalive.time", eCmdHdlrInt, 0 },
{ "keepalive.interval", eCmdHdlrInt, 0 },
{ "tls", eCmdHdlrBinary, 0 },
{ "tls.permittedpeer", eCmdHdlrArray, 0 },
{ "tls.authmode", eCmdHdlrString, 0 },
@ -226,6 +234,7 @@ createInstance(instanceConf_t **pinst)
inst->next = NULL;
inst->pszBindPort = NULL;
inst->bKeepAlive = 0;
inst->bEnableTLS = 0;
inst->bEnableTLSZip = 0;
inst->dhBits = 0;
@ -316,6 +325,8 @@ addListner(modConfData_t __attribute__((unused)) *modConf, instanceConf_t *inst)
CHKiRet(statsobj.ConstructFinalize(inst->data.stats));
/* end stats counters */
relpSrvSetUsrPtr(pSrv, inst);
relpSrvSetKeepAlive(pSrv, inst->bKeepAlive, inst->iKeepAliveIntvl,
inst->iKeepAliveProbes, inst->iKeepAliveTime);
if(inst->bEnableTLS) {
relpSrvEnableTLS(pSrv);
if(inst->bEnableTLSZip) {
@ -373,6 +384,14 @@ CODESTARTnewInpInst
continue;
if(!strcmp(inppblk.descr[i].name, "port")) {
inst->pszBindPort = (uchar*)es_str2cstr(pvals[i].val.d.estr, NULL);
} else if(!strcmp(inppblk.descr[i].name, "keepalive")) {
inst->bKeepAlive = (sbool) pvals[i].val.d.n;
} else if(!strcmp(inppblk.descr[i].name, "keepalive.probes")) {
inst->iKeepAliveProbes = (int) pvals[i].val.d.n;
} else if(!strcmp(inppblk.descr[i].name, "keepalive.time")) {
inst->iKeepAliveTime = (int) pvals[i].val.d.n;
} else if(!strcmp(inppblk.descr[i].name, "keepalive.interval")) {
inst->iKeepAliveIntvl = (int) pvals[i].val.d.n;
} else if(!strcmp(inppblk.descr[i].name, "tls")) {
inst->bEnableTLS = (unsigned) pvals[i].val.d.n;
} else if(!strcmp(inppblk.descr[i].name, "tls.dhbits")) {