summaryrefslogtreecommitdiff
path: root/conf/confbase.Y
diff options
context:
space:
mode:
authorJan Moskyto Matejka <mq@ucw.cz>2016-02-09 14:53:29 +0100
committerJan Moskyto Matejka <mq@ucw.cz>2016-12-22 21:38:33 +0100
commitd311368bc58842552e25744a0aae9a09c42cda9f (patch)
tree7bdacfbca47c86148193f5438d9bb2ae89fa4342 /conf/confbase.Y
parentd47c3d64b2733baea756f1bb37ef09f10d7f9644 (diff)
VPN4 and VPN6 literals
From now on, protocol static accepts VPN4 and VPN6 addressess. With some concerns about VPN6 Route Distinguishers, I finally chose to have the same format as for VPN4 (where it is defined by RFC 4364).
Diffstat (limited to 'conf/confbase.Y')
-rw-r--r--conf/confbase.Y22
1 files changed, 20 insertions, 2 deletions
diff --git a/conf/confbase.Y b/conf/confbase.Y
index 00e78232..a5b8b692 100644
--- a/conf/confbase.Y
+++ b/conf/confbase.Y
@@ -38,6 +38,7 @@ CF_DECLS
%union {
int i;
u32 i32;
+ u64 i64;
ip_addr a;
ip4_addr ip4;
ip6_addr ip6;
@@ -73,6 +74,7 @@ CF_DECLS
%token <i> NUM ENUM
%token <ip4> IP4
%token <ip6> IP6
+%token <i64> VPN_RD
%token <s> SYM
%token <t> TEXT
%type <iface> ipa_scope
@@ -82,7 +84,7 @@ CF_DECLS
%type <time> datetime
%type <a> ipa
%type <net> net_ip4_ net_ip6_ net_ip6 net_ip_ net_ip net_or_ipa
-%type <net_ptr> net_ net_any net_roa4_ net_roa6_ net_roa_
+%type <net_ptr> net_ net_any net_vpn4_ net_vpn6_ net_vpn_ net_roa4_ net_roa6_ net_roa_
%type <lbl> label_stack_start label_stack
%type <t> text opttext
@@ -95,7 +97,7 @@ CF_DECLS
%left '!'
%nonassoc '.'
-CF_KEYWORDS(DEFINE, ON, OFF, YES, NO, S, MS, US, PORT)
+CF_KEYWORDS(DEFINE, ON, OFF, YES, NO, S, MS, US, PORT, VPN)
CF_GRAMMAR
@@ -198,6 +200,18 @@ net_ip6_: IP6 '/' NUM
cf_error("Invalid IPv6 prefix");
};
+net_vpn4_: VPN_RD net_ip4_
+{
+ $$ = cfg_alloc(sizeof(net_addr_vpn4));
+ net_fill_vpn4($$, ((net_addr_ip4 *)&$2)->prefix, $2.pxlen, $1);
+}
+
+net_vpn6_: VPN_RD net_ip6_
+{
+ $$ = cfg_alloc(sizeof(net_addr_vpn6));
+ net_fill_vpn6($$, ((net_addr_ip6 *)&$2)->prefix, $2.pxlen, $1);
+}
+
net_roa4_: net_ip4_ MAX NUM AS NUM
{
$$ = cfg_alloc(sizeof(net_addr_roa4));
@@ -216,9 +230,11 @@ net_roa6_: net_ip6_ MAX NUM AS NUM
net_ip_: net_ip4_ | net_ip6_ ;
net_roa_: net_roa4_ | net_roa6_ ;
+net_vpn_: net_vpn4_ | net_vpn6_ ;
net_:
net_ip_ { $$ = cfg_alloc($1.length); net_copy($$, &($1)); }
+ | net_vpn_
| net_roa_
| net_flow_
;
@@ -256,6 +272,8 @@ net_any:
net_or_ipa:
net_ip4_
| net_ip6_
+ | net_vpn4_ { $$ = *$1; }
+ | net_vpn6_ { $$ = *$1; }
| IP4 { net_fill_ip4(&($$), $1, IP4_MAX_PREFIX_LENGTH); }
| IP6 { net_fill_ip6(&($$), $1, IP6_MAX_PREFIX_LENGTH); }
| SYM {