summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/rsyslog_conf.html11
-rw-r--r--runtime/netstrm.c14
-rw-r--r--runtime/netstrm.h1
-rw-r--r--runtime/nsd.h1
-rw-r--r--runtime/nsd_gtls.c30
-rw-r--r--runtime/nsd_ptcp.c17
-rw-r--r--runtime/rsyslog.h1
-rw-r--r--tools/omfwd.c6
8 files changed, 72 insertions, 9 deletions
diff --git a/doc/rsyslog_conf.html b/doc/rsyslog_conf.html
index e39cfe13..5dfb8931 100644
--- a/doc/rsyslog_conf.html
+++ b/doc/rsyslog_conf.html
@@ -116,13 +116,12 @@ default 60000 (1 minute)]</li>
<li>$ActionQueueType [FixedArray/LinkedList/<b>Direct</b>/Disk]</li>
<li>$ActionQueueSaveOnShutdown&nbsp; [on/<b>off</b>]
</li>
-<li>$ActionQueueWorkerThreads &lt;number&gt;, num
-worker threads, default 1, recommended 1</li>
-<li>$ActionQueueWorkerThreadMinumumMessages
-&lt;number&gt;, default 100</li>
+<li>$ActionQueueWorkerThreads &lt;number&gt;, num worker threads, default 1, recommended 1</li>
+<li>$ActionQueueWorkerThreadMinumumMessages &lt;number&gt;, default 100</li>
<li><a href="rsconf1_actionresumeinterval.html">$ActionResumeInterval</a></li>
-<li>$ActionResumeRetryCount &lt;number&gt; [default 0,
--1 means eternal]</li>
+<li>$ActionResumeRetryCount &lt;number&gt; [default 0, -1 means eternal]</li>
+<li>$ActionSendStreamDriverMode &lt;mode&gt;, default 0, mode to use with the stream driver
+(driver-specific)</li>
<li><a href="rsconf1_allowedsender.html">$AllowedSender</a></li>
<li><a href="rsconf1_controlcharacterescapeprefix.html">$ControlCharacterEscapePrefix</a></li>
<li><a href="rsconf1_debugprintcfsyslinehandlerlist.html">$DebugPrintCFSyslineHandlerList</a></li>
diff --git a/runtime/netstrm.c b/runtime/netstrm.c
index be754aae..bbb6ee30 100644
--- a/runtime/netstrm.c
+++ b/runtime/netstrm.c
@@ -175,6 +175,19 @@ Rcv(netstrm_t *pThis, uchar *pBuf, ssize_t *pLenBuf)
}
+/* set the driver mode
+ * rgerhards, 2008-04-28
+ */
+static rsRetVal
+SetDrvrMode(netstrm_t *pThis, int iMode)
+{
+ DEFiRet;
+ ISOBJ_TYPE_assert(pThis, netstrm);
+ iRet = pThis->Drvr.SetMode(pThis->pDrvrData, iMode);
+ RETiRet;
+}
+
+
/* send a buffer. On entry, pLenBuf contains the number of octets to
* write. On exit, it contains the number of octets actually written.
* If this number is lower than on entry, only a partial buffer has
@@ -252,6 +265,7 @@ CODESTARTobjQueryInterface(netstrm)
pIf->AcceptConnReq = AcceptConnReq;
pIf->GetRemoteHName = GetRemoteHName;
pIf->GetRemoteIP = GetRemoteIP;
+ pIf->SetDrvrMode = SetDrvrMode;
finalize_it:
ENDobjQueryInterface(netstrm)
diff --git a/runtime/netstrm.h b/runtime/netstrm.h
index 160bbb0b..ddf15677 100644
--- a/runtime/netstrm.h
+++ b/runtime/netstrm.h
@@ -49,6 +49,7 @@ BEGINinterface(netstrm) /* name must also be changed in ENDinterface macro! */
rsRetVal (*Connect)(netstrm_t *pThis, int family, unsigned char *port, unsigned char *host);
rsRetVal (*GetRemoteHName)(netstrm_t *pThis, uchar **pszName);
rsRetVal (*GetRemoteIP)(netstrm_t *pThis, uchar **pszIP);
+ rsRetVal (*SetDrvrMode)(netstrm_t *pThis, int iMode);
ENDinterface(netstrm)
#define netstrmCURR_IF_VERSION 1 /* increment whenever you change the interface structure! */
diff --git a/runtime/nsd.h b/runtime/nsd.h
index 1b3702a0..cc06c877 100644
--- a/runtime/nsd.h
+++ b/runtime/nsd.h
@@ -50,6 +50,7 @@ BEGINinterface(nsd) /* name must also be changed in ENDinterface macro! */
rsRetVal (*AcceptConnReq)(nsd_t *pThis, nsd_t **ppThis);
rsRetVal (*GetRemoteHName)(nsd_t *pThis, uchar **pszName);
rsRetVal (*GetRemoteIP)(nsd_t *pThis, uchar **pszIP);
+ rsRetVal (*SetMode)(nsd_t *pThis, int mode); /* sets a driver specific mode - see driver doc for details */
rsRetVal (*GetSock)(nsd_t *pThis, int *pSock);
rsRetVal (*SetSock)(nsd_t *pThis, int sock);
/* GetSock() and SetSock() return an error if the driver does not use plain
diff --git a/runtime/nsd_gtls.c b/runtime/nsd_gtls.c
index d59043f2..a06d7cca 100644
--- a/runtime/nsd_gtls.c
+++ b/runtime/nsd_gtls.c
@@ -116,8 +116,6 @@ gtlsEndSess(nsd_gtls_t *pThis)
/* Standard-Constructor */
BEGINobjConstruct(nsd_gtls) /* be sure to specify the object type also in END macro! */
iRet = nsd_ptcp.Construct(&pThis->pTcp);
- pThis->iMode = 1; /* TODO: must be made configurable */
- pThis->iMode = 0; /* TODO: must be made configurable */
ENDobjConstruct(nsd_gtls)
@@ -134,6 +132,28 @@ CODESTARTobjDestruct(nsd_gtls)
ENDobjDestruct(nsd_gtls)
+/* Set the driver mode. For us, this has the following meaning:
+ * 0 - work in plain tcp mode, without tls (e.g. before a STARTTLS)
+ * 1 - work in TLS mode
+ * rgerhards, 2008-04-28
+ */
+static rsRetVal
+SetMode(nsd_t *pNsd, int mode)
+{
+ DEFiRet;
+ nsd_gtls_t *pThis = (nsd_gtls_t*) pNsd;
+
+ ISOBJ_TYPE_assert((pThis), nsd_gtls);
+ if(mode != 0 && mode != 1)
+ ABORT_FINALIZE(RS_RET_INVAID_DRVR_MODE);
+
+ pThis->iMode = mode;
+
+finalize_it:
+ RETiRet;
+}
+
+
/* Provide access to the underlying OS socket. This is primarily
* useful for other drivers (like nsd_gtls) who utilize ourselfs
* for some of their functionality. -- rgerhards, 2008-04-18
@@ -301,8 +321,11 @@ Send(nsd_t *pNsd, uchar *pBuf, ssize_t *pLenBuf)
*pLenBuf = iSent;
break;
}
- if(iSent != GNUTLS_E_INTERRUPTED && iSent != GNUTLS_E_AGAIN)
+ if(iSent != GNUTLS_E_INTERRUPTED && iSent != GNUTLS_E_AGAIN) {
+ dbgprintf("unexpected GnuTLS error %d in %s:%d\n", iSent, __FILE__, __LINE__);
+ gnutls_perror(iSent); /* TODO: can we do better? */
ABORT_FINALIZE(RS_RET_GNUTLS_ERR);
+ }
}
finalize_it:
@@ -384,6 +407,7 @@ CODESTARTobjQueryInterface(nsd_gtls)
pIf->Send = Send;
pIf->Connect = Connect;
pIf->SetSock = SetSock;
+ pIf->SetMode = SetMode;
pIf->GetRemoteHName = GetRemoteHName;
pIf->GetRemoteIP = GetRemoteIP;
finalize_it:
diff --git a/runtime/nsd_ptcp.c b/runtime/nsd_ptcp.c
index 2a74e061..5994fee7 100644
--- a/runtime/nsd_ptcp.c
+++ b/runtime/nsd_ptcp.c
@@ -109,6 +109,22 @@ GetSock(nsd_t *pNsd, int *pSock)
}
+/* Set the driver mode. We support no different modes, but allow mode
+ * 0 to be set to be compatible with config file defaults and the other
+ * drivers.
+ * rgerhards, 2008-04-28
+ */
+static rsRetVal
+SetMode(nsd_t __attribute__((unused)) *pNsd, int mode)
+{
+ DEFiRet;
+ if(mode != 0)
+ ABORT_FINALIZE(RS_RET_INVAID_DRVR_MODE);
+finalize_it:
+ RETiRet;
+}
+
+
/* Provide access to the underlying OS socket. This is primarily
* useful for other drivers (like nsd_gtls) who utilize ourselfs
* for some of their functionality.
@@ -609,6 +625,7 @@ CODESTARTobjQueryInterface(nsd_ptcp)
pIf->Abort = Abort;
pIf->GetSock = GetSock;
pIf->SetSock = SetSock;
+ pIf->SetMode = SetMode;
pIf->Rcv = Rcv;
pIf->Send = Send;
pIf->LstnInit = LstnInit;
diff --git a/runtime/rsyslog.h b/runtime/rsyslog.h
index 19fda468..771ad0bb 100644
--- a/runtime/rsyslog.h
+++ b/runtime/rsyslog.h
@@ -219,6 +219,7 @@ enum rsRetVal_ /** return value. All methods return this if not specified oth
RS_RET_GNUTLS_ERR = -2078, /**< (unexpected) error in GnuTLS call */
RS_RET_MAX_SESS_REACHED = -2079, /**< max nbr of sessions reached, can not create more */
RS_RET_MAX_LSTN_REACHED = -2080, /**< max nbr of listeners reached, can not create more */
+ RS_RET_INVAID_DRVR_MODE= -2081, /**< tried to set mode not supported by driver */
/* RainerScript error messages (range 1000.. 1999) */
RS_RET_SYSVAR_NOT_FOUND = 1001, /**< system variable could not be found (maybe misspelled) */
diff --git a/tools/omfwd.c b/tools/omfwd.c
index 719075c7..46c4d0c8 100644
--- a/tools/omfwd.c
+++ b/tools/omfwd.c
@@ -77,6 +77,7 @@ DEFobjCurrIf(tcpclt)
typedef struct _instanceData {
netstrms_t *pNS; /* netstream subsystem */
netstrm_t *pNetstrm; /* our output netstream */
+ int iStrmDrvrMode;
char *f_hname;
int *pSockArray; /* sockets to use for UDP */
int bIsConnected; /* are we connected to remote host? 0 - no, 1 - yes, UDP means addr resolved */
@@ -92,6 +93,7 @@ typedef struct _instanceData {
/* config data */
static uchar *pszTplName = NULL; /* name of the default template to use */
+int iStrmDrvrMode = 0; /* mode for stream driver, driver-dependent (0 mostly means plain tcp) */
/* get the syslog forward port from selector_t. The passed in
@@ -262,6 +264,7 @@ static rsRetVal TCPSendInit(void *pvData)
/* now create the actual stream and connect to the server */
CHKiRet(netstrms.CreateStrm(pData->pNS, &pData->pNetstrm));
CHKiRet(netstrm.ConstructFinalize(pData->pNetstrm));
+ CHKiRet(netstrm.SetDrvrMode(pData->pNetstrm, pData->iStrmDrvrMode));
CHKiRet(netstrm.Connect(pData->pNetstrm, glbl.GetDefPFFamily(),
(uchar*)pData->port, (uchar*)pData->f_hname));
}
@@ -563,6 +566,7 @@ CODE_STD_STRING_REQUESTparseSelectorAct(1)
CHKiRet(tcpclt.SetSendFrame(pData->pTCPClt, TCPSendFrame));
CHKiRet(tcpclt.SetSendPrepRetry(pData->pTCPClt, TCPSendPrepRetry));
CHKiRet(tcpclt.SetFraming(pData->pTCPClt, tcp_framing));
+ pData->iStrmDrvrMode = iStrmDrvrMode;
}
CODE_STD_FINALIZERparseSelectorAct
@@ -604,6 +608,7 @@ static rsRetVal resetConfigVariables(uchar __attribute__((unused)) *pp, void __a
free(pszTplName);
pszTplName = NULL;
}
+ iStrmDrvrMode = 0;
return RS_RET_OK;
}
@@ -618,6 +623,7 @@ CODEmodInit_QueryRegCFSLineHdlr
CHKiRet(objUse(net,LM_NET_FILENAME));
CHKiRet(regCfSysLineHdlr((uchar *)"actionforwarddefaulttemplate", 0, eCmdHdlrGetWord, NULL, &pszTplName, NULL));
+ CHKiRet(regCfSysLineHdlr((uchar *)"actionsendstreamdrivermode", 0, eCmdHdlrInt, NULL, &iStrmDrvrMode, NULL));
CHKiRet(omsdRegCFSLineHdlr((uchar *)"resetconfigvariables", 1, eCmdHdlrCustomHandler, resetConfigVariables, NULL, STD_LOADABLE_MODULE_ID));
ENDmodInit