From: Vojtech Vilimek Date: Wed, 13 Jul 2022 13:39:14 +0000 (+0200) Subject: Protocol stats: a WIP implementation of conditional routes X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d648c6b602a6c2b927cc64e024f6d167ceb8c5c3;p=thirdparty%2Fbird.git Protocol stats: a WIP implementation of conditional routes Add new global counter for stats channel New symbol is added for each stats protocol channel, the symbol is accessed by same name as the underlying channel. Symbols evaluate to the sum of all routes exported from connected table with generation less than max generation of particular channel. Default max generation is 16. Beware you shouldn't make cyclic references as the behavior of such configuration is not defined! --- diff --git a/conf/conf.h b/conf/conf.h index 58a2733b6..a4bc1f291 100644 --- a/conf/conf.h +++ b/conf/conf.h @@ -112,6 +112,7 @@ void cfg_copy_list(list *dest, list *src, unsigned node_size); extern int (*cf_read_hook)(byte *buf, uint max, int fd); +struct stats_term_config; struct symbol { node n; /* In list of symbols in config */ struct symbol *next; @@ -127,6 +128,8 @@ struct symbol { struct ea_class *attribute; /* For SYM_ATTRIBUTE */ struct f_val *val; /* For SYM_CONSTANT */ uint offset; /* For SYM_VARIABLE */ + struct channel_config *ch_config; /* For SYM_COUNTER */ + struct stats_term_config *term; /* For SYM_COUNTER_TERM */ }; char name[0]; @@ -161,6 +164,8 @@ struct bytestring { #define SYM_FILTER 4 #define SYM_TABLE 5 #define SYM_ATTRIBUTE 6 +#define SYM_COUNTER 7 +#define SYM_COUNTER_TERM 8 #define SYM_VARIABLE 0x100 /* 0x100-0x1ff are variable types */ #define SYM_VARIABLE_RANGE SYM_VARIABLE ... (SYM_VARIABLE | 0xff) diff --git a/configure.ac b/configure.ac index bf5c6df45..07b249093 100644 --- a/configure.ac +++ b/configure.ac @@ -307,7 +307,7 @@ if test "$enable_mpls_kernel" != no ; then fi # temporarily removed "mrt" from all_protocols to speed up 3.0-alpha1 release -all_protocols="bfd babel bgp ospf perf pipe radv rip rpki static" +all_protocols="bfd babel bgp ospf perf pipe radv rip rpki static stats" all_protocols=`echo $all_protocols | sed 's/ /,/g'` if test "$with_protocols" = all ; then diff --git a/doc/bird.sgml b/doc/bird.sgml index 0da616c70..c5463e64f 100644 --- a/doc/bird.sgml +++ b/doc/bird.sgml @@ -5560,6 +5560,64 @@ protocol static { } +Stats +