diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2008-07-14 14:46:47 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2008-07-14 14:46:47 +0200 |
commit | 40a4ddac7a0fc2ff2dcfd584976ea7ce8bdcfc7b (patch) | |
tree | 8e8d1ecfbf7de4d3fae4eead50c08e6ef0d9b6fa /tools/omfwd.c | |
parent | a6de2e589254dbfffd2746d8efbefc04f8ed3725 (diff) | |
download | rsyslog-40a4ddac7a0fc2ff2dcfd584976ea7ce8bdcfc7b.tar.gz rsyslog-40a4ddac7a0fc2ff2dcfd584976ea7ce8bdcfc7b.tar.bz2 rsyslog-40a4ddac7a0fc2ff2dcfd584976ea7ce8bdcfc7b.zip |
bugfix: UDP syslog forwarding did not work on all platforms
the ai_socktype was incorrectly set to 1. On some platforms, this
lead to failing name resolution (e.g. FreeBSD 7). Thanks to HKS for
reporting the bug.
Diffstat (limited to 'tools/omfwd.c')
-rw-r--r-- | tools/omfwd.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/tools/omfwd.c b/tools/omfwd.c index 715457c9..30761a87 100644 --- a/tools/omfwd.c +++ b/tools/omfwd.c @@ -334,9 +334,10 @@ finalize_it: */ static rsRetVal doTryResume(instanceData *pData) { - DEFiRet; + int iErr; struct addrinfo *res; struct addrinfo hints; + DEFiRet; if(pData->bIsConnected) FINALIZE; @@ -348,8 +349,10 @@ static rsRetVal doTryResume(instanceData *pData) /* port must be numeric, because config file syntax requires this */ hints.ai_flags = AI_NUMERICSERV; hints.ai_family = glbl.GetDefPFFamily(); - hints.ai_socktype = pData->protocol == SOCK_DGRAM; - if((getaddrinfo(pData->f_hname, getFwdPt(pData), &hints, &res)) != 0) { + hints.ai_socktype = SOCK_DGRAM; + if((iErr = (getaddrinfo(pData->f_hname, getFwdPt(pData), &hints, &res))) != 0) { + dbgprintf("could not get addrinfo for hostname '%s':'%s': %d%s\n", + pData->f_hname, getFwdPt(pData), iErr, gai_strerror(iErr)); ABORT_FINALIZE(RS_RET_SUSPENDED); } dbgprintf("%s found, resuming.\n", pData->f_hname); |