]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Add ROA net_addr to grammar
authorPavel Tvrdík <pawel.tvrdik@gmail.com>
Wed, 20 Jan 2016 13:55:37 +0000 (14:55 +0100)
committerPavel Tvrdík <pawel.tvrdik@gmail.com>
Wed, 20 Jan 2016 15:46:30 +0000 (16:46 +0100)
Example:
  protocol static
  {
    route 10.110.0.0/16 max 16 as 1000 blackhole;
    route 10.120.0.0/16 max 24 as 1000 blackhole;
    route 10.130.0.0/16 max 24 as 2000 blackhole;
    route 10.130.128.0/18 max 24 as 3000 blackhole;
    ...
  }

conf/confbase.Y

index 9b4f54e93da72ecf428807ceafee5eb3746417d6..b25cf2d09b34222eacf2504863c3ecd1b2255892 100644 (file)
@@ -80,7 +80,7 @@ CF_DECLS
 %type <i32> expr_us
 %type <time> datetime
 %type <a> ipa
-%type <net> net_ip4_ net_ip6_ net_ip6 net_ip_ net_ip net_or_ipa
+%type <net> net_ip4_ net_ip6_ net_ip6 net_ip_ net_ip net_or_ipa net_roa4_ net_roa6_ net_roa_ net__
 %type <net_ptr> net_ net_any
 
 %type <t> text opttext
@@ -198,9 +198,26 @@ net_ip6_: IP6 '/' NUM
     cf_error("Invalid IPv6 prefix");
 };
 
+net_roa4_: net_ip4_ MAX NUM AS NUM
+{
+  net_fill_roa4(&($$), ((net_addr_ip4 *)&$1)->prefix, $1.pxlen, $3, $5);
+  if ($3 < 0 || $3 > IP4_MAX_PREFIX_LENGTH)
+    cf_error("Invalid max prefix length %d", $3);
+};
+
+net_roa6_: net_ip6_ MAX NUM AS NUM
+{
+  net_fill_roa6(&($$), ((net_addr_ip6 *)&$1)->prefix, $1.pxlen, $3, $5);
+  if ($3 < 0 || $3 > IP6_MAX_PREFIX_LENGTH)
+    cf_error("Invalid max prefix length %d", $3);
+};
+
 net_ip_: net_ip4_ | net_ip6_ ;
+net_roa_: net_roa4_ | net_roa6_ ;
+
+net__: net_ip_ | net_roa_;
 
-net_: net_ip_ { $$ = cfg_alloc($1.length); net_copy($$, &($1)); } ;
+net_: net__ { $$ = cfg_alloc($1.length); net_copy($$, &($1)); } ;
 
 
 /* Networks - regular */