summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Machek <pavel@ucw.cz>1999-11-24 13:16:31 +0100
committerPavel Machek <pavel@ucw.cz>1999-11-24 13:16:31 +0100
commit455ca441d99184e1514415bd7acb25f82d01366e (patch)
treeedf0cb610ba2532a80b49279741dae2b9e62953f
parent8f013d9ca443d4ff39af7560039f108efa9ef474 (diff)
downloadbird-455ca441d99184e1514415bd7acb25f82d01366e.tar
bird-455ca441d99184e1514415bd7acb25f82d01366e.zip
Check that prefixes are really prefixes + fix config file to
comply. (:-( 1.2.3.4/8 looks nicer than 1.0.0.0/8).
-rw-r--r--filter/config.Y2
-rw-r--r--filter/test.conf8
2 files changed, 5 insertions, 5 deletions
diff --git a/filter/config.Y b/filter/config.Y
index 726e13a..3a176df 100644
--- a/filter/config.Y
+++ b/filter/config.Y
@@ -184,7 +184,7 @@ pair:
* Complex types, their bison value is struct f_val
*/
prefix_s:
- IPA '/' NUM { $$.type = T_PREFIX; $$.val.px.ip = $1; $$.val.px.len = $3; cf_error( "%I/%d is not really prefix\n", $$.val.px.ip, $$.val.px.len ); }
+ IPA '/' NUM { $$.type = T_PREFIX; $$.val.px.ip = $1; $$.val.px.len = $3; if (ipa_nonzero(ipa_and($$.val.px.ip, ipa_not(ipa_mkmask($$.val.px.len))))) cf_error( "%I/%d is not really prefix\n", $$.val.px.ip, $$.val.px.len ); }
;
prefix:
diff --git a/filter/test.conf b/filter/test.conf
index 7a1c07b..799fc60 100644
--- a/filter/test.conf
+++ b/filter/test.conf
@@ -38,11 +38,11 @@ ip p;
if 1234 = i then printn "."; else { print "*** FAIL: if 1 else"; }
if 1 <= 1 then printn "."; else { print "*** FAIL: test 3"; }
if 1234 < 1234 then { print "*** FAIL: test 4"; quitbird; } else print "ok";
- print " data types; must be true: " 1.2.3.4 = 1.2.3.4 "," 1 ~ [1,2,3] "," 5 ~ [1..20] "," 2 ~ [ 1, 2, 3 ] "," 5 ~ [ 4 .. 7 ] "," 1.2.3.4 ~ [ 1.2.3.3..1.2.3.5 ] "," 1.2.3.4 ~ 1.2.3.4/8 "," 1.2.3.4/8 ~ 1.2.3.4/8 "," 1.2.3.4/8 ~ [ 1.2.3.4/8+ ] "," 1.2.3.4/16 ~ [ 1.2.3.4/8{ 15 , 16 } ] "," defined(1) "," defined(1.2.3.4);
- print " data types: must be false: " 1 ~ [ 2, 3, 4 ] "," 5 ~ [ 2, 3, 4, 7..11 ] "," 1.2.3.4 ~ [ 1.2.3.3, 1.2.3.5 ] "," (1,2) > (2,2) "," (1,1) > (1,1) "," 1.2.3.4/8 ~ [ 1.2.3.4/8- ] "," 1.2.3.4/17 ~ [ 1.2.3.4/8{ 15 , 16 } ];
+ print " data types; must be true: " 1.2.3.4 = 1.2.3.4 "," 1 ~ [1,2,3] "," 5 ~ [1..20] "," 2 ~ [ 1, 2, 3 ] "," 5 ~ [ 4 .. 7 ] "," 1.2.3.4 ~ [ 1.2.3.3..1.2.3.5 ] "," 1.2.3.4 ~ 1.0.0.0/8 "," 1.0.0.0/8 ~ 1.0.0.0/8 "," 1.0.0.0/8 ~ [ 1.0.0.0/8+ ] "," 1.2.0.0/16 ~ [ 1.0.0.0/8{ 15 , 16 } ] "," defined(1) "," defined(1.2.3.4);
+ print " data types: must be false: " 1 ~ [ 2, 3, 4 ] "," 5 ~ [ 2, 3, 4, 7..11 ] "," 1.2.3.4 ~ [ 1.2.3.3, 1.2.3.5 ] "," (1,2) > (2,2) "," (1,1) > (1,1) "," 1.0.0.0/8 ~ [ 1.0.0.0/8- ] "," 1.2.0.0/17 ~ [ 1.0.0.0/8{ 15 , 16 } ];
- px = 1.2.3.4/18;
- print "Testing prefixes: 1.2.3.4/18 = " px;
+ px = 1.2.0.0/18;
+ print "Testing prefixes: 1.0.0.0/18 = " px;
p = 127.1.2.3;
print "Testing mask : 127.0.0.0 = " p.mask(8);
print "Testing pairs: (1,2) = " (1,2);