From 2fdf3bec3bdc2ec79c114d6bcbdc702064d377cd Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Thu, 9 Feb 2012 15:12:36 +0100 Subject: dns cache: working on invalid resolution bug, again the proposed solution did not work out well... --- configure.ac | 2 +- runtime/dnscache.c | 6 ++++-- runtime/msg.c | 3 ++- runtime/net.c | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index 886b9c4e..2f4c2c9b 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],[6.3.7],[rsyslog@lists.adiscon.com]) +AC_INIT([rsyslog],[6.3.7-tmp1],[rsyslog@lists.adiscon.com]) AM_INIT_AUTOMAKE m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) diff --git a/runtime/dnscache.c b/runtime/dnscache.c index 8ce1a43b..32d6e425 100644 --- a/runtime/dnscache.c +++ b/runtime/dnscache.c @@ -179,6 +179,7 @@ resolveAddr(struct sockaddr_storage *addr, uchar *pszHostFQDN, uchar *ip) error = mygetnameinfo((struct sockaddr *)addr, SALEN((struct sockaddr *) addr), (char*)pszHostFQDN, NI_MAXHOST, NULL, 0, NI_NAMEREQD); +dbgprintf("dnscache: error %d after 2nd mygetnameinfo\n", error); if(error == 0) { memset (&hints, 0, sizeof (struct addrinfo)); hints.ai_flags = AI_NUMERICHOST; @@ -223,14 +224,14 @@ resolveAddr(struct sockaddr_storage *addr, uchar *pszHostFQDN, uchar *ip) error = 1; /* that will trigger using IP address below. */ } - } + } pthread_sigmask(SIG_SETMASK, &omask, NULL); } +dbgprintf("dnscache: error %d, DisableDNS %d\n", error, glbl.GetDisableDNS()); if(error || glbl.GetDisableDNS()) { dbgprintf("Host name for your address (%s) unknown\n", ip); strcpy((char*) pszHostFQDN, (char*)ip); - ABORT_FINALIZE(RS_RET_ADDRESS_UNKNOWN); } finalize_it: @@ -344,6 +345,7 @@ dbgprintf("XXXX: hostn '%s', ip '%s'\n", etry->pszHostFQDN, etry->ip); finalize_it: pthread_rwlock_unlock(&dnsCache.rwlock); +dbgprintf("XXXX: dnscacheLookup finished, iRet=%d\n", iRet); if(iRet != RS_RET_OK && iRet != RS_RET_ADDRESS_UNKNOWN) { DBGPRINTF("dnscacheLookup failed with iRet %d\n", iRet); strcpy((char*) pszHostFQDN, "???"); diff --git a/runtime/msg.c b/runtime/msg.c index f457e072..66911c16 100644 --- a/runtime/msg.c +++ b/runtime/msg.c @@ -421,6 +421,7 @@ resolveDNS(msg_t *pMsg) { uchar fromHostFQDN[NI_MAXHOST]; DEFiRet; +dbgprintf("XXXX: in msg/resolveDNS (dnscache)\n"); MsgLock(pMsg); CHKiRet(objUse(net, CORE_COMPONENT)); if(pMsg->msgFlags & NEEDS_DNSRESOL) { @@ -431,12 +432,12 @@ resolveDNS(msg_t *pMsg) { } } finalize_it: - MsgUnlock(pMsg); if(iRet != RS_RET_OK) { /* best we can do: remove property */ MsgSetRcvFromStr(pMsg, UCHAR_CONSTANT(""), 0, &propFromHost); prop.Destruct(&propFromHost); } + MsgUnlock(pMsg); if(propFromHost != NULL) prop.Destruct(&propFromHost); if(propFromHostIP != NULL) diff --git a/runtime/net.c b/runtime/net.c index e1e25df8..4631adc4 100644 --- a/runtime/net.c +++ b/runtime/net.c @@ -1130,7 +1130,7 @@ rsRetVal cvthname(struct sockaddr_storage *f, uchar *pszHost, uchar *pszHostFQDN iRet = dnscacheLookup(f, pszHostFQDN, pszIP); - if(iRet == RS_RET_INVALID_SOURCE || iRet == RS_RET_ADDRESS_UNKNOWN) { + if(iRet == RS_RET_INVALID_SOURCE) { strcpy((char*) pszHost, (char*) pszHostFQDN); /* we use whatever was provided as replacement */ ABORT_FINALIZE(RS_RET_OK); /* this is handled, we are happy with it */ } else if(iRet != RS_RET_OK) { -- cgit