summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-04-17 19:03:51 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2008-04-17 19:03:51 +0200
commitea4a3a3cd95faf9328def84e3e253d6c1a4375f7 (patch)
treed49ca5ce752b8c5d6b489dc4b5304f45f04ceab5
parentf590c1d52afbae2d16182864084edae84f541835 (diff)
downloadrsyslog-ea4a3a3cd95faf9328def84e3e253d6c1a4375f7.tar.gz
rsyslog-ea4a3a3cd95faf9328def84e3e253d6c1a4375f7.tar.xz
rsyslog-ea4a3a3cd95faf9328def84e3e253d6c1a4375f7.zip
improvements in omfwd and cleanup of omgssapi
- some (small) cleanup of omgssapi - optimized omfwed, now loads TCP code only if this is actually necessary
-rw-r--r--ChangeLog2
-rw-r--r--plugins/omgssapi/omgssapi.c17
-rw-r--r--tools/omfwd.c34
3 files changed, 32 insertions, 21 deletions
diff --git a/ChangeLog b/ChangeLog
index f0fd4748..71766d1d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,8 @@
---------------------------------------------------------------------------
Version 3.19.0 (rgerhards), 2008-04-??
- begins new devel branch version
+- partly rewritten and improved omfwd among others, now loads TCP
+ code only if this is actually necessary
- implemented im3195, the RFC3195 input as a plugin
- split of a "runtime library" for rsyslog - this is not yet a clean
model, because some modularization is still outstanding. In theory,
diff --git a/plugins/omgssapi/omgssapi.c b/plugins/omgssapi/omgssapi.c
index 6f940f99..6d419de0 100644
--- a/plugins/omgssapi/omgssapi.c
+++ b/plugins/omgssapi/omgssapi.c
@@ -58,17 +58,6 @@
MODULE_TYPE_OUTPUT
-#define INET_SUSPEND_TIME 60
-/* equal to 1 minute - TODO: see if we can get rid of this now that we have
- * the retry intervals in the engine -- rgerhards, 2008-03-12
- */
-
-#define INET_RETRY_MAX 30 /* maximum of retries for gethostbyname() */
- /* was 10, changed to 30 because we reduced INET_SUSPEND_TIME by one third. So
- * this "fixes" some of implications of it (see comment on INET_SUSPEND_TIME).
- * rgerhards, 2005-07-26
- * TODO: this needs to be reviewed in spite of the new engine, too -- rgerhards, 2008-03-12
- */
/* internal structures
*/
@@ -86,11 +75,9 @@ typedef struct _instanceData {
eDestFORW_SUSP,
eDestFORW_UNKN
} eDestState;
- int iRtryCnt;
struct addrinfo *f_addr;
int compressionLevel; /* 0 - no compression, else level for zlib */
char *port;
- time_t ttSuspend; /* time selector was suspended */
tcpclt_t *pTCPClt; /* our tcpclt object */
gss_ctx_id_t gss_context;
OM_uint32 gss_flags;
@@ -367,7 +354,6 @@ static rsRetVal doTryResume(instanceData *pData)
getFwdSyslogPt(pData), &hints, &res)) == 0) {
dbgprintf("%s found, resuming.\n", pData->f_hname);
pData->f_addr = res;
- pData->iRtryCnt = 0;
pData->eDestState = eDestFORW;
} else {
iRet = RS_RET_SUSPENDED;
@@ -406,7 +392,6 @@ CODESTARTdoAction
case eDestFORW:
dbgprintf(" %s:%s/%s\n", pData->f_hname, getFwdSyslogPt(pData), "tcp-gssapi");
- pData->ttSuspend = time(NULL);
psz = (char*) ppString[0];
l = strlen((char*) psz);
if (l > MAXLINE)
@@ -609,8 +594,6 @@ CODE_STD_STRING_REQUESTparseSelectorAct(1)
hints.ai_socktype = SOCK_STREAM;
if( (error = getaddrinfo(pData->f_hname, getFwdSyslogPt(pData), &hints, &res)) != 0) {
pData->eDestState = eDestFORW_UNKN;
- pData->iRtryCnt = INET_RETRY_MAX;
- pData->ttSuspend = time(NULL);
} else {
pData->eDestState = eDestFORW;
pData->f_addr = res;
diff --git a/tools/omfwd.c b/tools/omfwd.c
index 6c3a351a..e7b5dcd7 100644
--- a/tools/omfwd.c
+++ b/tools/omfwd.c
@@ -195,6 +195,7 @@ static rsRetVal UDPSend(instanceData *pData, char *msg, size_t len)
RETiRet;
}
+
/* CODE FOR SENDING TCP MESSAGES */
@@ -383,10 +384,29 @@ finalize_it:
ENDdoAction
+/* This function loads TCP support, if not already loaded. It will be called
+ * during config processing. To server ressources, TCP support will only
+ * be loaded if it actually is used. -- rgerhard, 2008-04-17
+ */
+static rsRetVal
+loadTCPSupport(void)
+{
+ DEFiRet;
+ if(!netstrm.ifIsLoaded)
+ CHKiRet(objUse(netstrm, LM_NETSTRM_FILENAME));
+ if(!tcpclt.ifIsLoaded)
+ CHKiRet(objUse(tcpclt, LM_TCPCLT_FILENAME));
+
+finalize_it:
+ RETiRet;
+}
+
+
BEGINparseSelectorAct
uchar *q;
int i;
int bErr;
+ rsRetVal localRet;
struct addrinfo;
TCPFRAMINGMODE tcp_framing = TCP_FRAMING_OCTET_STUFFING;
CODESTARTparseSelectorAct
@@ -398,6 +418,12 @@ CODE_STD_STRING_REQUESTparseSelectorAct(1)
++p; /* eat '@' */
if(*p == '@') { /* indicator for TCP! */
+ localRet = loadTCPSupport();
+ if(localRet != RS_RET_OK) {
+ errmsg.LogError(NO_ERRCODE, "could not activate network stream modules for TCP "
+ "(internal error %d) - are modules missing?", localRet);
+ ABORT_FINALIZE(localRet);
+ }
pData->protocol = FORW_TCP;
++p; /* eat this '@', too */
} else {
@@ -534,8 +560,10 @@ CODESTARTmodExit
objRelease(errmsg, CORE_COMPONENT);
objRelease(glbl, CORE_COMPONENT);
objRelease(net, LM_NET_FILENAME);
- objRelease(netstrm, LM_NETSTRM_FILENAME);
- objRelease(tcpclt, LM_TCPCLT_FILENAME);
+ if(netstrm.ifIsLoaded)
+ objRelease(netstrm, LM_NETSTRM_FILENAME);
+ if(!tcpclt.ifIsLoaded)
+ objRelease(tcpclt, LM_TCPCLT_FILENAME);
if(pszTplName != NULL) {
free(pszTplName);
@@ -571,8 +599,6 @@ CODEmodInit_QueryRegCFSLineHdlr
CHKiRet(objUse(glbl, CORE_COMPONENT));
CHKiRet(objUse(errmsg, CORE_COMPONENT));
CHKiRet(objUse(net,LM_NET_FILENAME));
- CHKiRet(objUse(netstrm, LM_NETSTRM_FILENAME));
- CHKiRet(objUse(tcpclt, LM_TCPCLT_FILENAME));
CHKiRet(regCfSysLineHdlr((uchar *)"actionforwarddefaulttemplate", 0, eCmdHdlrGetWord, NULL, &pszTplName, NULL));
CHKiRet(omsdRegCFSLineHdlr((uchar *)"resetconfigvariables", 1, eCmdHdlrCustomHandler, resetConfigVariables, NULL, STD_LOADABLE_MODULE_ID));