Fixed resolver to not do any DNS resolution if dns_resolution == 0

This commit is contained in:
pdw
2003-08-30 09:40:03 +00:00
parent ebb28db1b6
commit 37f7fadd8a
3 changed files with 31 additions and 24 deletions

View File

@@ -5,7 +5,8 @@ Attributions apply to all preceding items up to the next blank line.
Unattributed items are by Paul Warren and Chris Lightfoot. Unattributed items are by Paul Warren and Chris Lightfoot.
0.14 0.14
* Fixed DNS resolution so that no lookups are done if options.dns_resolution ==
0
* Configure/compilation fixes for Mac OS X * Configure/compilation fixes for Mac OS X
* MacOS interfaces to avoid by default * MacOS interfaces to avoid by default

View File

@@ -21,7 +21,7 @@ AC_CONFIG_AUX_DIR(config)
AC_CANONICAL_SYSTEM AC_CANONICAL_SYSTEM
AM_CONFIG_HEADER(config.h) AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(iftop, "0.13") AM_INIT_AUTOMAKE(iftop, "0.14pre2")
AC_DEFINE_UNQUOTED(IFTOP_VERSION, "$VERSION", [The iftop version number]) AC_DEFINE_UNQUOTED(IFTOP_VERSION, "$VERSION", [The iftop version number])

View File

@@ -19,6 +19,7 @@
#include "threadprof.h" #include "threadprof.h"
#include "options.h"
#define RESOLVE_QUEUE_LENGTH 20 #define RESOLVE_QUEUE_LENGTH 20
@@ -33,6 +34,8 @@ hash_type* ns_hash;
int head; int head;
int tail; int tail;
extern options_t options;
/* /*
* We have a choice of resolver methods. Real computers have getnameinfo or * We have a choice of resolver methods. Real computers have getnameinfo or
@@ -335,6 +338,8 @@ void resolve(struct in_addr* addr, char* result, int buflen) {
char* hostname; char* hostname;
int added = 0; int added = 0;
if(options.dnsresolution == 1) {
pthread_mutex_lock(&resolver_queue_mutex); pthread_mutex_lock(&resolver_queue_mutex);
if(hash_find(ns_hash, addr, (void**)&hostname) == HASH_STATUS_OK) { if(hash_find(ns_hash, addr, (void**)&hostname) == HASH_STATUS_OK) {
@@ -363,4 +368,5 @@ void resolve(struct in_addr* addr, char* result, int buflen) {
strncpy(result, hostname, buflen - 1); strncpy(result, hostname, buflen - 1);
result[buflen - 1] = '\0'; result[buflen - 1] = '\0';
} }
}
} }