diff options
author | Pavel Tvrdík <pawel.tvrdik@gmail.com> | 2016-01-20 14:55:37 +0100 |
---|---|---|
committer | Pavel Tvrdík <pawel.tvrdik@gmail.com> | 2016-01-20 16:46:30 +0100 |
commit | 513ad0a85e57e4e0f7928fde7332778ca1c2148f (patch) | |
tree | ecf46178de8a12227fbbb232263b8c808a2b9a1a /conf | |
parent | 8109eb765fe92f4d47b497b3e2b24b59841c3487 (diff) |
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;
...
}
Diffstat (limited to 'conf')
-rw-r--r-- | conf/confbase.Y | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/conf/confbase.Y b/conf/confbase.Y index 9b4f54e9..b25cf2d0 100644 --- a/conf/confbase.Y +++ b/conf/confbase.Y @@ -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 */ |