aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaria Matejka <mq@ucw.cz>2023-12-07 14:38:05 +0100
committerMaria Matejka <mq@ucw.cz>2023-12-07 14:38:05 +0100
commit54ddf90f6370f06efc71c3ffd6e02d031a86866f (patch)
tree195f31f8007677e4520641f86986cba600feaa3e
parent9a91ea52db32ec2fda830afd1c88f0f83e6c0df4 (diff)
downloadbird-54ddf90f6370f06efc71c3ffd6e02d031a86866f.tar.gz
Conf: debug tables
For now just a dummy config but it is needed for forward compatibility with v3.
-rw-r--r--conf/conf.h1
-rw-r--r--doc/bird.sgml11
-rw-r--r--nest/config.Y4
-rw-r--r--nest/route.h2
-rw-r--r--nest/rt-table.c3
5 files changed, 20 insertions, 1 deletions
diff --git a/conf/conf.h b/conf/conf.h
index 8fd6713e..c0a897fc 100644
--- a/conf/conf.h
+++ b/conf/conf.h
@@ -35,6 +35,7 @@ struct config {
u32 proto_default_debug; /* Default protocol debug mask */
u32 proto_default_mrtdump; /* Default protocol mrtdump mask */
u32 channel_default_debug; /* Default channel debug mask */
+ u32 table_default_debug; /* Default table debug mask */
struct timeformat tf_route; /* Time format for 'show route' */
struct timeformat tf_proto; /* Time format for 'show protocol' */
struct timeformat tf_log; /* Time format for the logfile */
diff --git a/doc/bird.sgml b/doc/bird.sgml
index 09da89df..394ca86c 100644
--- a/doc/bird.sgml
+++ b/doc/bird.sgml
@@ -505,6 +505,11 @@ include "tablename.conf";;
See <ref id="channel-debug" name="debug"> in the channel section.
Default: off.
+ <tag><label id="opt-debug-tables">debug tables all|off|{ states|routes|filters|events [, <m/.../] }</tag>
+ Set global defaults of table debugging options.
+ See <ref id="table-debug" name="debug"> in the table section.
+ Default: off.
+
<tag><label id="opt-debug-commands">debug commands <m/number/</tag>
Control logging of client connections (0 for no logging, 1 for logging
of connects and disconnects, 2 and higher for logging of all client
@@ -640,6 +645,12 @@ that implicit tables (<cf/master4/ and <cf/master6/) can be redefined in order
to set options.
<descrip>
+ <tag><label id="table-debug">debug all|off|{ states|routes|filters [, <m/.../] }</tag>
+ Set table debugging options. Like in <ref id="proto-debug"
+ name="protocol debugging">, tables are capable of writing trace
+ messages about its work to the log (with category <cf/trace/).
+ For now, this does nothing, but in version 3, it is used. Default: off.
+
<tag><label id="rtable-sorted">sorted <m/switch/</tag>
Usually, a routing table just chooses the selected (best) route from a
list of routes for each network, while keeping remaining routes unsorted.
diff --git a/nest/config.Y b/nest/config.Y
index 6bd08481..d9778473 100644
--- a/nest/config.Y
+++ b/nest/config.Y
@@ -114,7 +114,7 @@ proto_postconfig(void)
CF_DECLS
CF_KEYWORDS(ROUTER, ID, HOSTNAME, PROTOCOL, TEMPLATE, PREFERENCE, DISABLED, DEBUG, ALL, OFF, DIRECT)
-CF_KEYWORDS(INTERFACE, IMPORT, EXPORT, FILTER, NONE, VRF, DEFAULT, TABLE, STATES, ROUTES, FILTERS)
+CF_KEYWORDS(INTERFACE, IMPORT, EXPORT, FILTER, NONE, VRF, DEFAULT, TABLE, TABLES, STATES, ROUTES, FILTERS)
CF_KEYWORDS(IPV4, IPV6, VPN4, VPN6, ROA4, ROA6, FLOW4, FLOW6, SADR, MPLS)
CF_KEYWORDS(RECEIVE, LIMIT, ACTION, WARN, BLOCK, RESTART, DISABLE, KEEP, FILTERED, RPKI)
CF_KEYWORDS(PASSWORD, KEY, FROM, PASSIVE, TO, ID, EVENTS, PACKETS, PROTOCOLS, CHANNELS, INTERFACES)
@@ -230,6 +230,7 @@ table_sorted:
table_opt:
SORTED bool { this_table->sorted = $2; }
+ | DEBUG debug_mask { this_table->debug = $2; }
| TRIE bool {
if (!net_val_match(this_table->addr_type, NB_IP | NB_VPN | NB_ROA | NB_IP6_SADR))
cf_error("Trie option not supported for %s table", net_label[this_table->addr_type]);
@@ -380,6 +381,7 @@ conf: debug_default ;
debug_default:
DEBUG PROTOCOLS debug_mask { new_config->proto_default_debug = $3; }
| DEBUG CHANNELS debug_mask { new_config->channel_default_debug = $3; }
+ | DEBUG TABLES debug_mask { new_config->table_default_debug = $3; }
| DEBUG COMMANDS expr { new_config->cli_debug = $3; }
;
diff --git a/nest/route.h b/nest/route.h
index f83a5b33..782bbac9 100644
--- a/nest/route.h
+++ b/nest/route.h
@@ -150,6 +150,7 @@ struct rtable_config {
uint addr_type; /* Type of address data stored in table (NET_*) */
uint gc_threshold; /* Maximum number of operations before GC is run */
uint gc_period; /* Approximate time between two consecutive GC runs */
+ u32 debug; /* Debugging flags (D_*) */
byte sorted; /* Routes of network are sorted according to rte_better() */
byte internal; /* Internal table of a protocol */
byte trie_used; /* Rtable has attached trie */
@@ -166,6 +167,7 @@ typedef struct rtable {
char *name; /* Name of this table */
list channels; /* List of attached channels (struct channel) */
uint addr_type; /* Type of address data stored in table (NET_*) */
+ u32 debug; /* Debugging flags (D_*) */
int pipe_busy; /* Pipe loop detection */
int use_count; /* Number of protocols using this table */
u32 rt_count; /* Number of routes in the table */
diff --git a/nest/rt-table.c b/nest/rt-table.c
index 985b68e1..5b561483 100644
--- a/nest/rt-table.c
+++ b/nest/rt-table.c
@@ -2040,6 +2040,7 @@ rt_setup(pool *pp, struct rtable_config *cf)
t->name = cf->name;
t->config = cf;
t->addr_type = cf->addr_type;
+ t->debug = cf->debug;
fib_init(&t->fib, p, t->addr_type, sizeof(net), OFFSETOF(net, n), 0, NULL);
@@ -2752,6 +2753,7 @@ rt_new_table(struct symbol *s, uint addr_type)
c->gc_period = (uint) -1; /* set in rt_postconfig() */
c->min_settle_time = 1 S;
c->max_settle_time = 20 S;
+ c->debug = new_config->table_default_debug;
add_tail(&new_config->tables, &c->n);
@@ -2809,6 +2811,7 @@ rt_reconfigure(rtable *tab, struct rtable_config *new, struct rtable_config *old
new->table = tab;
tab->name = new->name;
tab->config = new;
+ tab->debug = new->debug;
return 1;
}