diff --git a/conf/conf.c b/conf/conf.c index 825a8e9..847360b 100644 --- a/conf/conf.c +++ b/conf/conf.c @@ -96,7 +96,7 @@ config_alloc(byte *name) char *ndup = lp_allocu(l, nlen); memcpy(ndup, name, nlen); - c->mrtdump_file = -1; /* Hack, this should be sysdep-specific */ + c->mrt_proto_file = -1; /* Indication that the file descriptor should not be used */ c->pool = p; c->mem = l; c->file_name = ndup; diff --git a/conf/conf.h b/conf/conf.h index 89a2c5b..4ca4244 100644 --- a/conf/conf.h +++ b/conf/conf.h @@ -12,8 +12,36 @@ #include "lib/resource.h" #include "lib/timer.h" +/* Configuration structures */ + +#define MRT_TABLE_NOT_CONFIGURED -1 +#define MRT_TABLE_DEFAULT_PERIOD 60 +#define MRT_TABLE_DEFAULT_FILENAME_FMT "%f_%F_%T.mrt" +#define MRT_TABLE_DEFAULT_TABLENAME_PATTERN "*" + +struct mrt_table_common_config { + u32 period; /* Time in seconds between Table Dump */ + char *filename_fmt; + struct filter *filter; + struct cli *cli; /* Client console or NULL */ + struct config *config; /* Configuration or NULL */ +}; + +/* Template of configuration that can be apply at any table */ +struct mrt_table_config { + node n; /* Node in config->mrt_table_dumps */ + struct mrt_table_common_config c; + char *rtable_wildcard_name; +}; -/* Configuration structure */ +/* Configuration that is specific per table */ +struct mrt_table_individual_config { + node n; /* Node in rtable_config->mrt_table_dumps */ + struct mrt_table_common_config c; + timer *timer; /* Timer for periodic dumps */ + struct rtable_config *table_cf; + bird_clock_t next_dump; +}; struct config { pool *pool; /* Pool the configuration is stored in */ @@ -21,9 +49,10 @@ struct config { list protos; /* Configured protocol instances (struct proto_config) */ list tables; /* Configured routing tables (struct rtable_config) */ list roa_tables; /* Configured ROA tables (struct roa_table_config) */ - list logfiles; /* Configured log fils (sysdep) */ + list logfiles; /* Configured log files (sysdep) */ + list mrt_table_dumps; /* Configured MRT table dumps (struct mrt_table_config) */ - int mrtdump_file; /* Configured MRTDump file (sysdep, fd in unix) */ + int mrt_proto_file; /* Configured MRTDump file (sysdep, fd in unix) for Protocols*/ char *syslog_name; /* Name used for syslog (NULL -> no syslog) */ struct rtable_config *master_rtc; /* Configuration of master routing table */ struct iface_patt *router_id_from; /* Configured list of router ID iface patterns */ diff --git a/doc/bird.sgml b/doc/bird.sgml index a0b45f4..26c2e39 100644 --- a/doc/bird.sgml +++ b/doc/bird.sgml @@ -368,16 +368,49 @@ protocol rip { seconds, zero means disabled. Default: disabled (0). mrtdump " - Set MRTdump file name. This option must be specified to allow MRTdump - feature. Default: no dump file. + Set MRTdump protocols file name. This option must be specified to allow MRTdump + protocols feature. Default: no dump file. mrtdump protocols all|off|{ states, messages } - Set global defaults of MRTdump options. See in the following section. Default: off. - filter - Define a filter. You can learn more about filters in the following - chapter. + + table / + Choosing tables from which will be routes taken. + Can be used wildcards * and ?. + Default: "*" for all tables + period / + Configures the interval in seconds between mrt table dumps. + Default: 60 seconds + filter / + Configure filtering dumping routes. Filters are more described in . + Default: Accept all + + + Example: +

+mrtdump routes { + filename "%f-%s.mrt"; # dumps will be saved into files named like 'tableA-1437119435.mrt' + table "t*"; # only routes from tables starts with character 't' + period 10; # 10 seconds interval between dumps + where source = RTS_BGP; # only routes from BGP protocols +} +mrtdump routes; # another mrtdump route config with default options + + filter + Define a filter. You can learn more about filters in . function Define a function. You can learn more about functions in the following chapter. @@ -459,13 +492,13 @@ protocol rip { hh:mm:ss) for table - Create a new routing table. The default routing table is created + table + Create a new routing table. The default description for details. - roa table + roa table Create a new ROA (Route Origin Authorization) table. ROA tables can be used to validate route origination of BGP routes. A ROA table contains ROA entries, each consist of a network prefix, a max prefix length and @@ -517,8 +550,9 @@ agreement"). protocol, mrtdump all|off|{ states, messages } - Set protocol MRTdump flags. MRTdump is a standard binary format for + + Set protocol MRTdump flags. MRTdump is a standard binary format (see + )) for logging information from routing protocols and daemons. These flags control what kind of information is logged from the protocol to the MRTdump file (which must be specified by global show route [[for] + show route [[for] Show contents of a routing table (by default of the main one or the table attached to a respective protocol), that is routes, their metrics and (in case the show roa [] + show roa [ Show contents of a ROA table (by default of the first one). You can specify a for , you'll get all entries relevant for route @@ -808,16 +842,16 @@ This argument can be omitted if there exists only a single instance. entries covered by the network prefix. You could also use add roa ] + add roa Add a new ROA entry to a ROA table. Such entry is called delete roa ] + delete roa Delete the specified ROA entry from a ROA table. Only dynamic ROA entries (i.e., the ones added by flush roa [table ] + flush roa [table Remove all dynamic ROA entries from a ROA table. configure [soft] [" @@ -885,6 +919,11 @@ This argument can be omitted if there exists only a single instance. dump resources|sockets|interfaces|neighbors|attributes|routes|protocols Dump contents of internal data structures to the debugging output. + mrtdump routes [table + + Once the specified routes will be saved into file(s) named based on . + echo all|off|{ Control echoing of log messages to the command-line output. See for a list of log classes. @@ -894,7 +933,7 @@ This argument can be omitted if there exists only a single instance. -Filters +