diff options
author | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2018-02-13 16:27:57 +0100 |
---|---|---|
committer | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2018-02-13 16:39:07 +0100 |
commit | be17805c0bbd37e865dc9b17b56e8e8d210c2c6c (patch) | |
tree | 50506f959f6bc4ea505ee2b7ef5e6d7e75f909b6 /conf | |
parent | a82f692e5844d5efdc091a796dc0e8ae8ab5a322 (diff) |
Add support for source-specific IPv6 routes to BIRD core
This patch adds support for source-specific IPv6 routes to BIRD core.
This is based on Dean Luga's original patch, with the review comments
addressed. SADR support is added to network address parsing in confbase.Y
and to the kernel protocol on Linux.
Currently there is no way to mix source-specific and non-source-specific
routes (i.e., SADR tables cannot be connected to non-SADR tables).
Thanks to Toke Hoiland-Jorgensen for the original patch.
Minor changes by Ondrej Santiago Zajicek.
Diffstat (limited to 'conf')
-rw-r--r-- | conf/confbase.Y | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/conf/confbase.Y b/conf/confbase.Y index 7e0537c5..c2d647eb 100644 --- a/conf/confbase.Y +++ b/conf/confbase.Y @@ -83,7 +83,7 @@ CF_DECLS %type <time> expr_us time %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_vpn4_ net_vpn6_ net_vpn_ net_roa4_ net_roa6_ net_roa_ net_mpls_ +%type <net_ptr> net_ net_any net_vpn4_ net_vpn6_ net_vpn_ net_roa4_ net_roa6_ net_roa_ net_ip6_sadr_ net_mpls_ %type <mls> label_stack_start label_stack %type <t> text opttext @@ -96,7 +96,7 @@ CF_DECLS %left '!' %nonassoc '.' -CF_KEYWORDS(DEFINE, ON, OFF, YES, NO, S, MS, US, PORT, VPN, MPLS) +CF_KEYWORDS(DEFINE, ON, OFF, YES, NO, S, MS, US, PORT, VPN, MPLS, FROM) CF_GRAMMAR @@ -206,6 +206,25 @@ net_ip6_: IP6 '/' NUM n->prefix, n->pxlen, ip6_and(n->prefix, ip6_mkmask(n->pxlen)), n->pxlen); }; +net_ip6_sadr_: IP6 '/' NUM FROM IP6 '/' NUM +{ + if ($3 > IP6_MAX_PREFIX_LENGTH) + cf_error("Invalid prefix length %u", $3); + + if ($7 > IP6_MAX_PREFIX_LENGTH) + cf_error("Invalid prefix length %u", $7); + + $$ = cfg_alloc(sizeof(net_addr_ip6_sadr)); + net_fill_ip6_sadr($$, $1, $3, $5, $7); + + net_addr_ip6_sadr *n = (void *) $$; + if (!net_validate_ip6_sadr(n)) + cf_error("Invalid SADR IPv6 prefix %I6/%d from %I6/%d, maybe you wanted %I6/%d from %I6/%d", + n->dst_prefix, n->dst_pxlen, n->src_prefix, n->src_pxlen, + ip6_and(n->dst_prefix, ip6_mkmask(n->dst_pxlen)), n->dst_pxlen, + ip6_and(n->src_prefix, ip6_mkmask(n->src_pxlen)), n->src_pxlen); +}; + net_vpn4_: VPN_RD net_ip4_ { $$ = cfg_alloc(sizeof(net_addr_vpn4)); @@ -249,6 +268,7 @@ net_: | net_vpn_ | net_roa_ | net_flow_ + | net_ip6_sadr_ | net_mpls_ ; |