mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2025-01-03 07:31:54 +00:00
Merge commit '54ddf90f6370f06efc71c3ffd6e02d031a86866f' into mq-aggregator-for-v3
This commit is contained in:
commit
db1eb46664
@ -35,6 +35,7 @@ struct config {
|
|||||||
u32 proto_default_debug; /* Default protocol debug mask */
|
u32 proto_default_debug; /* Default protocol debug mask */
|
||||||
u32 proto_default_mrtdump; /* Default protocol mrtdump mask */
|
u32 proto_default_mrtdump; /* Default protocol mrtdump mask */
|
||||||
u32 channel_default_debug; /* Default channel debug 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_route; /* Time format for 'show route' */
|
||||||
struct timeformat tf_proto; /* Time format for 'show protocol' */
|
struct timeformat tf_proto; /* Time format for 'show protocol' */
|
||||||
struct timeformat tf_log; /* Time format for the logfile */
|
struct timeformat tf_log; /* Time format for the logfile */
|
||||||
|
@ -505,6 +505,11 @@ include "tablename.conf";;
|
|||||||
See <ref id="channel-debug" name="debug"> in the channel section.
|
See <ref id="channel-debug" name="debug"> in the channel section.
|
||||||
Default: off.
|
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>
|
<tag><label id="opt-debug-commands">debug commands <m/number/</tag>
|
||||||
Control logging of client connections (0 for no logging, 1 for logging
|
Control logging of client connections (0 for no logging, 1 for logging
|
||||||
of connects and disconnects, 2 and higher for logging of all client
|
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.
|
to set options.
|
||||||
|
|
||||||
<descrip>
|
<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>
|
<tag><label id="rtable-sorted">sorted <m/switch/</tag>
|
||||||
Usually, a routing table just chooses the selected (best) route from a
|
Usually, a routing table just chooses the selected (best) route from a
|
||||||
list of routes for each network, while keeping remaining routes unsorted.
|
list of routes for each network, while keeping remaining routes unsorted.
|
||||||
|
@ -114,7 +114,7 @@ proto_postconfig(void)
|
|||||||
CF_DECLS
|
CF_DECLS
|
||||||
|
|
||||||
CF_KEYWORDS(ROUTER, ID, HOSTNAME, PROTOCOL, TEMPLATE, PREFERENCE, DISABLED, DEBUG, ALL, OFF, DIRECT)
|
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(IPV4, IPV6, VPN4, VPN6, ROA4, ROA6, FLOW4, FLOW6, SADR, MPLS)
|
||||||
CF_KEYWORDS(RECEIVE, LIMIT, ACTION, WARN, BLOCK, RESTART, DISABLE, KEEP, FILTERED, RPKI)
|
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)
|
CF_KEYWORDS(PASSWORD, KEY, FROM, PASSIVE, TO, ID, EVENTS, PACKETS, PROTOCOLS, CHANNELS, INTERFACES)
|
||||||
@ -230,6 +230,7 @@ table_sorted:
|
|||||||
|
|
||||||
table_opt:
|
table_opt:
|
||||||
SORTED bool { this_table->sorted = $2; }
|
SORTED bool { this_table->sorted = $2; }
|
||||||
|
| DEBUG debug_mask { this_table->debug = $2; }
|
||||||
| TRIE bool {
|
| TRIE bool {
|
||||||
if (!net_val_match(this_table->addr_type, NB_IP | NB_VPN | NB_ROA | NB_IP6_SADR))
|
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]);
|
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_default:
|
||||||
DEBUG PROTOCOLS debug_mask { new_config->proto_default_debug = $3; }
|
DEBUG PROTOCOLS debug_mask { new_config->proto_default_debug = $3; }
|
||||||
| DEBUG CHANNELS debug_mask { new_config->channel_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; }
|
| DEBUG COMMANDS expr { new_config->cli_debug = $3; }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -150,6 +150,7 @@ struct rtable_config {
|
|||||||
uint addr_type; /* Type of address data stored in table (NET_*) */
|
uint addr_type; /* Type of address data stored in table (NET_*) */
|
||||||
uint gc_threshold; /* Maximum number of operations before GC is run */
|
uint gc_threshold; /* Maximum number of operations before GC is run */
|
||||||
uint gc_period; /* Approximate time between two consecutive GC runs */
|
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 sorted; /* Routes of network are sorted according to rte_better() */
|
||||||
byte internal; /* Internal table of a protocol */
|
byte internal; /* Internal table of a protocol */
|
||||||
byte trie_used; /* Rtable has attached trie */
|
byte trie_used; /* Rtable has attached trie */
|
||||||
@ -166,6 +167,7 @@ typedef struct rtable {
|
|||||||
char *name; /* Name of this table */
|
char *name; /* Name of this table */
|
||||||
list channels; /* List of attached channels (struct channel) */
|
list channels; /* List of attached channels (struct channel) */
|
||||||
uint addr_type; /* Type of address data stored in table (NET_*) */
|
uint addr_type; /* Type of address data stored in table (NET_*) */
|
||||||
|
u32 debug; /* Debugging flags (D_*) */
|
||||||
int pipe_busy; /* Pipe loop detection */
|
int pipe_busy; /* Pipe loop detection */
|
||||||
int use_count; /* Number of protocols using this table */
|
int use_count; /* Number of protocols using this table */
|
||||||
u32 rt_count; /* Number of routes in the table */
|
u32 rt_count; /* Number of routes in the table */
|
||||||
|
187
nest/rt-table.c
187
nest/rt-table.c
@ -145,66 +145,6 @@ net_init_with_trie(struct fib *f, void *N)
|
|||||||
trie_add_prefix(tab->trie_new, n->n.addr, n->n.addr->pxlen, n->n.addr->pxlen);
|
trie_add_prefix(tab->trie_new, n->n.addr, n->n.addr->pxlen, n->n.addr->pxlen);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline net *
|
|
||||||
net_route_ip4_trie(rtable *t, const net_addr_ip4 *n0)
|
|
||||||
{
|
|
||||||
TRIE_WALK_TO_ROOT_IP4(t->trie, n0, n)
|
|
||||||
{
|
|
||||||
net *r;
|
|
||||||
if (r = net_find_valid(t, (net_addr *) &n))
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
TRIE_WALK_TO_ROOT_END;
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline net *
|
|
||||||
net_route_vpn4_trie(rtable *t, const net_addr_vpn4 *n0)
|
|
||||||
{
|
|
||||||
TRIE_WALK_TO_ROOT_IP4(t->trie, (const net_addr_ip4 *) n0, px)
|
|
||||||
{
|
|
||||||
net_addr_vpn4 n = NET_ADDR_VPN4(px.prefix, px.pxlen, n0->rd);
|
|
||||||
|
|
||||||
net *r;
|
|
||||||
if (r = net_find_valid(t, (net_addr *) &n))
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
TRIE_WALK_TO_ROOT_END;
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline net *
|
|
||||||
net_route_ip6_trie(rtable *t, const net_addr_ip6 *n0)
|
|
||||||
{
|
|
||||||
TRIE_WALK_TO_ROOT_IP6(t->trie, n0, n)
|
|
||||||
{
|
|
||||||
net *r;
|
|
||||||
if (r = net_find_valid(t, (net_addr *) &n))
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
TRIE_WALK_TO_ROOT_END;
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline net *
|
|
||||||
net_route_vpn6_trie(rtable *t, const net_addr_vpn6 *n0)
|
|
||||||
{
|
|
||||||
TRIE_WALK_TO_ROOT_IP6(t->trie, (const net_addr_ip6 *) n0, px)
|
|
||||||
{
|
|
||||||
net_addr_vpn6 n = NET_ADDR_VPN6(px.prefix, px.pxlen, n0->rd);
|
|
||||||
|
|
||||||
net *r;
|
|
||||||
if (r = net_find_valid(t, (net_addr *) &n))
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
TRIE_WALK_TO_ROOT_END;
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void *
|
static inline void *
|
||||||
net_route_ip6_sadr_trie(rtable *t, const net_addr_ip6_sadr *n0)
|
net_route_ip6_sadr_trie(rtable *t, const net_addr_ip6_sadr *n0)
|
||||||
{
|
{
|
||||||
@ -238,69 +178,6 @@ net_route_ip6_sadr_trie(rtable *t, const net_addr_ip6_sadr *n0)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline net *
|
|
||||||
net_route_ip4_fib(rtable *t, const net_addr_ip4 *n0)
|
|
||||||
{
|
|
||||||
net_addr_ip4 n;
|
|
||||||
net_copy_ip4(&n, n0);
|
|
||||||
|
|
||||||
net *r;
|
|
||||||
while (r = net_find_valid(t, (net_addr *) &n), (!r) && (n.pxlen > 0))
|
|
||||||
{
|
|
||||||
n.pxlen--;
|
|
||||||
ip4_clrbit(&n.prefix, n.pxlen);
|
|
||||||
}
|
|
||||||
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline net *
|
|
||||||
net_route_vpn4_fib(rtable *t, const net_addr_vpn4 *n0)
|
|
||||||
{
|
|
||||||
net_addr_vpn4 n;
|
|
||||||
net_copy_vpn4(&n, n0);
|
|
||||||
|
|
||||||
net *r;
|
|
||||||
while (r = net_find_valid(t, (net_addr *) &n), (!r) && (n.pxlen > 0))
|
|
||||||
{
|
|
||||||
n.pxlen--;
|
|
||||||
ip4_clrbit(&n.prefix, n.pxlen);
|
|
||||||
}
|
|
||||||
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline net *
|
|
||||||
net_route_ip6_fib(rtable *t, const net_addr_ip6 *n0)
|
|
||||||
{
|
|
||||||
net_addr_ip6 n;
|
|
||||||
net_copy_ip6(&n, n0);
|
|
||||||
|
|
||||||
net *r;
|
|
||||||
while (r = net_find_valid(t, (net_addr *) &n), (!r) && (n.pxlen > 0))
|
|
||||||
{
|
|
||||||
n.pxlen--;
|
|
||||||
ip6_clrbit(&n.prefix, n.pxlen);
|
|
||||||
}
|
|
||||||
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline net *
|
|
||||||
net_route_vpn6_fib(rtable *t, const net_addr_vpn6 *n0)
|
|
||||||
{
|
|
||||||
net_addr_vpn6 n;
|
|
||||||
net_copy_vpn6(&n, n0);
|
|
||||||
|
|
||||||
net *r;
|
|
||||||
while (r = net_find_valid(t, (net_addr *) &n), (!r) && (n.pxlen > 0))
|
|
||||||
{
|
|
||||||
n.pxlen--;
|
|
||||||
ip6_clrbit(&n.prefix, n.pxlen);
|
|
||||||
}
|
|
||||||
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void *
|
static inline void *
|
||||||
net_route_ip6_sadr_fib(rtable *t, const net_addr_ip6_sadr *n0)
|
net_route_ip6_sadr_fib(rtable *t, const net_addr_ip6_sadr *n0)
|
||||||
@ -346,39 +223,48 @@ net *
|
|||||||
net_route(rtable *tab, const net_addr *n)
|
net_route(rtable *tab, const net_addr *n)
|
||||||
{
|
{
|
||||||
ASSERT(tab->addr_type == n->type);
|
ASSERT(tab->addr_type == n->type);
|
||||||
|
net_addr_union *nu = SKIP_BACK(net_addr_union, n, n);
|
||||||
|
|
||||||
switch (n->type)
|
#define TW(ipv, what) \
|
||||||
{
|
TRIE_WALK_TO_ROOT_IP##ipv(tab->trie, &(nu->ip##ipv), var) \
|
||||||
case NET_IP4:
|
{ what(ipv, var); } \
|
||||||
if (tab->trie)
|
TRIE_WALK_TO_ROOT_END; return NULL;
|
||||||
return net_route_ip4_trie(tab, (net_addr_ip4 *) n);
|
|
||||||
else
|
|
||||||
return net_route_ip4_fib (tab, (net_addr_ip4 *) n);
|
|
||||||
|
|
||||||
case NET_VPN4:
|
#define FW(ipv, what) do { \
|
||||||
if (tab->trie)
|
net_addr_union nuc; net_copy(&nuc.n, n); \
|
||||||
return net_route_vpn4_trie(tab, (net_addr_vpn4 *) n);
|
while (1) { \
|
||||||
else
|
what(ipv, nuc.ip##ipv); if (!nuc.n.pxlen) return NULL; \
|
||||||
return net_route_vpn4_fib (tab, (net_addr_vpn4 *) n);
|
nuc.n.pxlen--; ip##ipv##_clrbit(&nuc.ip##ipv.prefix, nuc.ip##ipv.pxlen); \
|
||||||
|
} \
|
||||||
|
} while(0); return NULL;
|
||||||
|
|
||||||
case NET_IP6:
|
#define FVR_IP(ipv, var) \
|
||||||
if (tab->trie)
|
net *r; if (r = net_find_valid(tab, (net_addr *) &var)) return r;
|
||||||
return net_route_ip6_trie(tab, (net_addr_ip6 *) n);
|
|
||||||
else
|
#define FVR_VPN(ipv, var) \
|
||||||
return net_route_ip6_fib (tab, (net_addr_ip6 *) n);
|
net_addr_vpn##ipv _var0 = NET_ADDR_VPN##ipv(var.prefix, var.pxlen, nu->vpn##ipv.rd); FVR_IP(ipv, _var0);
|
||||||
|
|
||||||
case NET_VPN6:
|
|
||||||
if (tab->trie)
|
if (tab->trie)
|
||||||
return net_route_vpn6_trie(tab, (net_addr_vpn6 *) n);
|
switch (n->type) {
|
||||||
else
|
case NET_IP4: TW(4, FVR_IP);
|
||||||
return net_route_vpn6_fib (tab, (net_addr_vpn6 *) n);
|
case NET_VPN4: TW(4, FVR_VPN);
|
||||||
|
case NET_IP6: TW(6, FVR_IP);
|
||||||
|
case NET_VPN6: TW(6, FVR_VPN);
|
||||||
|
|
||||||
case NET_IP6_SADR:
|
case NET_IP6_SADR:
|
||||||
if (tab->trie)
|
|
||||||
return net_route_ip6_sadr_trie(tab, (net_addr_ip6_sadr *) n);
|
return net_route_ip6_sadr_trie(tab, (net_addr_ip6_sadr *) n);
|
||||||
|
default:
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
return net_route_ip6_sadr_fib (tab, (net_addr_ip6_sadr *) n);
|
switch (n->type) {
|
||||||
|
case NET_IP4: FW(4, FVR_IP);
|
||||||
|
case NET_VPN4: FW(4, FVR_VPN);
|
||||||
|
case NET_IP6: FW(6, FVR_IP);
|
||||||
|
case NET_VPN6: FW(6, FVR_VPN);
|
||||||
|
|
||||||
|
case NET_IP6_SADR:
|
||||||
|
return net_route_ip6_sadr_fib (tab, (net_addr_ip6_sadr *) n);
|
||||||
default:
|
default:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -1751,6 +1637,9 @@ rt_examine(rtable *t, net_addr *a, struct channel *c, const struct filter *filte
|
|||||||
void
|
void
|
||||||
rt_refresh_begin(rtable *t, struct channel *c)
|
rt_refresh_begin(rtable *t, struct channel *c)
|
||||||
{
|
{
|
||||||
|
if (c->debug & D_EVENTS)
|
||||||
|
log(L_TRACE "%s.%s: Route refresh begin", c->proto->name, c->name);
|
||||||
|
|
||||||
FIB_WALK(&t->fib, net, n)
|
FIB_WALK(&t->fib, net, n)
|
||||||
{
|
{
|
||||||
rte *e;
|
rte *e;
|
||||||
@ -1772,6 +1661,9 @@ rt_refresh_begin(rtable *t, struct channel *c)
|
|||||||
void
|
void
|
||||||
rt_refresh_end(rtable *t, struct channel *c)
|
rt_refresh_end(rtable *t, struct channel *c)
|
||||||
{
|
{
|
||||||
|
if (c->debug & D_EVENTS)
|
||||||
|
log(L_TRACE "%s.%s: Route refresh end", c->proto->name, c->name);
|
||||||
|
|
||||||
int prune = 0;
|
int prune = 0;
|
||||||
|
|
||||||
FIB_WALK(&t->fib, net, n)
|
FIB_WALK(&t->fib, net, n)
|
||||||
@ -2151,6 +2043,7 @@ rt_setup(pool *pp, struct rtable_config *cf)
|
|||||||
t->name = cf->name;
|
t->name = cf->name;
|
||||||
t->config = cf;
|
t->config = cf;
|
||||||
t->addr_type = cf->addr_type;
|
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);
|
fib_init(&t->fib, p, t->addr_type, sizeof(net), OFFSETOF(net, n), 0, NULL);
|
||||||
|
|
||||||
@ -2863,6 +2756,7 @@ rt_new_table(struct symbol *s, uint addr_type)
|
|||||||
c->gc_period = (uint) -1; /* set in rt_postconfig() */
|
c->gc_period = (uint) -1; /* set in rt_postconfig() */
|
||||||
c->min_settle_time = 1 S;
|
c->min_settle_time = 1 S;
|
||||||
c->max_settle_time = 20 S;
|
c->max_settle_time = 20 S;
|
||||||
|
c->debug = new_config->table_default_debug;
|
||||||
|
|
||||||
add_tail(&new_config->tables, &c->n);
|
add_tail(&new_config->tables, &c->n);
|
||||||
|
|
||||||
@ -2920,6 +2814,7 @@ rt_reconfigure(rtable *tab, struct rtable_config *new, struct rtable_config *old
|
|||||||
new->table = tab;
|
new->table = tab;
|
||||||
tab->name = new->name;
|
tab->name = new->name;
|
||||||
tab->config = new;
|
tab->config = new;
|
||||||
|
tab->debug = new->debug;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user