mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-12-22 17:51:53 +00:00
Nest: Add routing table configuration blocks
Allow to specify sorted flag, trie fla, and min/max settle time. Also do not enable trie by default, it must be explicitly enabled.
This commit is contained in:
parent
fde1cff012
commit
1ae42e5223
@ -17,6 +17,7 @@ CF_HDR
|
|||||||
|
|
||||||
CF_DEFINES
|
CF_DEFINES
|
||||||
|
|
||||||
|
static struct rtable_config *this_table;
|
||||||
static struct proto_config *this_proto;
|
static struct proto_config *this_proto;
|
||||||
static struct channel_config *this_channel;
|
static struct channel_config *this_channel;
|
||||||
static struct iface_patt *this_ipatt;
|
static struct iface_patt *this_ipatt;
|
||||||
@ -118,12 +119,13 @@ CF_KEYWORDS(RECEIVE, LIMIT, ACTION, WARN, BLOCK, RESTART, DISABLE, KEEP, FILTERE
|
|||||||
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)
|
||||||
CF_KEYWORDS(ALGORITHM, KEYED, HMAC, MD5, SHA1, SHA256, SHA384, SHA512, BLAKE2S128, BLAKE2S256, BLAKE2B256, BLAKE2B512)
|
CF_KEYWORDS(ALGORITHM, KEYED, HMAC, MD5, SHA1, SHA256, SHA384, SHA512, BLAKE2S128, BLAKE2S256, BLAKE2B256, BLAKE2B512)
|
||||||
CF_KEYWORDS(PRIMARY, STATS, COUNT, BY, FOR, IN, COMMANDS, PREEXPORT, NOEXPORT, EXPORTED, GENERATE)
|
CF_KEYWORDS(PRIMARY, STATS, COUNT, BY, FOR, IN, COMMANDS, PREEXPORT, NOEXPORT, EXPORTED, GENERATE)
|
||||||
CF_KEYWORDS(BGP, PASSWORDS, DESCRIPTION, SORTED)
|
CF_KEYWORDS(BGP, PASSWORDS, DESCRIPTION)
|
||||||
CF_KEYWORDS(RELOAD, IN, OUT, MRTDUMP, MESSAGES, RESTRICT, MEMORY, IGP_METRIC, CLASS, DSCP)
|
CF_KEYWORDS(RELOAD, IN, OUT, MRTDUMP, MESSAGES, RESTRICT, MEMORY, IGP_METRIC, CLASS, DSCP)
|
||||||
CF_KEYWORDS(TIMEFORMAT, ISO, SHORT, LONG, ROUTE, PROTOCOL, BASE, LOG, S, MS, US)
|
CF_KEYWORDS(TIMEFORMAT, ISO, SHORT, LONG, ROUTE, PROTOCOL, BASE, LOG, S, MS, US)
|
||||||
CF_KEYWORDS(GRACEFUL, RESTART, WAIT, MAX, FLUSH, AS)
|
CF_KEYWORDS(GRACEFUL, RESTART, WAIT, MAX, FLUSH, AS)
|
||||||
CF_KEYWORDS(MIN, IDLE, RX, TX, INTERVAL, MULTIPLIER, PASSIVE)
|
CF_KEYWORDS(MIN, IDLE, RX, TX, INTERVAL, MULTIPLIER, PASSIVE)
|
||||||
CF_KEYWORDS(CHECK, LINK)
|
CF_KEYWORDS(CHECK, LINK)
|
||||||
|
CF_KEYWORDS(SORTED, TRIE, MIN, MAX, SETTLE, TIME)
|
||||||
|
|
||||||
/* For r_args_channel */
|
/* For r_args_channel */
|
||||||
CF_KEYWORDS(IPV4, IPV4_MC, IPV4_MPLS, IPV6, IPV6_MC, IPV6_MPLS, IPV6_SADR, VPN4, VPN4_MC, VPN4_MPLS, VPN6, VPN6_MC, VPN6_MPLS, ROA4, ROA6, FLOW4, FLOW6, MPLS, PRI, SEC)
|
CF_KEYWORDS(IPV4, IPV4_MC, IPV4_MPLS, IPV6, IPV6_MC, IPV6_MPLS, IPV6_SADR, VPN4, VPN4_MC, VPN4_MPLS, VPN6, VPN6_MC, VPN6_MPLS, ROA4, ROA6, FLOW4, FLOW6, MPLS, PRI, SEC)
|
||||||
@ -141,7 +143,7 @@ CF_ENUM_PX(T_ENUM_AF, AF_, AFI_, IPV4, IPV6)
|
|||||||
%type <s> optproto
|
%type <s> optproto
|
||||||
%type <ra> r_args
|
%type <ra> r_args
|
||||||
%type <sd> sym_args
|
%type <sd> sym_args
|
||||||
%type <i> proto_start echo_mask echo_size debug_mask debug_list debug_flag mrtdump_mask mrtdump_list mrtdump_flag export_mode limit_action net_type table_sorted tos password_algorithm
|
%type <i> proto_start echo_mask echo_size debug_mask debug_list debug_flag mrtdump_mask mrtdump_list mrtdump_flag export_mode limit_action net_type tos password_algorithm
|
||||||
%type <ps> proto_patt proto_patt2
|
%type <ps> proto_patt proto_patt2
|
||||||
%type <cc> channel_start proto_channel
|
%type <cc> channel_start proto_channel
|
||||||
%type <cl> limit_spec
|
%type <cl> limit_spec
|
||||||
@ -206,16 +208,37 @@ CF_ENUM(T_ENUM_NETTYPE, NET_, IP4, IP6, VPN4, VPN6, ROA4, ROA6, FLOW4, FLOW6, IP
|
|||||||
|
|
||||||
conf: table ;
|
conf: table ;
|
||||||
|
|
||||||
table_sorted:
|
table: table_start table_sorted table_opt_list ;
|
||||||
{ $$ = 0; }
|
|
||||||
| SORTED { $$ = 1; }
|
table_start: net_type TABLE symbol {
|
||||||
|
this_table = rt_new_table($3, $1);
|
||||||
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
table: net_type TABLE symbol table_sorted {
|
table_sorted:
|
||||||
struct rtable_config *cf;
|
/* empty */
|
||||||
cf = rt_new_table($3, $1);
|
| SORTED { this_table->sorted = 1; }
|
||||||
cf->sorted = $4;
|
;
|
||||||
|
|
||||||
|
table_opt:
|
||||||
|
SORTED bool { this_table->sorted = $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]);
|
||||||
|
this_table->trie_used = $2;
|
||||||
}
|
}
|
||||||
|
| MIN SETTLE TIME expr_us { this_table->min_settle_time = $4; }
|
||||||
|
| MAX SETTLE TIME expr_us { this_table->max_settle_time = $4; }
|
||||||
|
;
|
||||||
|
|
||||||
|
table_opts:
|
||||||
|
/* empty */
|
||||||
|
| table_opts table_opt ';'
|
||||||
|
;
|
||||||
|
|
||||||
|
table_opt_list:
|
||||||
|
/* empty */
|
||||||
|
| '{' table_opts '}'
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
@ -2579,7 +2579,6 @@ rt_new_table(struct symbol *s, uint addr_type)
|
|||||||
c->gc_min_time = 5;
|
c->gc_min_time = 5;
|
||||||
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->trie_used = net_val_match(addr_type, NB_IP | NB_VPN | NB_ROA | NB_IP6_SADR);
|
|
||||||
|
|
||||||
add_tail(&new_config->tables, &c->n);
|
add_tail(&new_config->tables, &c->n);
|
||||||
|
|
||||||
@ -2625,6 +2624,22 @@ rt_unlock_table(rtable *r)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
rt_reconfigure(rtable *tab, struct rtable_config *new, struct rtable_config *old)
|
||||||
|
{
|
||||||
|
if ((new->addr_type != old->addr_type) ||
|
||||||
|
(new->sorted != old->sorted) ||
|
||||||
|
(new->trie_used != old->trie_used))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
DBG("\t%s: same\n", new->name);
|
||||||
|
new->table = tab;
|
||||||
|
tab->name = new->name;
|
||||||
|
tab->config = new;
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
static struct rtable_config *
|
static struct rtable_config *
|
||||||
rt_find_table_config(struct config *cf, char *name)
|
rt_find_table_config(struct config *cf, char *name)
|
||||||
{
|
{
|
||||||
@ -2654,28 +2669,19 @@ rt_commit(struct config *new, struct config *old)
|
|||||||
{
|
{
|
||||||
WALK_LIST(o, old->tables)
|
WALK_LIST(o, old->tables)
|
||||||
{
|
{
|
||||||
rtable *ot = o->table;
|
rtable *tab = o->table;
|
||||||
if (!ot->deleted)
|
if (tab->deleted)
|
||||||
{
|
continue;
|
||||||
|
|
||||||
r = rt_find_table_config(new, o->name);
|
r = rt_find_table_config(new, o->name);
|
||||||
if (r && (r->addr_type == o->addr_type) && !new->shutdown)
|
if (r && !new->shutdown && rt_reconfigure(tab, r, o))
|
||||||
{
|
continue;
|
||||||
DBG("\t%s: same\n", o->name);
|
|
||||||
r->table = ot;
|
|
||||||
ot->name = r->name;
|
|
||||||
ot->config = r;
|
|
||||||
if (o->sorted != r->sorted)
|
|
||||||
log(L_WARN "Reconfiguration of rtable sorted flag not implemented");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
DBG("\t%s: deleted\n", o->name);
|
DBG("\t%s: deleted\n", o->name);
|
||||||
ot->deleted = old;
|
tab->deleted = old;
|
||||||
config_add_obstacle(old);
|
config_add_obstacle(old);
|
||||||
rt_lock_table(ot);
|
rt_lock_table(tab);
|
||||||
rt_unlock_table(ot);
|
rt_unlock_table(tab);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user