summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--runtime/netstrm.c2
-rw-r--r--runtime/netstrm.h5
-rw-r--r--runtime/nsd.h5
-rw-r--r--runtime/nsd_gtls.c7
-rw-r--r--runtime/nsd_ptcp.c6
-rw-r--r--tools/omfwd.c11
7 files changed, 30 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 29cc48c0..a35a7028 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -25,6 +25,9 @@ Version 6.4.1 [V6-STABLE] 2012-08-??
occurs with legacy config action syntax. This was a regression
caused by an incorrect merge in to the 6.3.x codebase.
Thanks to Stefano Mason for alerting us of this bug.
+- bugfix: Fixed TCP CheckConnection handling in omfwd.c. Interface needed
+ to be changed in lower stream classes. Syslog TCP Sending is now resumed
+ properly.
---------------------------------------------------------------------------
Version 6.4.0 [V6-STABLE] 2012-08-20
- THIS IS THE FIRST VERSION OF THE 6.4.x STABLE BRANCH
diff --git a/runtime/netstrm.c b/runtime/netstrm.c
index a6f840a5..49ba8f35 100644
--- a/runtime/netstrm.c
+++ b/runtime/netstrm.c
@@ -250,7 +250,7 @@ EnableKeepAlive(netstrm_t *pThis)
/* check connection - slim wrapper for NSD driver function */
-static void
+static rsRetVal
CheckConnection(netstrm_t *pThis)
{
ISOBJ_TYPE_assert(pThis, netstrm);
diff --git a/runtime/netstrm.h b/runtime/netstrm.h
index f6931104..ee8d9e59 100644
--- a/runtime/netstrm.h
+++ b/runtime/netstrm.h
@@ -53,7 +53,7 @@ BEGINinterface(netstrm) /* name must also be changed in ENDinterface macro! */
rsRetVal (*SetDrvrMode)(netstrm_t *pThis, int iMode);
rsRetVal (*SetDrvrAuthMode)(netstrm_t *pThis, uchar*);
rsRetVal (*SetDrvrPermPeers)(netstrm_t *pThis, permittedPeers_t*);
- void (*CheckConnection)(netstrm_t *pThis); /* This is a trick mostly for plain tcp syslog */
+ rsRetVal (*CheckConnection)(netstrm_t *pThis); /* This is a trick mostly for plain tcp syslog */
/* the GetSock() below is a hack to make imgssapi work. In the long term,
* we should migrate imgssapi to a stream driver, which will relieve us of
* this problem. Please note that nobody else should use GetSock(). Using it
@@ -72,9 +72,10 @@ BEGINinterface(netstrm) /* name must also be changed in ENDinterface macro! */
/* v4 */
rsRetVal (*EnableKeepAlive)(netstrm_t *pThis);
ENDinterface(netstrm)
-#define netstrmCURR_IF_VERSION 4 /* increment whenever you change the interface structure! */
+#define netstrmCURR_IF_VERSION 5 /* increment whenever you change the interface structure! */
/* interface version 3 added GetRemAddr()
* interface version 4 added EnableKeepAlive() -- rgerhards, 2009-06-02
+ * interface version 5 changed return of CheckConnection from void to rsRetVal -- alorbach, 2012-09-06
* */
/* prototypes */
diff --git a/runtime/nsd.h b/runtime/nsd.h
index ab64c443..d7d6abbd 100644
--- a/runtime/nsd.h
+++ b/runtime/nsd.h
@@ -63,7 +63,7 @@ BEGINinterface(nsd) /* name must also be changed in ENDinterface macro! */
rsRetVal (*SetMode)(nsd_t *pThis, int mode); /* sets a driver specific mode - see driver doc for details */
rsRetVal (*SetAuthMode)(nsd_t *pThis, uchar*); /* sets a driver specific mode - see driver doc for details */
rsRetVal (*SetPermPeers)(nsd_t *pThis, permittedPeers_t*); /* sets driver permitted peers for auth needs */
- void (*CheckConnection)(nsd_t *pThis); /* This is a trick mostly for plain tcp syslog */
+ rsRetVal (*CheckConnection)(nsd_t *pThis); /* This is a trick mostly for plain tcp syslog */
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
@@ -80,9 +80,10 @@ BEGINinterface(nsd) /* name must also be changed in ENDinterface macro! */
/* v5 */
rsRetVal (*EnableKeepAlive)(nsd_t *pThis);
ENDinterface(nsd)
-#define nsdCURR_IF_VERSION 5 /* increment whenever you change the interface structure! */
+#define nsdCURR_IF_VERSION 6 /* increment whenever you change the interface structure! */
/* interface version 4 added GetRemAddr()
* interface version 5 added EnableKeepAlive() -- rgerhards, 2009-06-02
+ * interface version 6 changed return of CheckConnection from void to rsRetVal -- alorbach, 2012-09-06
*/
/* interface for the select call */
diff --git a/runtime/nsd_gtls.c b/runtime/nsd_gtls.c
index c2db9c94..71eafbd2 100644
--- a/runtime/nsd_gtls.c
+++ b/runtime/nsd_gtls.c
@@ -1316,13 +1316,16 @@ finalize_it:
* This is a dummy here. For details, check function common in ptcp driver.
* rgerhards, 2008-06-09
*/
-static void
+static rsRetVal
CheckConnection(nsd_t __attribute__((unused)) *pNsd)
{
+ DEFiRet;
nsd_gtls_t *pThis = (nsd_gtls_t*) pNsd;
ISOBJ_TYPE_assert(pThis, nsd_gtls);
- nsd_ptcp.CheckConnection(pThis->pTcp);
+ CHKiRet(nsd_ptcp.CheckConnection(pThis->pTcp));
+finalize_it:
+ RETiRet;
}
diff --git a/runtime/nsd_ptcp.c b/runtime/nsd_ptcp.c
index a174899c..12f891ea 100644
--- a/runtime/nsd_ptcp.c
+++ b/runtime/nsd_ptcp.c
@@ -694,9 +694,10 @@ finalize_it:
* http://blog.gerhards.net/2008/06/getting-bit-more-reliability-from-plain.html
* rgerhards, 2008-06-09
*/
-static void
+static rsRetVal
CheckConnection(nsd_t *pNsd)
{
+ DEFiRet;
int rc;
char msgbuf[1]; /* dummy */
nsd_ptcp_t *pThis = (nsd_ptcp_t*) pNsd;
@@ -709,7 +710,10 @@ CheckConnection(nsd_t *pNsd)
* need to close our side, too.
*/
sockClose(&pThis->sock);
+ ABORT_FINALIZE(RS_RET_IO_ERROR);
}
+finalize_it:
+ RETiRet;
}
diff --git a/tools/omfwd.c b/tools/omfwd.c
index 2a19aae4..b4a28c34 100644
--- a/tools/omfwd.c
+++ b/tools/omfwd.c
@@ -314,7 +314,7 @@ TCPSendBuf(instanceData *pData, uchar *buf, unsigned len)
ssize_t lenSend;
alreadySent = 0;
- netstrm.CheckConnection(pData->pNetstrm); /* hack for plain tcp syslog - see ptcp driver for details */
+ CHKiRet(netstrm.CheckConnection(pData->pNetstrm)); /* hack for plain tcp syslog - see ptcp driver for details */
while(alreadySent != len) {
lenSend = len - alreadySent;
CHKiRet(netstrm.Send(pData->pNetstrm, buf+alreadySent, &lenSend));
@@ -323,6 +323,12 @@ TCPSendBuf(instanceData *pData, uchar *buf, unsigned len)
}
finalize_it:
+ if(iRet != RS_RET_OK) {
+ /* error! */
+ dbgprintf("TCPSendBuf error %d, destruct TCP Connection!\n", iRet);
+ DestructTCPInstanceData(pData);
+ iRet = RS_RET_SUSPENDED;
+ }
RETiRet;
}
@@ -367,6 +373,7 @@ static rsRetVal TCPSendPrepRetry(void *pvData)
{
DEFiRet;
instanceData *pData = (instanceData *) pvData;
+dbgprintf("TCPSendPrepRetry performs a DestructTCPInstanceData\n");
assert(pData != NULL);
DestructTCPInstanceData(pData);
@@ -384,6 +391,7 @@ static rsRetVal TCPSendInit(void *pvData)
assert(pData != NULL);
if(pData->pNetstrm == NULL) {
+ dbgprintf("TCPSendInit CREATE\n");
CHKiRet(netstrms.Construct(&pData->pNS));
/* the stream driver must be set before the object is finalized! */
CHKiRet(netstrms.SetDrvrName(pData->pNS, pData->pszStrmDrvr));
@@ -407,6 +415,7 @@ static rsRetVal TCPSendInit(void *pvData)
finalize_it:
if(iRet != RS_RET_OK) {
+ dbgprintf("TCPSendInit FAILED with %d.\n", iRet);
DestructTCPInstanceData(pData);
}