Przeglądaj źródła

- bitlen mask fixes

Andrei Pelinescu-Onciul 24 lat temu
rodzic
commit
36ce7f1083
2 zmienionych plików z 2 dodań i 2 usunięć
  1. 1 1
      cfg.y
  2. 1 1
      test/test1.cfg

+ 1 - 1
cfg.y

@@ -267,7 +267,7 @@ net4:	ipv4 SLASH ipv4	{ $$=mk_net($1, $3); }
 								yyerror("invalid bit number in netmask");
 								yyerror("invalid bit number in netmask");
 								$$=0;
 								$$=0;
 							}else{
 							}else{
-								$$=mk_net($1, ((1<<$3)-1));
+								$$=mk_net($1, htonl( ($3)?~( (1<<32-$3)-1 ):0 ) );
 							}
 							}
 						}
 						}
 	| ipv4				{ $$=mk_net($1, 0xffffffff); }
 	| ipv4				{ $$=mk_net($1, 0xffffffff); }

+ 1 - 1
test/test1.cfg

@@ -16,7 +16,7 @@ debug=1
 dns=true #comment on the same line
 dns=true #comment on the same line
 
 
 route{
 route{
-	(method==invite and src_ip==1.2.3.4 or (src_ip==4.3.2.1 and src_ip==11.12.13.14/24) ) log("test log\n"); forward("ape");
+	(method==invite and src_ip==1.2.3.4/32 or (src_ip==4.3.2.1 and src_ip==11.12.13.14/24) ) log("test log\n"); forward("ape");
 	( uri~="test\n" &  ! src_ip~="dorian") forward(dorian.fokus.gmd.de);
 	( uri~="test\n" &  ! src_ip~="dorian") forward(dorian.fokus.gmd.de);
 
 
 	(src_ip==192.168.0.0/255.255.0.0 or dst_ip==127.0.0.1 and uri~="s$") \
 	(src_ip==192.168.0.0/255.255.0.0 or dst_ip==127.0.0.1 and uri~="s$") \