mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-11-18 17:18:42 +00:00
Table debug is now a per-table setting and has categories.
This commit is contained in:
parent
397fec4741
commit
83ceb91b50
@ -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="rtable-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
|
||||
@ -708,6 +713,16 @@ to set options.
|
||||
second one is the high threshold (when to pause). The higher is the
|
||||
threshold, the more memory can get used. In most cases, the defaults
|
||||
should work for you. Default: 128, 512.
|
||||
|
||||
<tag><label id="rtable-debug">debug all|off|{ states|routes|events [, <m/.../] }</tag>
|
||||
Set table debugging options. Each table can write some trace messages
|
||||
into log with category <cf/trace/. You can request <cf/all/ trace messages
|
||||
or select some types: <cf/states/ for table state changes and auxiliary
|
||||
processes, <cf/routes/ for auxiliary route notifications (next hop update,
|
||||
flowspec revalidation) and <cf/events/ for more detailed auxiliary routine
|
||||
debug. See also <ref id="channel-debug" name="channel debugging option">.
|
||||
Default: off.
|
||||
|
||||
</descrip>
|
||||
|
||||
|
||||
|
@ -235,6 +235,7 @@ table_opt:
|
||||
if ($3 > $4) cf_error("Cork low threshold must be lower than the high threshold.");
|
||||
this_table->cork_threshold.low = $3;
|
||||
this_table->cork_threshold.high = $4; }
|
||||
| DEBUG bool { this_table->debug = $2; }
|
||||
;
|
||||
|
||||
table_opts:
|
||||
@ -394,7 +395,7 @@ debug_default:
|
||||
DEBUG PROTOCOLS debug_mask { new_config->proto_default_debug = $3; }
|
||||
| DEBUG CHANNELS debug_mask { new_config->channel_default_debug = $3; }
|
||||
| DEBUG COMMANDS expr { new_config->cli_debug = $3; }
|
||||
| DEBUG TABLES bool { new_config->table_debug = $3; }
|
||||
| DEBUG TABLES debug_mask { new_config->table_debug = $3; }
|
||||
;
|
||||
|
||||
/* MRTDUMP PROTOCOLS is in systep/unix/config.Y */
|
||||
|
@ -188,6 +188,12 @@ const char *rt_export_state_name(u8 state)
|
||||
static inline struct rte_storage *rt_next_hop_update_rte(rtable *tab, net *n, rte *old);
|
||||
static struct hostentry *rt_get_hostentry(rtable *tab, ip_addr a, ip_addr ll, rtable *dep);
|
||||
|
||||
#define rt_trace(tab, level, fmt, args...) do {\
|
||||
rtable *t = (tab); \
|
||||
if (t->config->debug & (level)) \
|
||||
log(L_TRACE "%s: " fmt, t->name, ##args); \
|
||||
} while (0)
|
||||
|
||||
static void
|
||||
net_init_with_trie(struct fib *f, void *N)
|
||||
{
|
||||
@ -2315,8 +2321,7 @@ rt_export_used(struct rt_exporter *e)
|
||||
{
|
||||
rtable *tab = SKIP_BACK(rtable, exporter, e);
|
||||
|
||||
if (config->table_debug)
|
||||
log(L_TRACE "%s: Export cleanup requested", tab->name);
|
||||
rt_trace(tab, D_EVENTS, "Export cleanup requested");
|
||||
|
||||
if (tab->export_used)
|
||||
return;
|
||||
@ -2341,8 +2346,8 @@ rt_event(void *ptr)
|
||||
(tab->hcu_scheduled || tab->nhu_state) && rt_cork_check(tab->uncork_event)
|
||||
)
|
||||
{
|
||||
if (!tab->hcu_corked && !tab->nhu_corked && config->table_debug)
|
||||
log(L_TRACE "%s: Auxiliary routines corked", tab->name);
|
||||
if (!tab->hcu_corked && !tab->nhu_corked)
|
||||
rt_trace(tab, D_STATES, "Next hop updater corked");
|
||||
|
||||
tab->hcu_corked |= tab->hcu_scheduled;
|
||||
tab->hcu_scheduled = 0;
|
||||
@ -2374,8 +2379,7 @@ rt_uncork_event(void *ptr)
|
||||
tab->nhu_state |= tab->nhu_corked;
|
||||
tab->nhu_corked = 0;
|
||||
|
||||
if (config->table_debug)
|
||||
log(L_TRACE "%s: Auxiliary routines uncorked", tab->name);
|
||||
rt_trace(tab, D_STATES, "Next hop updater uncorked");
|
||||
|
||||
ev_schedule(tab->rt_event);
|
||||
}
|
||||
@ -2704,7 +2708,7 @@ rt_prune_table(rtable *tab)
|
||||
struct rt_import_hook *ih;
|
||||
node *n, *x;
|
||||
|
||||
DBG("Pruning route table %s\n", tab->name);
|
||||
rt_trace(tab, D_STATES, "Pruning");
|
||||
#ifdef DEBUGGING
|
||||
fib_check(&tab->fib);
|
||||
#endif
|
||||
@ -2882,9 +2886,7 @@ rt_export_cleanup(rtable *tab)
|
||||
|
||||
tab->exporter.first = last_export_to_free ? rt_next_export_fast(last_export_to_free) : NULL;
|
||||
|
||||
if (config->table_debug)
|
||||
log(L_TRACE "%s: Export cleanup, old exporter.first seq %lu, new %lu, min_seq %ld",
|
||||
tab->name,
|
||||
rt_trace(tab, D_STATES, "Export cleanup, old exporter.first seq %lu, new %lu, min_seq %ld",
|
||||
first ? first->seq : 0,
|
||||
tab->exporter.first ? tab->exporter.first->seq : 0,
|
||||
min_seq);
|
||||
@ -2962,8 +2964,7 @@ rt_export_cleanup(rtable *tab)
|
||||
|
||||
if (EMPTY_LIST(tab->exporter.pending))
|
||||
{
|
||||
if (config->table_debug)
|
||||
log(L_TRACE "%s: Resetting export seq", tab->name);
|
||||
rt_trace(tab, D_EVENTS, "Resetting export seq");
|
||||
|
||||
node *n;
|
||||
WALK_LIST2(eh, n, tab->exporter.hooks, n)
|
||||
@ -3635,6 +3636,7 @@ rt_new_table(struct symbol *s, uint addr_type)
|
||||
c->max_settle_time = 20 S;
|
||||
c->cork_threshold.low = 128;
|
||||
c->cork_threshold.high = 512;
|
||||
c->debug = new_config->table_debug;
|
||||
|
||||
add_tail(&new_config->tables, &c->n);
|
||||
|
||||
@ -3691,8 +3693,7 @@ rt_check_cork_low(rtable *tab)
|
||||
tab->cork_active = 0;
|
||||
rt_cork_release();
|
||||
|
||||
if (config->table_debug)
|
||||
log(L_TRACE "%s: Uncorked", tab->name);
|
||||
rt_trace(tab, D_STATES, "Uncorked");
|
||||
}
|
||||
}
|
||||
|
||||
@ -3704,8 +3705,7 @@ rt_check_cork_high(rtable *tab)
|
||||
tab->cork_active = 1;
|
||||
rt_cork_acquire();
|
||||
|
||||
if (config->table_debug)
|
||||
log(L_TRACE "%s: Corked", tab->name);
|
||||
rt_trace(tab, D_STATES, "Corked");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -59,6 +59,7 @@ struct rtable_config {
|
||||
uint gc_period; /* Approximate time between two consecutive GC runs */
|
||||
byte sorted; /* Routes of network are sorted according to rte_better() */
|
||||
byte trie_used; /* Rtable has attached trie */
|
||||
byte debug; /* Whether to log */
|
||||
btime min_settle_time; /* Minimum settle time for notifications */
|
||||
btime max_settle_time; /* Maximum settle time for notifications */
|
||||
btime export_settle_time; /* Delay before exports are announced */
|
||||
|
Loading…
Reference in New Issue
Block a user