Browse Source

- fix: do not perform rev dns. when comparing an ip with a string or avp
(in the script), if rev_dns is not set

Andrei Pelinescu-Onciul 18 years ago
parent
commit
ac4f791faf
2 changed files with 5 additions and 7 deletions
  1. 1 1
      resolve.h
  2. 4 6
      route.c

+ 1 - 1
resolve.h

@@ -167,7 +167,7 @@ extern int dns_tls_pref;  /* tls transport preference (for naptr) */
 
 
 #define rev_resolvehost(ip)\
-					gethostbyaddr((char*)(ip)->u.addr, (ip)->len, (ip)->af);
+					gethostbyaddr((char*)(ip)->u.addr, (ip)->len, (ip)->af)
 
 
 

+ 4 - 6
route.c

@@ -914,18 +914,16 @@ inline static int comp_ip(int op, struct ip_addr* ip, int rtype, union exp_op* r
 					/* 3: (slow) rev dns the address
 					* and compare with all the aliases
 					* !!??!! review: remove this? */
-					he=rev_resolvehost(ip);
-					if (he==0){
-						print_ip( "comp_ip: could not rev_resolve ip address:"
-									" ", ip, "\n");
-					ret=0;
-					}else{
+					if (unlikely((received_dns & DO_REV_DNS) && 
+							((he=rev_resolvehost(ip))!=0) )){
 						/*  compare with primary host name */
 						ret=comp_string(op, he->h_name, rtype, r);
 						/* compare with all the aliases */
 						for(h=he->h_aliases; (ret!=1) && (*h); h++){
 							ret=comp_string(op, *h, rtype, r);
 						}
+					}else{
+						ret=0;
 					}
 					break;
 				case DIFF_OP: