From 265419a3695b9a5c0a01d9fffc60f66fea8bee13 Mon Sep 17 00:00:00 2001 From: Maria Matejka Date: Wed, 21 Nov 2018 20:37:11 +0100 Subject: Custom route attributes For local route marking purposes, local custom route attributes may be defined. These attributes are seamlessly stripped after export filter to every real protocol like Kernel, BGP or OSPF, they however pass through pipes. We currently allow at most 256 custom attributes. This should be much faster than currently used bgp communities for marking routes. --- conf/conf.h | 4 +- doc/bird.sgml | 8 +++- filter/config.Y | 43 ++++++++++++----- filter/f-util.c | 144 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ filter/filter.c | 2 +- filter/filter.h | 9 ++++ nest/config.Y | 4 +- nest/route.h | 9 +++- nest/rt-attr.c | 13 ++++- 9 files changed, 215 insertions(+), 21 deletions(-) diff --git a/conf/conf.h b/conf/conf.h index 5689fb67..427569fd 100644 --- a/conf/conf.h +++ b/conf/conf.h @@ -15,7 +15,6 @@ #include "lib/resource.h" #include "lib/timer.h" - /* Configuration structure */ struct config { @@ -128,9 +127,12 @@ struct sym_scope { #define SYM_FUNCTION 3 #define SYM_FILTER 4 #define SYM_TABLE 5 +#define SYM_ATTRIBUTE 6 #define SYM_VARIABLE 0x100 /* 0x100-0x1ff are variable types */ +#define SYM_VARIABLE_RANGE SYM_VARIABLE ... (SYM_VARIABLE | 0xff) #define SYM_CONSTANT 0x200 /* 0x200-0x2ff are variable types */ +#define SYM_CONSTANT_RANGE SYM_CONSTANT ... (SYM_CONSTANT | 0xff) #define SYM_TYPE(s) (((struct f_val *) (s)->def)->type) #define SYM_VAL(s) (((struct f_val *) (s)->def)->val) diff --git a/doc/bird.sgml b/doc/bird.sgml index 62cf0768..da87d901 100644 --- a/doc/bird.sgml +++ b/doc/bird.sgml @@ -25,7 +25,7 @@ configuration - something in config which is not keyword. Ondrej Filip @@ -550,6 +550,12 @@ include "tablename.conf";; constants based on /etc/iproute2/rt_* files. A list of defined constants can be seen (together with other symbols) using 'show symbols' command. +