Browse code

- fixed {dst,src}_ip{==,~=}"foo" (now if foo is an ip address it will work as expected else it will resolve foo and try all the addresses else it will reverse resolve {dst,src}_ip and compare foo with all the aliases.

Andrei Pelinescu-Onciul authored on 23/05/2003 15:03:38
Showing 3 changed files
... ...
@@ -25,7 +25,7 @@
25 25
 VERSION = 0
26 26
 PATCHLEVEL = 8
27 27
 SUBLEVEL =   11
28
-EXTRAVERSION = pre26
28
+EXTRAVERSION = pre27
29 29
 
30 30
 RELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
31 31
 OS = $(shell uname -s | sed -e s/SunOS/solaris/ | tr "[A-Z]" "[a-z]")
... ...
@@ -3,6 +3,8 @@ $Id$
3 3
 ( - todo, x - done)
4 4
 
5 5
 release:
6
+- fix modules makefiles (so that cd modules/foo; make will also link the proper
7
+   libs)
6 8
 - fix -march=..., or compile w/ i386 for the release
7 9
 x resolver should resolve [ipv6]
8 10
 - remove parse_uri debugging info
... ...
@@ -36,6 +36,8 @@
36 36
  *  2003-04-01  added dst_port, proto, af; renamed comp_port to comp_no,
37 37
  *               inlined all the comp_* functions (andrei)
38 38
  *  2003-04-05  s/reply_route/failure_route, onreply_route introduced (jiri)
39
+ *  2003-05-23  comp_ip fixed, now it will resolve its operand and compare
40
+ *              the ip with all the addresses (andrei)
39 41
  */
40 42
 
41 43
  
... ...
@@ -350,14 +352,21 @@ inline static int comp_ip(struct ip_addr* ip, void* param, int op, int subtype)
350 350
 		case STRING_ST:
351 351
 		case RE_ST:
352 352
 			/* 1: compare with ip2str*/
353
-		/* !!!??? review reminder ( resolve(name) & compare w/ all ips? */
354
-#if 0
355
-			ret=comp_str(inet_ntoa(*(struct in_addr*)&a), param, op,
356
-						subtype);
353
+			ret=comp_str(ip_addr2a(ip), param, op, subtype);
357 354
 			if (ret==1) break;
358
-#endif
359
-			/* 2: (slow) rev dns the address
360
-			 * and compare with all the aliases */
355
+			/* 2: resolve (name) & compare w/ all the ips */
356
+			he=resolvehost((char*)param);
357
+			if (he==0){
358
+				DBG("comp_ip: could not resolve %s\n", (char*)param);
359
+			}else if (he->h_addrtype==ip->af){
360
+				for(h=he->h_addr_list;(ret!=1)&& (*h); h++){
361
+					ret=(memcmp(ip->u.addr, *h, ip->len)==0);
362
+				}
363
+				if (ret==1) break;
364
+			}
365
+			/* 3: (slow) rev dns the address
366
+			 * and compare with all the aliases
367
+			 * !!??!! review: remove this? */
361 368
 			he=rev_resolvehost(ip);
362 369
 			if (he==0){
363 370
 				DBG( "comp_ip: could not rev_resolve ip address: ");