From c518b55a671d53f7f84ab6082428d5836fa85530 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Thu, 27 Nov 2014 14:15:25 +0100 Subject: [PATCH] deprecate -S command line parameter and add replacement --- plugins/omrelp/omrelp.c | 11 +++++++++-- tools/rsyslogd.8 | 4 ---- tools/rsyslogd.c | 3 +++ 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/plugins/omrelp/omrelp.c b/plugins/omrelp/omrelp.c index 543e738fb..647f17533 100644 --- a/plugins/omrelp/omrelp.c +++ b/plugins/omrelp/omrelp.c @@ -84,6 +84,7 @@ typedef struct _instanceData { uchar *myCertFile; uchar *myPrivKeyFile; uchar *tplName; + uchar *localClientIP; struct { int nmemb; uchar **name; @@ -121,6 +122,7 @@ static struct cnfparamdescr actpdescr[] = { { "rebindinterval", eCmdHdlrInt, 0 }, { "windowsize", eCmdHdlrInt, 0 }, { "timeout", eCmdHdlrInt, 0 }, + { "localclientip", eCmdHdlrGetWord, 0 }, { "template", eCmdHdlrGetWord, 0 } }; static struct cnfparamblk actpblk = @@ -212,8 +214,8 @@ doCreateRelpClient(wrkrInstanceData_t *pWrkrData) relpCltAddPermittedPeer(pWrkrData->pRelpClt, (char*)pData->permittedPeers.name[i]); } } - if(glbl.GetSourceIPofLocalClient() == NULL) { /* ar Do we have a client IP set? */ - if(relpCltSetClientIP(pWrkrData->pRelpClt, glbl.GetSourceIPofLocalClient()) != RELP_RET_OK) + if(pData->localClientIP == NULL) { + if(relpCltSetClientIP(pWrkrData->pRelpClt, pData->localClientIP) != RELP_RET_OK) ABORT_FINALIZE(RS_RET_RELP_ERR); } pWrkrData->bInitialConnect = 1; @@ -232,6 +234,7 @@ CODESTARTcreateInstance pData->bHadAuthFail = 0; pData->pristring = NULL; pData->authmode = NULL; + pData->localClientIP = NULL; pData->caCertFile = NULL; pData->myCertFile = NULL; pData->myPrivKeyFile = NULL; @@ -252,6 +255,7 @@ CODESTARTfreeInstance free(pData->tplName); free(pData->pristring); free(pData->authmode); + free(pData->localClientIP); free(pData->caCertFile); free(pData->myCertFile); free(pData->myPrivKeyFile); @@ -279,6 +283,7 @@ setInstParamDefaults(instanceData *pData) pData->bEnableTLSZip = DFLT_ENABLE_TLSZIP; pData->pristring = NULL; pData->authmode = NULL; + pData->localClientIP = (uchar*)strdup((char*)glbl.GetSourceIPofLocalClient()); pData->caCertFile = NULL; pData->myCertFile = NULL; pData->myPrivKeyFile = NULL; @@ -306,6 +311,8 @@ CODESTARTnewActInst pData->port = (uchar*)es_str2cstr(pvals[i].val.d.estr, NULL); } else if(!strcmp(actpblk.descr[i].name, "template")) { pData->tplName = (uchar*)es_str2cstr(pvals[i].val.d.estr, NULL); + } else if(!strcmp(actpblk.descr[i].name, "localclientip")) { + pData->localClientIP = (uchar*)es_str2cstr(pvals[i].val.d.estr, NULL); } else if(!strcmp(actpblk.descr[i].name, "timeout")) { pData->timeout = (unsigned) pvals[i].val.d.n; } else if(!strcmp(actpblk.descr[i].name, "rebindinterval")) { diff --git a/tools/rsyslogd.8 b/tools/rsyslogd.8 index 058020a9c..a2e475f4b 100644 --- a/tools/rsyslogd.8 +++ b/tools/rsyslogd.8 @@ -155,10 +155,6 @@ is specified and the host logging resolves to satu.infodrom.north.de no domain would be cut, you will have to specify two domains like: .BR "\-s north.de:infodrom.north.de" . .TP -.BI "\-S ip_address" "local client source IP" -rsyslogd uses ip_address as local client address while connecting -to remote logserver. Currently used by omrelp only and only with tcp. -.TP .BI "\-u " "userlevel" This is a "catch all" option for some very seldomly-used user settings. The "userlevel" variable selects multiple things. Add the specific values diff --git a/tools/rsyslogd.c b/tools/rsyslogd.c index ac0e68f11..6f466dc43 100644 --- a/tools/rsyslogd.c +++ b/tools/rsyslogd.c @@ -1123,6 +1123,9 @@ initAll(int argc, char **argv) send_to_all++; break; case 'S': /* Source IP for local client to be used on multihomed host */ + fprintf (stderr, "rsyslogd: the -S command line option will go away " + "soon.\n" + "Please use the omrelp paramter \"localClientIP\" instead.\n"); if(glbl.GetSourceIPofLocalClient() != NULL) { fprintf (stderr, "rsyslogd: Only one -S argument allowed, the first one is taken.\n"); } else {