summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-08-05 15:02:49 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2008-08-05 15:02:49 +0200
commit15adf8f1fda97b5c744e92390ef7e41ce3d7f3b2 (patch)
tree8a70d11e1c38d74621ef4cdf0abe95c1c9a364ab
parent87576f85699afd0aba3f8a3716b343f8f568d1f0 (diff)
downloadrsyslog-15adf8f1fda97b5c744e92390ef7e41ce3d7f3b2.tar.gz
rsyslog-15adf8f1fda97b5c744e92390ef7e41ce3d7f3b2.tar.xz
rsyslog-15adf8f1fda97b5c744e92390ef7e41ce3d7f3b2.zip
bugfix: IPv6 addresses could not be specified in forwarding actions
New syntax @[addr]:port introduced to enable that. Root problem was IPv6 addresses contain colons. Also somewhat enhanced debugging messages.
-rw-r--r--ChangeLog6
-rw-r--r--configure.ac2
-rw-r--r--doc/rsyslog_conf.html11
-rw-r--r--plugins/ommail/ommail.c5
-rw-r--r--tools/omfwd.c19
5 files changed, 39 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 185ce688..8aaba62d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,10 @@
---------------------------------------------------------------------------
+Version 3.21.3 [DEVEL] (rgerhards), 2008-08-05
+- bugfix: IPv6 addresses could not be specified in forwarding actions
+ New syntax @[addr]:port introduced to enable that. Root problem was IPv6
+ addresses contain colons.
+- somewhat enhanced debugging messages
+---------------------------------------------------------------------------
Version 3.21.2 [DEVEL] (rgerhards), 2008-08-04
- added $InputUnixListenSocketHostName config directive, which permits to
override the hostname being used on a local unix socket. This is useful
diff --git a/configure.ac b/configure.ac
index 624cef04..855751b8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.61)
-AC_INIT([rsyslog],[3.21.2],[rsyslog@lists.adiscon.com])
+AC_INIT([rsyslog],[3.21.3-Test2],[rsyslog@lists.adiscon.com])
AM_INIT_AUTOMAKE
AC_CONFIG_SRCDIR([ChangeLog])
AC_CONFIG_HEADERS([config.h])
diff --git a/doc/rsyslog_conf.html b/doc/rsyslog_conf.html
index 39e69c90..d3858941 100644
--- a/doc/rsyslog_conf.html
+++ b/doc/rsyslog_conf.html
@@ -788,7 +788,7 @@ administration needs.<br>
forward messages it has received from the network to another host.
Specify the "-h" option to enable this.</b></p>
<p>To forward messages to another host, prepend the hostname with
-the at sign ("@").&nbsp; A single at sign means that messages will
+the at sign ("@"). A single at sign means that messages will
be forwarded via UDP protocol (the standard for syslog). If you prepend
two at signs ("@@"), the messages will be transmitted via TCP. Please
note that plain TCP based syslog is not officially standardized, but
@@ -871,6 +871,15 @@ port 1470.</p>
<p>In the example above, messages are forwarded via UDP to the
machine 192.168.0.1, the destination port defaults to 514. Messages
will not be compressed.</p>
+<p>Note that IPv6 addresses contain colons. So if an IPv6 address is specified
+in the hostname part, rsyslogd could not detect where the IP address ends
+and where the port starts. Since rsyslog 3.21.3 there is a syntax extension to support this:
+put squary brackets around the address (e.g. "[2001::1]"). Square
+brackets also work with real host names and IPv4 addresses, too.
+<p>A valid sample to send messages to the IPv6 host 2001::1 at port 515
+is as follows:
+<p>*.* @[2001::1]:515
+<p>This works with TCP, too.
<p><b>Note to sysklogd users:</b> sysklogd does <b>not</b>
support RFC 3164 format, which is the default forwarding template in
rsyslog. As such, you will experience duplicate hostnames if rsyslog is
diff --git a/plugins/ommail/ommail.c b/plugins/ommail/ommail.c
index 39c2d21f..5faadce3 100644
--- a/plugins/ommail/ommail.c
+++ b/plugins/ommail/ommail.c
@@ -129,6 +129,8 @@ addRcpt(void __attribute__((unused)) *pVal, uchar *pNewVal)
pNew->pNext = lstRcpt;
lstRcpt = pNew;
+ dbgprintf("ommail::addRcpt adds recipient %s\n", pNewVal);
+
finalize_it:
if(iRet != RS_RET_OK) {
if(pNew != NULL)
@@ -155,6 +157,7 @@ WriteRcpts(instanceData *pData, uchar *pszOp, size_t lenOp, int iStatusToCheck)
assert(lenOp != 0);
for(pRcpt = pData->md.smtp.lstRcpt ; pRcpt != NULL ; pRcpt = pRcpt->pNext) {
+ dbgprintf("Sending '%s: <%s>'\n", pszOp, pRcpt->pszTo);
CHKiRet(Send(pData->md.smtp.sock, (char*)pszOp, lenOp));
CHKiRet(Send(pData->md.smtp.sock, ": <", sizeof(": <") - 1));
CHKiRet(Send(pData->md.smtp.sock, (char*)pRcpt->pszTo, strlen((char*)pRcpt->pszTo)));
@@ -696,6 +699,8 @@ CODEmodInit_QueryRegCFSLineHdlr
CHKiRet(objUse(errmsg, CORE_COMPONENT));
CHKiRet(objUse(glbl, CORE_COMPONENT));
+ dbgprintf("ommail version %s initializing\n", VERSION);
+
CHKiRet(omsdRegCFSLineHdlr( (uchar *)"actionmailsmtpserver", 0, eCmdHdlrGetWord, NULL, &pszSrv, STD_LOADABLE_MODULE_ID));
CHKiRet(omsdRegCFSLineHdlr( (uchar *)"actionmailsmtpport", 0, eCmdHdlrGetWord, NULL, &pszSrvPort, STD_LOADABLE_MODULE_ID));
CHKiRet(omsdRegCFSLineHdlr( (uchar *)"actionmailfrom", 0, eCmdHdlrGetWord, NULL, &pszFrom, STD_LOADABLE_MODULE_ID));
diff --git a/tools/omfwd.c b/tools/omfwd.c
index 30761a87..df2f0342 100644
--- a/tools/omfwd.c
+++ b/tools/omfwd.c
@@ -509,6 +509,9 @@ CODE_STD_STRING_REQUESTparseSelectorAct(1)
* applies to TCP-based syslog only and is ignored when specified with UDP).
* That is not yet implemented.
* rgerhards, 2006-12-07
+ * In order to support IPv6 addresses, we must introduce an extension to
+ * the hostname. If it is in square brackets, whatever is in them is treated as
+ * the hostname - without any exceptions ;) -- rgerhards, 2008-08-05
*/
if(*p == '(') {
/* at this position, it *must* be an option indicator */
@@ -555,11 +558,22 @@ CODE_STD_STRING_REQUESTparseSelectorAct(1)
*/
errmsg.LogError(0, NO_ERRCODE, "Option block not terminated in forwarding action.");
}
+
/* extract the host first (we do a trick - we replace the ';' or ':' with a '\0')
* now skip to port and then template name. rgerhards 2005-07-06
*/
- for(q = p ; *p && *p != ';' && *p != ':' && *p != '#' ; ++p)
- /* JUST SKIP */;
+ if(*p == '[') { /* everything is hostname upto ']' */
+ ++p; /* skip '[' */
+ for(q = p ; *p && *p != ']' ; ++p)
+ /* JUST SKIP */;
+ if(*p == ']') {
+ *p = '\0'; /* trick to obtain hostname (later)! */
+ ++p; /* eat it */
+ }
+ } else { /* traditional view of hostname */
+ for(q = p ; *p && *p != ';' && *p != ':' && *p != '#' ; ++p)
+ /* JUST SKIP */;
+ }
pData->port = NULL;
if(*p == ':') { /* process port */
@@ -594,6 +608,7 @@ CODE_STD_STRING_REQUESTparseSelectorAct(1)
} else {
CHKmalloc(pData->f_hname = strdup((char*) q));
}
+dbgprintf("hostname '%s', port '%s'\n", pData->f_hname, pData->port);
/* process template */
CHKiRet(cflineParseTemplateName(&p, *ppOMSR, 0, OMSR_NO_RQD_TPL_OPTS,