0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-11-17 08:38:42 +00:00

Add ROA net_addr to grammar

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;
    ...
  }
This commit is contained in:
Pavel Tvrdík 2016-01-20 14:55:37 +01:00
parent 8109eb765f
commit 513ad0a85e

View 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_ip_: net_ip4_ | net_ip6_ ;
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_: net_ip_ { $$ = cfg_alloc($1.length); net_copy($$, &($1)); } ;
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__ { $$ = cfg_alloc($1.length); net_copy($$, &($1)); } ;
/* Networks - regular */