summaryrefslogtreecommitdiffstats
path: root/tools/syslogd.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2009-07-01 13:28:17 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2009-07-01 13:28:17 +0200
commitd6faee67b413d1f257c96a14e46f15ec1868a365 (patch)
treeed14d4a3446251b502c2587656bc0e09437cb230 /tools/syslogd.c
parentf76881fff39b46630d95a8d8308f383bec1b8be8 (diff)
downloadrsyslog-d6faee67b413d1f257c96a14e46f15ec1868a365.tar.gz
rsyslog-d6faee67b413d1f257c96a14e46f15ec1868a365.tar.xz
rsyslog-d6faee67b413d1f257c96a14e46f15ec1868a365.zip
RcvFromIP now also a property
This sets stage to enable use of the property-interface to speed up things (mildly), the next step to be done. I have also fixed one regression of yesterday's changes.
Diffstat (limited to 'tools/syslogd.c')
-rw-r--r--tools/syslogd.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/tools/syslogd.c b/tools/syslogd.c
index 3694c70a..be5b5aad 100644
--- a/tools/syslogd.c
+++ b/tools/syslogd.c
@@ -211,6 +211,7 @@ static rsRetVal GlobalClassExit(void);
#endif
static prop_t *pInternalInputName = NULL; /* there is only one global inputName for all internally-generated messages */
+static prop_t *pLocalHostIP = NULL; /* there is only one global IP for all internally-generated messages */
static uchar *ConfFile = (uchar*) _PATH_LOGCONF; /* read-only after startup */
static char *PidFile = _PATH_LOGPID; /* read-only after startup */
@@ -598,7 +599,7 @@ static inline rsRetVal printline(uchar *hname, uchar *hnameIP, uchar *msg, int f
MsgSetHOSTNAME(pMsg, hname, ustrlen(hname));
MsgSetRcvFromStr(pMsg, hname, ustrlen(hname));
MsgSetAfterPRIOffs(pMsg, p - msg);
- CHKiRet(MsgSetRcvFromIP(pMsg, hnameIP));
+ CHKiRet(MsgSetRcvFromIPStr(pMsg, hnameIP, ustrlen(hname)));
logmsg(pMsg, flags);
@@ -871,7 +872,7 @@ logmsgInternal(int iErr, int pri, uchar *msg, int flags)
MsgSetRawMsgWOSize(pMsg, (char*)msg);
MsgSetHOSTNAME(pMsg, glbl.GetLocalHostName(), ustrlen(glbl.GetLocalHostName()));
MsgSetRcvFrom(pMsg, glbl.GetLocalHostNameProp());
- MsgSetRcvFromIP(pMsg, UCHAR_CONSTANT("127.0.0.1"));
+ MsgSetRcvFromIP(pMsg, pLocalHostIP);
/* check if we have an error code associated and, if so,
* adjust the tag. -- rgerhards, 2008-06-27
*/
@@ -1697,9 +1698,11 @@ die(int sig)
legacyOptsFree();
- /* destruct our input name */
+ /* destruct our global properties */
if(pInternalInputName != NULL)
prop.Destruct(&pInternalInputName);
+ if(pLocalHostIP != NULL)
+ prop.Destruct(&pLocalHostIP);
/* terminate the remaining classes */
GlobalClassExit();
@@ -3208,9 +3211,13 @@ int realMain(int argc, char **argv)
/* we need to create the inputName property (only once during our lifetime) */
CHKiRet(prop.Construct(&pInternalInputName));
- CHKiRet(prop.SetString(pInternalInputName, UCHAR_CONSTANT("rsyslgod"), sizeof("rsyslgod") - 1));
+ CHKiRet(prop.SetString(pInternalInputName, UCHAR_CONSTANT("rsyslogd"), sizeof("rsyslgod") - 1));
CHKiRet(prop.ConstructFinalize(pInternalInputName));
+ CHKiRet(prop.Construct(&pLocalHostIP));
+ CHKiRet(prop.SetString(pLocalHostIP, UCHAR_CONSTANT("127.0.0.1"), sizeof("127.0.0.1") - 1));
+ CHKiRet(prop.ConstructFinalize(pLocalHostIP));
+
/* get our host and domain names - we need to do this early as we may emit
* error log messages, which need the correct hostname. -- rgerhards, 2008-04-04
*/