mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-12-22 09:41:54 +00:00
Merge commit 'db1eb46664d4c76d56dc55a63ce7abe853fc6862' into HEAD
This commit is contained in:
commit
8c19f8a209
@ -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 */
|
||||
u16 filter_vstk, filter_estk; /* Filter stack depth */
|
||||
struct timeformat tf_route; /* Time format for 'show route' */
|
||||
struct timeformat tf_proto; /* Time format for 'show protocol' */
|
||||
@ -45,7 +46,6 @@ struct config {
|
||||
|
||||
int cli_debug; /* Tracing of CLI connections and commands */
|
||||
int latency_debug; /* I/O loop tracks duration of each event */
|
||||
int table_debug; /* Track route propagation through tables */
|
||||
u32 latency_limit; /* Events with longer duration are logged (us) */
|
||||
u32 watchdog_warning; /* I/O loop watchdog limit for warning (us) */
|
||||
u32 watchdog_timeout; /* Watchdog timeout (in seconds, 0 = disabled) */
|
||||
|
@ -85,6 +85,7 @@ struct rte_owner {
|
||||
const char *name;
|
||||
u32 hash_key;
|
||||
u32 uc;
|
||||
u32 debug;
|
||||
event_list *list;
|
||||
event *prune;
|
||||
event *stop;
|
||||
|
@ -152,7 +152,7 @@ proto_call_cmd_reload(struct proto_spec ps, int dir, const struct f_trie *trie)
|
||||
CF_DECLS
|
||||
|
||||
CF_KEYWORDS(ROUTER, ID, HOSTNAME, PROTOCOL, TEMPLATE, PREFERENCE, DISABLED, DEBUG, ALL, OFF, DIRECT, PIPE)
|
||||
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)
|
||||
@ -269,6 +269,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]);
|
||||
@ -282,7 +283,6 @@ table_opt:
|
||||
this_table->cork_threshold.high = $4; }
|
||||
| EXPORT SETTLE TIME settle { this_table->export_settle = $4; }
|
||||
| ROUTE REFRESH EXPORT SETTLE TIME settle { this_table->export_rr_settle = $6; }
|
||||
| DEBUG bool { this_table->debug = $2; }
|
||||
;
|
||||
|
||||
table_opts:
|
||||
@ -443,8 +443,8 @@ 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; }
|
||||
| DEBUG TABLES debug_mask { new_config->table_debug = $3; }
|
||||
;
|
||||
|
||||
/* MRTDUMP PROTOCOLS is in systep/unix/config.Y */
|
||||
|
@ -1856,7 +1856,7 @@ proto_reconfigure(struct proto *p, struct proto_config *oc, struct proto_config
|
||||
return 0;
|
||||
|
||||
p->sources.name = p->name = nc->name;
|
||||
p->debug = nc->debug;
|
||||
p->sources.debug = p->debug = nc->debug;
|
||||
p->mrtdump = nc->mrtdump;
|
||||
reconfigure_type = type;
|
||||
|
||||
@ -2599,6 +2599,8 @@ proto_do_start(struct proto *p)
|
||||
if (!p->sources.class)
|
||||
p->sources.class = &default_rte_owner_class;
|
||||
|
||||
p->sources.debug = p->debug;
|
||||
|
||||
if (!p->cf->late_if_feed)
|
||||
iface_subscribe(&p->iface_sub);
|
||||
}
|
||||
|
@ -62,9 +62,9 @@ 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 trie_used; /* Rtable has attached trie */
|
||||
byte debug; /* Whether to log */
|
||||
struct rt_cork_threshold cork_threshold; /* Cork threshold values */
|
||||
struct settle_config export_settle; /* Export announcement settler */
|
||||
struct settle_config export_rr_settle;/* Export announcement settler config valid when any
|
||||
@ -122,6 +122,7 @@ struct rtable_private {
|
||||
struct f_trie *trie; /* Trie of prefixes defined in fib */
|
||||
int use_count; /* Number of protocols using this table */
|
||||
u32 rt_count; /* Number of routes in the table */
|
||||
u32 debug; /* Debugging flags (D_*) */
|
||||
|
||||
list imports; /* Registered route importers */
|
||||
struct rt_table_exporter exporter; /* Exporter API structure */
|
||||
|
@ -257,8 +257,8 @@ rt_get_source_o(struct rte_owner *p, u32 id)
|
||||
p->uc++;
|
||||
|
||||
HASH_INSERT2(p->hash, RSH, rta_pool, src);
|
||||
if (config->table_debug)
|
||||
log(L_TRACE "Allocated new rte_src for %s, ID %luL %uG, have %u sources now",
|
||||
if (p->debug & D_ROUTES)
|
||||
log(L_TRACE "%s: new rte_src ID %luL %uG, have %u sources now",
|
||||
p->name, src->private_id, src->global_id, p->uc);
|
||||
|
||||
uint gm = atomic_load_explicit(&rte_src_global_max, memory_order_relaxed);
|
||||
@ -334,6 +334,10 @@ rt_prune_sources(void *data)
|
||||
{
|
||||
o->uc--;
|
||||
|
||||
if (o->debug & D_ROUTES)
|
||||
log(L_TRACE "%s: freed rte_src ID %luL %uG, have %u sources now",
|
||||
o->name, src->private_id, src->global_id, o->uc);
|
||||
|
||||
HASH_DO_REMOVE(o->hash, RSH, sp);
|
||||
|
||||
RTA_LOCK;
|
||||
@ -354,8 +358,8 @@ rt_prune_sources(void *data)
|
||||
rfree(o->prune);
|
||||
RTA_UNLOCK;
|
||||
|
||||
if (config->table_debug)
|
||||
log(L_TRACE "All rte_src's for %s pruned, scheduling stop event", o->name);
|
||||
if (o->debug & D_EVENTS)
|
||||
log(L_TRACE "%s: all rte_src's pruned, scheduling stop event", o->name);
|
||||
|
||||
rt_done_sources(o);
|
||||
}
|
||||
@ -399,6 +403,8 @@ rt_init_sources(struct rte_owner *o, const char *name, event_list *list)
|
||||
o->stop = NULL;
|
||||
o->list = list;
|
||||
RTA_UNLOCK;
|
||||
if (o->debug & D_EVENTS)
|
||||
log(L_TRACE "%s: initialized rte_src owner", o->name);
|
||||
}
|
||||
|
||||
void
|
||||
@ -408,8 +414,8 @@ rt_destroy_sources(struct rte_owner *o, event *done)
|
||||
|
||||
if (!o->uc)
|
||||
{
|
||||
if (config->table_debug)
|
||||
log(L_TRACE "Source owner %s destroy requested. All rte_src's already pruned, scheduling stop event", o->name);
|
||||
if (o->debug & D_EVENTS)
|
||||
log(L_TRACE "%s: rte_src owner destroy requested, already clean, scheduling stop event", o->name);
|
||||
|
||||
RTA_LOCK;
|
||||
rfree(o->prune);
|
||||
@ -418,8 +424,8 @@ rt_destroy_sources(struct rte_owner *o, event *done)
|
||||
rt_done_sources(o);
|
||||
}
|
||||
else
|
||||
if (config->table_debug)
|
||||
log(L_TRACE "Source owner %s destroy requested. Remaining %u rte_src's to prune.", o->name, o->uc);
|
||||
if (o->debug & D_EVENTS)
|
||||
log(L_TRACE "%s: rte_src owner destroy requested, remaining %u rte_src's to prune.", o->name, o->uc);
|
||||
}
|
||||
|
||||
/*
|
||||
|
196
nest/rt-table.c
196
nest/rt-table.c
@ -225,66 +225,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);
|
||||
}
|
||||
|
||||
static inline net *
|
||||
net_route_ip4_trie(struct rtable_private *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(struct rtable_private *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(struct rtable_private *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(struct rtable_private *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 *
|
||||
net_route_ip6_sadr_trie(struct rtable_private *t, const net_addr_ip6_sadr *n0)
|
||||
{
|
||||
@ -318,69 +258,6 @@ net_route_ip6_sadr_trie(struct rtable_private *t, const net_addr_ip6_sadr *n0)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline net *
|
||||
net_route_ip4_fib(struct rtable_private *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(struct rtable_private *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(struct rtable_private *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(struct rtable_private *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 *
|
||||
net_route_ip6_sadr_fib(struct rtable_private *t, const net_addr_ip6_sadr *n0)
|
||||
@ -426,42 +303,51 @@ net *
|
||||
net_route(struct rtable_private *tab, const net_addr *n)
|
||||
{
|
||||
ASSERT(tab->addr_type == n->type);
|
||||
net_addr_union *nu = SKIP_BACK(net_addr_union, n, n);
|
||||
|
||||
switch (n->type)
|
||||
{
|
||||
case NET_IP4:
|
||||
if (tab->trie)
|
||||
return net_route_ip4_trie(tab, (net_addr_ip4 *) n);
|
||||
else
|
||||
return net_route_ip4_fib (tab, (net_addr_ip4 *) n);
|
||||
#define TW(ipv, what) \
|
||||
TRIE_WALK_TO_ROOT_IP##ipv(tab->trie, &(nu->ip##ipv), var) \
|
||||
{ what(ipv, var); } \
|
||||
TRIE_WALK_TO_ROOT_END; return NULL;
|
||||
|
||||
case NET_VPN4:
|
||||
if (tab->trie)
|
||||
return net_route_vpn4_trie(tab, (net_addr_vpn4 *) n);
|
||||
else
|
||||
return net_route_vpn4_fib (tab, (net_addr_vpn4 *) n);
|
||||
#define FW(ipv, what) do { \
|
||||
net_addr_union nuc; net_copy(&nuc.n, n); \
|
||||
while (1) { \
|
||||
what(ipv, nuc.ip##ipv); if (!nuc.n.pxlen) return NULL; \
|
||||
nuc.n.pxlen--; ip##ipv##_clrbit(&nuc.ip##ipv.prefix, nuc.ip##ipv.pxlen); \
|
||||
} \
|
||||
} while(0); return NULL;
|
||||
|
||||
case NET_IP6:
|
||||
if (tab->trie)
|
||||
return net_route_ip6_trie(tab, (net_addr_ip6 *) n);
|
||||
else
|
||||
return net_route_ip6_fib (tab, (net_addr_ip6 *) n);
|
||||
#define FVR_IP(ipv, var) \
|
||||
net *r; if (r = net_find_valid(tab, (net_addr *) &var)) return r;
|
||||
|
||||
case NET_VPN6:
|
||||
if (tab->trie)
|
||||
return net_route_vpn6_trie(tab, (net_addr_vpn6 *) n);
|
||||
else
|
||||
return net_route_vpn6_fib (tab, (net_addr_vpn6 *) n);
|
||||
#define FVR_VPN(ipv, var) \
|
||||
net_addr_vpn##ipv _var0 = NET_ADDR_VPN##ipv(var.prefix, var.pxlen, nu->vpn##ipv.rd); FVR_IP(ipv, _var0);
|
||||
|
||||
case NET_IP6_SADR:
|
||||
if (tab->trie)
|
||||
return net_route_ip6_sadr_trie(tab, (net_addr_ip6_sadr *) n);
|
||||
else
|
||||
return net_route_ip6_sadr_fib (tab, (net_addr_ip6_sadr *) n);
|
||||
if (tab->trie)
|
||||
switch (n->type) {
|
||||
case NET_IP4: TW(4, FVR_IP);
|
||||
case NET_VPN4: TW(4, FVR_VPN);
|
||||
case NET_IP6: TW(6, FVR_IP);
|
||||
case NET_VPN6: TW(6, FVR_VPN);
|
||||
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
case NET_IP6_SADR:
|
||||
return net_route_ip6_sadr_trie(tab, (net_addr_ip6_sadr *) n);
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
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:
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2942,6 +2828,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;
|
||||
t->id = idm_alloc(&rtable_idm);
|
||||
if (t->id >= rtable_max_id)
|
||||
rtable_max_id = t->id + 1;
|
||||
@ -4092,7 +3979,7 @@ rt_new_table(struct symbol *s, uint addr_type)
|
||||
.min = 100 MS,
|
||||
.max = 3 S,
|
||||
};
|
||||
c->debug = new_config->table_debug;
|
||||
c->debug = new_config->table_default_debug;
|
||||
|
||||
add_tail(&new_config->tables, &c->n);
|
||||
|
||||
@ -4206,6 +4093,7 @@ rt_reconfigure(struct rtable_private *tab, struct rtable_config *new, struct rta
|
||||
new->table = RT_PUB(tab);
|
||||
tab->name = new->name;
|
||||
tab->config = new;
|
||||
tab->debug = new->debug;
|
||||
|
||||
if (tab->hostcache)
|
||||
tab->hostcache->req.trace_routes = new->debug;
|
||||
|
Loading…
Reference in New Issue
Block a user