Browse code

- 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 authored on 17/12/2007 17:51:04
Showing 2 changed files
... ...
@@ -167,7 +167,7 @@ extern int dns_tls_pref;  /* tls transport preference (for naptr) */
167 167
 
168 168
 
169 169
 #define rev_resolvehost(ip)\
170
-					gethostbyaddr((char*)(ip)->u.addr, (ip)->len, (ip)->af);
170
+					gethostbyaddr((char*)(ip)->u.addr, (ip)->len, (ip)->af)
171 171
 
172 172
 
173 173
 
... ...
@@ -914,18 +914,16 @@ inline static int comp_ip(int op, struct ip_addr* ip, int rtype, union exp_op* r
914 914
 					/* 3: (slow) rev dns the address
915 915
 					* and compare with all the aliases
916 916
 					* !!??!! review: remove this? */
917
-					he=rev_resolvehost(ip);
918
-					if (he==0){
919
-						print_ip( "comp_ip: could not rev_resolve ip address:"
920
-									" ", ip, "\n");
921
-					ret=0;
922
-					}else{
917
+					if (unlikely((received_dns & DO_REV_DNS) && 
918
+							((he=rev_resolvehost(ip))!=0) )){
923 919
 						/*  compare with primary host name */
924 920
 						ret=comp_string(op, he->h_name, rtype, r);
925 921
 						/* compare with all the aliases */
926 922
 						for(h=he->h_aliases; (ret!=1) && (*h); h++){
927 923
 							ret=comp_string(op, *h, rtype, r);
928 924
 						}
925
+					}else{
926
+						ret=0;
929 927
 					}
930 928
 					break;
931 929
 				case DIFF_OP: