From 8ebac84bc8d51e2404ce6d6dc5e35fb261830596 Mon Sep 17 00:00:00 2001 From: Maria Matejka Date: Wed, 20 Apr 2022 13:56:04 +0200 Subject: [PATCH 1/4] Moved advertising router info (FROM attribute) to eattrs --- filter/config.Y | 3 +-- filter/data.h | 3 +-- filter/f-inst.c | 5 ----- lib/route.h | 10 +++++++++- nest/rt-attr.c | 9 ++++++--- nest/rt-show.c | 5 +++-- nest/rt-table.c | 5 ++++- proto/babel/babel.c | 4 ++-- proto/bgp/packets.c | 3 ++- proto/rip/rip.c | 40 ++++++++++++++++++++-------------------- 10 files changed, 48 insertions(+), 39 deletions(-) diff --git a/filter/config.Y b/filter/config.Y index dcfae788..e24233aa 100644 --- a/filter/config.Y +++ b/filter/config.Y @@ -762,8 +762,7 @@ symbol_value: CF_SYM_KNOWN ; static_attr: - FROM { $$ = f_new_static_attr(T_IP, SA_FROM, 0); } - | GW { $$ = f_new_static_attr(T_IP, SA_GW, 0); } + GW { $$ = f_new_static_attr(T_IP, SA_GW, 0); } | NET { $$ = f_new_static_attr(T_NET, SA_NET, 1); } | PROTO { $$ = f_new_static_attr(T_STRING, SA_PROTO, 1); } | SOURCE { $$ = f_new_static_attr(T_ENUM_RTS, SA_SOURCE, 1); } diff --git a/filter/data.h b/filter/data.h index 0e25ccd9..a0a164ed 100644 --- a/filter/data.h +++ b/filter/data.h @@ -22,8 +22,7 @@ struct f_val { #define fputip(a) ({ ip_addr *ax = falloc(sizeof(*ax)); *ax = (a); ax; }) enum f_sa_code { - SA_FROM = 1, - SA_GW, + SA_GW = 1, SA_NET, SA_PROTO, SA_SOURCE, diff --git a/filter/f-inst.c b/filter/f-inst.c index 9530d9ad..7158d22e 100644 --- a/filter/f-inst.c +++ b/filter/f-inst.c @@ -533,7 +533,6 @@ switch (sa.sa_code) { - case SA_FROM: RESULT(sa.type, ip, rta->from); break; case SA_GW: RESULT(sa.type, ip, rta->nh.gw); break; case SA_NET: RESULT(sa.type, net, (*fs->rte)->net->n.addr); break; case SA_PROTO: RESULT(sa.type, s, (*fs->rte)->src->proto->name); break; @@ -563,10 +562,6 @@ switch (sa.sa_code) { - case SA_FROM: - rta->from = v1.val.ip; - break; - case SA_GW: { ip_addr ip = v1.val.ip; diff --git a/lib/route.h b/lib/route.h index be72bb16..e02c63b3 100644 --- a/lib/route.h +++ b/lib/route.h @@ -84,7 +84,6 @@ typedef struct rta { u32 hash_key; /* Hash over important fields */ struct ea_list *eattrs; /* Extended Attribute chain */ struct hostentry *hostentry; /* Hostentry for recursive next-hops */ - ip_addr from; /* Advertising router */ u16 cached:1; /* Are attributes cached? */ u16 source:7; /* Route source (RTS_...) */ u16 scope:4; /* Route scope (SCOPE_... -- see ip.h) */ @@ -219,6 +218,13 @@ static inline eattr *ea_find_by_name(ea_list *l, const char *name) (ea ? ea->u.data : (_def)); \ }) +#define ea_get_ip(_l, _ident, _def) ({ \ + struct ea_class *cls = ea_class_find((_ident)); \ + ASSERT_DIE(cls->type == T_IP); \ + const eattr *ea = ea_find((_l), cls->id); \ + (ea ? *((const ip_addr *) ea->u.ptr->data) : (_def)); \ + }) + eattr *ea_walk(struct ea_walk_state *s, uint id, uint max); void ea_dump(ea_list *); int ea_same(ea_list *x, ea_list *y); /* Test whether two ea_lists are identical */ @@ -300,6 +306,8 @@ u32 rt_get_igp_metric(rte *rt); #define IGP_METRIC_UNKNOWN 0x80000000 /* Default igp_metric used when no other protocol-specific metric is availabe */ +/* From: Advertising router */ +extern struct ea_class ea_gen_from; /* Next hop structures */ diff --git a/nest/rt-attr.c b/nest/rt-attr.c index e5d87b53..87f54b0d 100644 --- a/nest/rt-attr.c +++ b/nest/rt-attr.c @@ -70,6 +70,11 @@ struct ea_class ea_gen_preference = { .type = T_INT, }; +struct ea_class ea_gen_from = { + .name = "from", + .type = T_IP, +}; + const char * const rta_src_names[RTS_MAX] = { [RTS_STATIC] = "static", [RTS_INHERIT] = "inherit", @@ -1229,7 +1234,6 @@ rta_hash(rta *a) #define MIX(f) mem_hash_mix(&h, &(a->f), sizeof(a->f)); #define BMIX(f) mem_hash_mix_num(&h, a->f); MIX(hostentry); - MIX(from); BMIX(source); BMIX(scope); BMIX(dest); @@ -1244,7 +1248,6 @@ rta_same(rta *x, rta *y) return (x->source == y->source && x->scope == y->scope && x->dest == y->dest && - ipa_equal(x->from, y->from) && x->hostentry == y->hostentry && nexthop_same(&(x->nh), &(y->nh)) && ea_same(x->eattrs, y->eattrs)); @@ -1398,7 +1401,6 @@ rta_dump(rta *a) rtd[a->dest], a->hash_key); if (!a->cached) debug(" !CACHED"); - debug(" <-%I", a->from); if (a->dest == RTD_UNICAST) for (struct nexthop *nh = &(a->nh); nh; nh = nh->next) { @@ -1475,6 +1477,7 @@ rta_init(void) ea_register_init(&ea_gen_preference); ea_register_init(&ea_gen_igp_metric); + ea_register_init(&ea_gen_from); } /* diff --git a/nest/rt-show.c b/nest/rt-show.c index 1c764d8c..be4c0186 100644 --- a/nest/rt-show.c +++ b/nest/rt-show.c @@ -48,8 +48,9 @@ rt_show_rte(struct cli *c, byte *ia, rte *e, struct rt_show_data *d, int primary struct nexthop *nh; tm_format_time(tm, &config->tf_route, e->lastmod); - if (ipa_nonzero(a->from) && !ipa_equal(a->from, a->nh.gw)) - bsprintf(from, " from %I", a->from); + ip_addr a_from = ea_get_ip(a->eattrs, &ea_gen_from, IPA_NONE); + if (ipa_nonzero(a_from) && !ipa_equal(a_from, a->nh.gw)) + bsprintf(from, " from %I", a_from); else from[0] = 0; diff --git a/nest/rt-table.c b/nest/rt-table.c index 919576bd..e8b04e0b 100644 --- a/nest/rt-table.c +++ b/nest/rt-table.c @@ -2596,7 +2596,10 @@ rt_flowspec_check(rtable *tab_ip, rtable *tab_flow, const net_addr *n, rta *a, i u32 orig_b = ea_get_int(rb->attrs->eattrs, "bgp_originator_id", 0); /* Originator is either ORIGINATOR_ID (if present), or BGP neighbor address (if not) */ - if ((orig_a != orig_b) || (!orig_a && !orig_b && !ipa_equal(a->from, rb->attrs->from))) + if ((orig_a != orig_b) || (!orig_a && !orig_b && !ipa_equal( + ea_get_ip(a->eattrs, &ea_gen_from, IPA_NONE), + ea_get_ip(rb->attrs->eattrs, &ea_gen_from, IPA_NONE) + ))) return 0; diff --git a/proto/babel/babel.c b/proto/babel/babel.c index afd0b1e1..f4503b99 100644 --- a/proto/babel/babel.c +++ b/proto/babel/babel.c @@ -645,11 +645,12 @@ babel_announce_rte(struct babel_proto *p, struct babel_entry *e) { struct { ea_list l; - eattr a[4]; + eattr a[5]; } eattrs = { .l.count = ARRAY_SIZE(eattrs.a), .a = { EA_LITERAL_EMBEDDED(&ea_gen_preference, 0, c->preference), + EA_LITERAL_STORE_ADATA(&ea_gen_from, 0, &r->neigh->addr, sizeof(r->neigh->addr)), EA_LITERAL_EMBEDDED(&ea_babel_metric, 0, r->metric), EA_LITERAL_STORE_ADATA(&ea_babel_router_id, 0, &r->router_id, sizeof(r->router_id)), EA_LITERAL_EMBEDDED(&ea_babel_seqno, 0, r->seqno), @@ -660,7 +661,6 @@ babel_announce_rte(struct babel_proto *p, struct babel_entry *e) .source = RTS_BABEL, .scope = SCOPE_UNIVERSE, .dest = RTD_UNICAST, - .from = r->neigh->addr, .nh.gw = r->next_hop, .nh.iface = r->neigh->ifa->iface, .eattrs = &eattrs.l, diff --git a/proto/bgp/packets.c b/proto/bgp/packets.c index 45a4b1de..9760ebee 100644 --- a/proto/bgp/packets.c +++ b/proto/bgp/packets.c @@ -2476,8 +2476,9 @@ bgp_decode_nlri(struct bgp_parse_state *s, u32 afi, byte *nlri, uint len, ea_lis a->source = RTS_BGP; a->scope = SCOPE_UNIVERSE; - a->from = s->proto->remote_ip; a->eattrs = ea; + + ea_set_attr_data(&a->eattrs, &ea_gen_from, 0, &s->proto->remote_ip, sizeof(ip_addr)); ea_set_attr_u32(&a->eattrs, &ea_gen_preference, 0, c->c.preference); c->desc->decode_next_hop(s, nh, nh_len, a); diff --git a/proto/rip/rip.c b/proto/rip/rip.c index 244bcd0a..7c097a92 100644 --- a/proto/rip/rip.c +++ b/proto/rip/rip.c @@ -157,7 +157,18 @@ rip_announce_rte(struct rip_proto *p, struct rip_entry *en) .dest = RTD_UNICAST, }; - u8 rt_metric = rt->metric; + struct { + ea_list l; + eattr a[2]; + } ea_block = { + .l.count = ARRAY_SIZE(ea_block.a), + .a = { + EA_LITERAL_EMBEDDED(&ea_gen_preference, 0, p->p.main_channel->preference), + EA_LITERAL_EMBEDDED(&ea_rip_metric, 0, rt->metric), + }, + }; + a0.eattrs = &ea_block.l; + u16 rt_tag = rt->tag; if (p->ecmp) @@ -189,30 +200,19 @@ rip_announce_rte(struct rip_proto *p, struct rip_entry *en) else { /* Unipath route */ - a0.from = rt->from->nbr->addr; a0.nh.gw = rt->next_hop; a0.nh.iface = rt->from->ifa->iface; + ea_set_attr_data(&a0.eattrs, &ea_gen_from, 0, &rt->from->nbr->addr, sizeof(ip_addr)); } - struct { - ea_list l; - eattr a[4]; - struct rip_iface_adata riad; - } ea_block = { - .l.count = ARRAY_SIZE(ea_block.a), - .a = { - EA_LITERAL_EMBEDDED(&ea_gen_preference, 0, p->p.main_channel->preference), - EA_LITERAL_EMBEDDED(&ea_rip_metric, 0, rt_metric), - EA_LITERAL_EMBEDDED(&ea_rip_tag, 0, rt_tag), - EA_LITERAL_DIRECT_ADATA(&ea_rip_from, 0, &ea_block.riad.ad), - }, - .riad = { - .ad = { .length = sizeof(struct rip_iface_adata) - sizeof(struct adata) }, - .iface = a0.nh.iface, - }, - }; + ea_set_attr_u32(&a0.eattrs, &ea_rip_tag, 0, rt_tag); - a0.eattrs = &ea_block.l; + struct rip_iface_adata riad = { + .ad = { .length = sizeof(struct rip_iface_adata) - sizeof(struct adata) }, + .iface = a0.nh.iface, + }; + ea_set_attr(&a0.eattrs, + EA_LITERAL_DIRECT_ADATA(&ea_rip_from, 0, &riad.ad)); rta *a = rta_lookup(&a0); rte *e = rte_get_temp(a, p->p.main_source); From cce974e8ea992d0e6d2f649eca7880b436d91d71 Mon Sep 17 00:00:00 2001 From: Maria Matejka Date: Wed, 4 May 2022 12:24:30 +0200 Subject: [PATCH 2/4] Conf: Allowing keyword redefinition Some tokens are both keywords and symbols. For now, we allow only specific keywords to be redefined; in future, more of the keywords may be added to this category. The redefinable keywords must be specified in any .Y file as follows: toksym: THE_KEYWORD ; See proto/bgp/config.Y for an example. Also dropped a lot of unused terminals. --- conf/cf-lex.l | 13 ++++++------- conf/confbase.Y | 8 +++++--- conf/gen_keywords.m4 | 3 +-- conf/gen_parser.m4 | 2 +- filter/config.Y | 32 ++++++++++++++++---------------- nest/config.Y | 10 +++++----- proto/babel/config.Y | 2 +- proto/bgp/config.Y | 13 +++++++------ proto/ospf/config.Y | 2 +- proto/radv/config.Y | 2 +- proto/rip/config.Y | 2 +- sysdep/linux/netlink.Y | 3 --- sysdep/unix/krt.Y | 2 +- 13 files changed, 46 insertions(+), 48 deletions(-) diff --git a/conf/cf-lex.l b/conf/cf-lex.l index e84e1d9d..11bcdb18 100644 --- a/conf/cf-lex.l +++ b/conf/cf-lex.l @@ -709,10 +709,7 @@ cf_lex_symbol(const char *data) struct symbol *sym = cf_get_symbol(data); cf_lval.s = sym; - if (sym->class != SYM_VOID) - return CF_SYM_KNOWN; - - /* Is it a keyword? */ + /* Is it a keyword? Prefer the keyword. */ struct keyword *k = HASH_FIND(kw_hash, KW, data); if (k) { @@ -725,9 +722,11 @@ cf_lex_symbol(const char *data) } } - /* OK, undefined symbol */ - cf_lval.s = sym; - return CF_SYM_UNDEFINED; + /* OK, only a symbol. */ + if (sym->class == SYM_VOID) + return CF_SYM_UNDEFINED; + else + return CF_SYM_KNOWN; } static void diff --git a/conf/confbase.Y b/conf/confbase.Y index 2286b257..8a27c3d5 100644 --- a/conf/confbase.Y +++ b/conf/confbase.Y @@ -116,7 +116,7 @@ CF_DECLS %type label_stack_start label_stack %type text opttext -%type symbol +%type symbol symbol_known toksym %nonassoc PREFIX_DUMMY %left AND OR @@ -162,7 +162,7 @@ definition: expr: NUM | '(' term ')' { $$ = f_eval_int(f_linearize($2)); } - | CF_SYM_KNOWN { + | symbol_known { if ($1->class != (SYM_CONSTANT | T_INT)) cf_error("Number constant expected"); $$ = SYM_VAL($1).i; } ; @@ -173,7 +173,9 @@ expr_us: | expr US { $$ = $1 US_; } ; -symbol: CF_SYM_UNDEFINED | CF_SYM_KNOWN ; +toksym: FROM ; +symbol: CF_SYM_UNDEFINED | CF_SYM_KNOWN | toksym ; +symbol_known: CF_SYM_KNOWN | toksym ; /* Switches */ diff --git a/conf/gen_keywords.m4 b/conf/gen_keywords.m4 index 0c1dc545..53226e4d 100644 --- a/conf/gen_keywords.m4 +++ b/conf/gen_keywords.m4 @@ -26,8 +26,7 @@ m4_define(CF_DEFINES, `m4_divert(-1)') m4_define(CF_handle_kw, `m4_divert(1){ "m4_translit($1,[[A-Z]],[[a-z]])", $1, NULL }, m4_divert(-1)') m4_define(CF_keywd, `m4_ifdef([[CF_tok_$1]],,[[m4_define([[CF_tok_$1]],1)CF_handle_kw($1)]])') -m4_define(CF_KEYWORDS, `m4_define([[CF_toks]],[[]])CF_iterate([[CF_keywd]], [[$@]])m4_ifelse(CF_toks,,,%token[[]]CF_toks -)DNL') +m4_define(CF_KEYWORDS, `CF_iterate([[CF_keywd]], [[$@]])DNL') # CLI commands generate keywords as well m4_define(CF_CLI, `CF_KEYWORDS(m4_translit($1, [[ ]], [[,]])) diff --git a/conf/gen_parser.m4 b/conf/gen_parser.m4 index 5b378a93..af4b1455 100644 --- a/conf/gen_parser.m4 +++ b/conf/gen_parser.m4 @@ -31,7 +31,7 @@ m4_define(CF_iterate, `m4_define([[CF_iter]], m4_defn([[$1]]))CF_itera($2)') # Keywords act as untyped %token m4_define(CF_keywd, `m4_ifdef([[CF_tok_$1]],,[[m4_define([[CF_tok_$1]],1)m4_define([[CF_toks]],CF_toks $1)]])') -m4_define(CF_KEYWORDS, `m4_define([[CF_toks]],[[]])CF_iterate([[CF_keywd]], [[$@]])m4_ifelse(CF_toks,,,%token[[]]CF_toks +m4_define(CF_KEYWORDS, `m4_define([[CF_toks]],[[]])CF_iterate([[CF_keywd]], [[$@]])m4_ifelse(CF_toks,,,%token[[]]CF_toks )DNL') # CLI commands diff --git a/filter/config.Y b/filter/config.Y index e24233aa..7dcdb779 100644 --- a/filter/config.Y +++ b/filter/config.Y @@ -291,8 +291,8 @@ CF_KEYWORDS(FUNCTION, PRINT, PRINTN, UNSET, RETURN, LEN, MAXLEN, DATA, DATA1, DATA2, DEFINED, - ADD, DELETE, CONTAINS, RESET, - PREPEND, FIRST, LAST, LAST_NONAGGREGATED, MATCH, + ADD, DELETE, RESET, + PREPEND, FIRST, LAST, LAST_NONAGGREGATED, MIN, MAX, EMPTY, FILTER, WHERE, EVAL, ATTRIBUTE, @@ -357,7 +357,7 @@ custom_attr: ATTRIBUTE type symbol ';' { conf: bt_test_suite ; bt_test_suite: - BT_TEST_SUITE '(' CF_SYM_KNOWN ',' text ')' { + BT_TEST_SUITE '(' symbol_known ',' text ')' { cf_assert_symbol($3, SYM_FUNCTION); struct f_bt_test_suite *t = cfg_allocz(sizeof(struct f_bt_test_suite)); t->fn = $3->function; @@ -370,7 +370,7 @@ bt_test_suite: conf: bt_test_same ; bt_test_same: - BT_TEST_SAME '(' CF_SYM_KNOWN ',' CF_SYM_KNOWN ',' NUM ')' { + BT_TEST_SAME '(' symbol_known ',' symbol_known ',' NUM ')' { cf_assert_symbol($3, SYM_FUNCTION); cf_assert_symbol($5, SYM_FUNCTION); struct f_bt_test_suite *t = cfg_allocz(sizeof(struct f_bt_test_suite)); @@ -448,7 +448,7 @@ function_vars: filter_body: function_body ; filter: - CF_SYM_KNOWN { + symbol_known { cf_assert_symbol($1, SYM_FILTER); $$ = $1->filter; } @@ -549,7 +549,7 @@ set_atom: if (f_eval(f_linearize($2), &($$)) > F_RETURN) cf_error("Runtime error"); if (!f_valid_set_type($$.type)) cf_error("Set-incompatible type"); } - | CF_SYM_KNOWN { + | symbol_known { cf_assert_symbol($1, SYM_CONSTANT); if (!f_valid_set_type(SYM_TYPE($1))) cf_error("%s: set-incompatible type", $1->name); $$ = *$1->val; @@ -719,7 +719,7 @@ var_list: /* EMPTY */ { $$ = NULL; } | var_list ',' term { $$ = $3; $$->next = $1; } function_call: - CF_SYM_KNOWN '(' var_list ')' { + symbol_known '(' var_list ')' { if ($1->class != SYM_FUNCTION) cf_error("You can't call something which is not a function. Really."); @@ -743,7 +743,7 @@ function_call: } ; -symbol_value: CF_SYM_KNOWN +symbol_value: symbol_known { switch ($1->class) { case SYM_CONSTANT_RANGE: @@ -872,7 +872,7 @@ cmd: | IF term THEN block ELSE block { $$ = f_new_inst(FI_CONDITION, $2, $4, $6); } - | CF_SYM_KNOWN '=' term ';' { + | symbol_known '=' term ';' { switch ($1->class) { case SYM_VARIABLE_RANGE: $$ = f_new_inst(FI_VAR_SET, $3, $1); @@ -895,7 +895,7 @@ cmd: cf_error( "This static attribute is read-only."); $$ = f_new_inst(FI_RTA_SET, $3, $1); } - | UNSET '(' CF_SYM_KNOWN ')' ';' { + | UNSET '(' symbol_known ')' ';' { if ($3->class != SYM_ATTRIBUTE) cf_error("Can't unset %s", $3->name); if ($3->attribute->readonly) @@ -933,11 +933,11 @@ cmd: $$ = f_new_inst(FI_SWITCH, $2, build_tree($4)); } - | CF_SYM_KNOWN '.' EMPTY ';' { $$ = f_generate_empty($1); } - | CF_SYM_KNOWN '.' PREPEND '(' term ')' ';' { $$ = f_generate_complex_sym( FI_PATH_PREPEND, $1, $5 ); } - | CF_SYM_KNOWN '.' ADD '(' term ')' ';' { $$ = f_generate_complex_sym( FI_CLIST_ADD, $1, $5 ); } - | CF_SYM_KNOWN '.' DELETE '(' term ')' ';' { $$ = f_generate_complex_sym( FI_CLIST_DEL, $1, $5 ); } - | CF_SYM_KNOWN '.' FILTER '(' term ')' ';' { $$ = f_generate_complex_sym( FI_CLIST_FILTER, $1, $5 ); } + | symbol_known '.' EMPTY ';' { $$ = f_generate_empty($1); } + | symbol_known '.' PREPEND '(' term ')' ';' { $$ = f_generate_complex_sym( FI_PATH_PREPEND, $1, $5 ); } + | symbol_known '.' ADD '(' term ')' ';' { $$ = f_generate_complex_sym( FI_CLIST_ADD, $1, $5 ); } + | symbol_known '.' DELETE '(' term ')' ';' { $$ = f_generate_complex_sym( FI_CLIST_DEL, $1, $5 ); } + | symbol_known '.' FILTER '(' term ')' ';' { $$ = f_generate_complex_sym( FI_CLIST_FILTER, $1, $5 ); } | BT_ASSERT '(' get_cf_position term get_cf_position ')' ';' { $$ = assert_done($4, $3 + 1, $5 - 1); } | BT_CHECK_ASSIGN '(' get_cf_position lvalue get_cf_position ',' term ')' ';' { $$ = assert_assign(&$4, $7, $3 + 1, $5 - 1); } ; @@ -948,7 +948,7 @@ get_cf_position: }; lvalue: - CF_SYM_KNOWN { + symbol_known { switch ($1->class) { case SYM_VARIABLE_RANGE: $$ = (struct f_lval) { .type = F_LVAL_VARIABLE, .sym = $1 }; diff --git a/nest/config.Y b/nest/config.Y index c2913506..c144f0f3 100644 --- a/nest/config.Y +++ b/nest/config.Y @@ -118,11 +118,11 @@ 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) 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, FOR, IN, COMMANDS, PREEXPORT, NOEXPORT, EXPORTED, GENERATE) CF_KEYWORDS(BGP, PASSWORDS, DESCRIPTION) CF_KEYWORDS(RELOAD, IN, OUT, MRTDUMP, MESSAGES, RESTRICT, MEMORY, CLASS, DSCP) 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, AS) CF_KEYWORDS(MIN, IDLE, RX, TX, INTERVAL, MULTIPLIER, PASSIVE) CF_KEYWORDS(CHECK, LINK) CF_KEYWORDS(SORTED, TRIE, MIN, MAX, SETTLE, TIME) @@ -659,7 +659,7 @@ r_args: $$->addr = $3; $$->addr_mode = RSD_ADDR_IN; } -| r_args TABLE CF_SYM_KNOWN { +| r_args TABLE symbol_known { cf_assert_symbol($3, SYM_TABLE); $$ = $1; rt_show_add_table($$, $3->table->table); @@ -704,7 +704,7 @@ r_args: $$ = $1; $$->filtered = 1; } - | r_args export_mode CF_SYM_KNOWN { + | r_args export_mode symbol_known { cf_assert_symbol($3, SYM_PROTO); struct proto_config *c = (struct proto_config *) $3->proto; $$ = $1; @@ -721,7 +721,7 @@ r_args: $$->export_channel = $3; $$->tables_defined_by = RSD_TDB_INDIRECT; } - | r_args PROTOCOL CF_SYM_KNOWN { + | r_args PROTOCOL symbol_known { cf_assert_symbol($3, SYM_PROTO); struct proto_config *c = (struct proto_config *) $3->proto; $$ = $1; diff --git a/proto/babel/config.Y b/proto/babel/config.Y index 82419b20..a4350eed 100644 --- a/proto/babel/config.Y +++ b/proto/babel/config.Y @@ -24,7 +24,7 @@ CF_DECLS CF_KEYWORDS(BABEL, INTERFACE, METRIC, RXCOST, HELLO, UPDATE, INTERVAL, PORT, TYPE, WIRED, WIRELESS, RX, TX, BUFFER, PRIORITY, LENGTH, CHECK, LINK, - NEXT, HOP, IPV4, IPV6, BABEL_METRIC, SHOW, INTERFACES, NEIGHBORS, + NEXT, HOP, IPV4, IPV6, SHOW, INTERFACES, NEIGHBORS, ENTRIES, RANDOMIZE, ROUTER, ID, AUTHENTICATION, NONE, MAC, PERMISSIVE) CF_GRAMMAR diff --git a/proto/bgp/config.Y b/proto/bgp/config.Y index db261bbb..b4d8b83f 100644 --- a/proto/bgp/config.Y +++ b/proto/bgp/config.Y @@ -19,18 +19,17 @@ CF_DECLS CF_KEYWORDS(BGP, LOCAL, NEIGHBOR, AS, HOLD, TIME, CONNECT, RETRY, KEEPALIVE, MULTIHOP, STARTUP, VIA, NEXT, HOP, SELF, DEFAULT, PATH, METRIC, ERROR, - START, DELAY, FORGET, WAIT, ENABLE, DISABLE, AFTER, BGP_PATH, - BGP_LOCAL_PREF, BGP_MED, BGP_ORIGIN, BGP_NEXT_HOP, BGP_ATOMIC_AGGR, - BGP_AGGREGATOR, BGP_COMMUNITY, BGP_EXT_COMMUNITY, BGP_LARGE_COMMUNITY, + START, DELAY, FORGET, WAIT, ENABLE, DISABLE, AFTER, + BGP_LOCAL_PREF, BGP_MED, SOURCE, ADDRESS, PASSWORD, RR, RS, CLIENT, CLUSTER, ID, AS4, ADVERTISE, IPV4, CAPABILITIES, LIMIT, PASSIVE, PREFER, OLDER, MISSING, LLADDR, - DROP, IGNORE, ROUTE, REFRESH, INTERPRET, COMMUNITIES, BGP_ORIGINATOR_ID, - BGP_CLUSTER_LIST, IGP, TABLE, GATEWAY, DIRECT, RECURSIVE, MED, TTL, + DROP, IGNORE, ROUTE, REFRESH, INTERPRET, COMMUNITIES, + IGP, TABLE, GATEWAY, DIRECT, RECURSIVE, MED, TTL, SECURITY, DETERMINISTIC, SECONDARY, ALLOW, BFD, ADD, PATHS, RX, TX, GRACEFUL, RESTART, AWARE, CHECK, LINK, PORT, EXTENDED, MESSAGES, SETKEY, STRICT, BIND, CONFEDERATION, MEMBER, MULTICAST, FLOW4, FLOW6, LONG, LIVED, STALE, IMPORT, IBGP, EBGP, MANDATORY, INTERNAL, EXTERNAL, SETS, - DYNAMIC, RANGE, NAME, DIGITS, BGP_AIGP, AIGP, ORIGINATE, COST, ENFORCE, + DYNAMIC, RANGE, NAME, DIGITS, AIGP, ORIGINATE, COST, ENFORCE, FIRST, FREE, VALIDATE, BASE) %type bgp_nh @@ -44,6 +43,8 @@ CF_KEYWORDS(CEASE, PREFIX, LIMIT, HIT, ADMINISTRATIVE, SHUTDOWN, RESET, PEER, CF_GRAMMAR +toksym: BGP_MED | BGP_LOCAL_PREF ; + proto: bgp_proto '}' ; bgp_proto_start: proto_start BGP { diff --git a/proto/ospf/config.Y b/proto/ospf/config.Y index 136e1dcb..bc3df8db 100644 --- a/proto/ospf/config.Y +++ b/proto/ospf/config.Y @@ -190,7 +190,7 @@ ospf_check_auth(void) CF_DECLS -CF_KEYWORDS(OSPF, V2, V3, OSPF_METRIC1, OSPF_METRIC2, OSPF_TAG, OSPF_ROUTER_ID) +CF_KEYWORDS(OSPF, V2, V3) CF_KEYWORDS(AREA, NEIGHBORS, RFC1583COMPAT, STUB, TICK, COST, COST2, RETRANSMIT) CF_KEYWORDS(HELLO, TRANSMIT, PRIORITY, DEAD, TYPE, BROADCAST, BCAST, DEFAULT) CF_KEYWORDS(NONBROADCAST, NBMA, POINTOPOINT, PTP, POINTOMULTIPOINT, PTMP) diff --git a/proto/radv/config.Y b/proto/radv/config.Y index f40fdcca..fb68d2e5 100644 --- a/proto/radv/config.Y +++ b/proto/radv/config.Y @@ -33,7 +33,7 @@ CF_KEYWORDS(RADV, PREFIX, INTERFACE, MIN, MAX, RA, DELAY, INTERVAL, SOLICITED, RETRANS, TIMER, CURRENT, HOP, LIMIT, DEFAULT, VALID, PREFERRED, MULT, LIFETIME, SKIP, ONLINK, AUTONOMOUS, RDNSS, DNSSL, NS, DOMAIN, LOCAL, TRIGGER, SENSITIVE, PREFERENCE, LOW, MEDIUM, HIGH, PROPAGATE, ROUTE, - ROUTES, RA_PREFERENCE, RA_LIFETIME) + ROUTES) CF_ENUM(T_ENUM_RA_PREFERENCE, RA_PREF_, LOW, MEDIUM, HIGH) diff --git a/proto/rip/config.Y b/proto/rip/config.Y index 234e9029..3c0973b1 100644 --- a/proto/rip/config.Y +++ b/proto/rip/config.Y @@ -37,7 +37,7 @@ CF_KEYWORDS(RIP, NG, ECMP, LIMIT, WEIGHT, INFINITY, METRIC, UPDATE, TIMEOUT, PASSIVE, VERSION, SPLIT, HORIZON, POISON, REVERSE, CHECK, ZERO, TIME, BFD, AUTHENTICATION, NONE, PLAINTEXT, CRYPTOGRAPHIC, MD5, TTL, SECURITY, RX, TX, BUFFER, LENGTH, PRIORITY, ONLY, LINK, - DEMAND, CIRCUIT, RIP_METRIC, RIP_TAG) + DEMAND, CIRCUIT) %type rip_variant rip_auth diff --git a/sysdep/linux/netlink.Y b/sysdep/linux/netlink.Y index 17e17789..7ba8c7c9 100644 --- a/sysdep/linux/netlink.Y +++ b/sysdep/linux/netlink.Y @@ -11,9 +11,6 @@ CF_HDR CF_DECLS CF_KEYWORDS(KERNEL, TABLE, METRIC, NETLINK, RX, BUFFER, - KRT_PREFSRC, KRT_REALM, KRT_SCOPE, KRT_MTU, KRT_WINDOW, - KRT_RTT, KRT_RTTVAR, KRT_SSTRESH, KRT_CWND, KRT_ADVMSS, KRT_REORDERING, - KRT_HOPLIMIT, KRT_INITCWND, KRT_RTO_MIN, KRT_INITRWND, KRT_QUICKACK, KRT_LOCK_MTU, KRT_LOCK_WINDOW, KRT_LOCK_RTT, KRT_LOCK_RTTVAR, KRT_LOCK_SSTRESH, KRT_LOCK_CWND, KRT_LOCK_ADVMSS, KRT_LOCK_REORDERING, KRT_LOCK_HOPLIMIT, KRT_LOCK_RTO_MIN, KRT_FEATURE_ECN, KRT_FEATURE_ALLFRAG) diff --git a/sysdep/unix/krt.Y b/sysdep/unix/krt.Y index 9300e9c8..4ce9a328 100644 --- a/sysdep/unix/krt.Y +++ b/sysdep/unix/krt.Y @@ -29,7 +29,7 @@ kif_set_preferred(ip_addr ip) CF_DECLS -CF_KEYWORDS(KERNEL, PERSIST, SCAN, TIME, LEARN, DEVICE, ROUTES, GRACEFUL, RESTART, KRT_SOURCE, KRT_METRIC, MERGE, PATHS) +CF_KEYWORDS(KERNEL, PERSIST, SCAN, TIME, LEARN, DEVICE, ROUTES, GRACEFUL, RESTART, MERGE, PATHS) CF_KEYWORDS(INTERFACE, PREFERRED) %type kern_mp_limit From 0c4e0e4a635169cada395144dd67d1e66f1c9649 Mon Sep 17 00:00:00 2001 From: Maria Matejka Date: Wed, 4 May 2022 12:33:01 +0200 Subject: [PATCH 3/4] Removed forgotten remnants of unused enum rtc --- bird-gdb.py | 1 - filter/data.c | 1 - lib/type.h | 1 - 3 files changed, 3 deletions(-) diff --git a/bird-gdb.py b/bird-gdb.py index 3cf65a9c..62c0ec87 100644 --- a/bird-gdb.py +++ b/bird-gdb.py @@ -25,7 +25,6 @@ class BIRDFValPrinter(BIRDPrinter): "T_ENUM_RTS": "i", "T_ENUM_BGP_ORIGIN": "i", "T_ENUM_SCOPE": "i", - "T_ENUM_RTC": "i", "T_ENUM_RTD": "i", "T_ENUM_ROA": "i", "T_ENUM_NETTYPE": "i", diff --git a/filter/data.c b/filter/data.c index 425dfdd3..9dab1915 100644 --- a/filter/data.c +++ b/filter/data.c @@ -38,7 +38,6 @@ static const char * const f_type_str[] = { [T_ENUM_RTS] = "enum rts", [T_ENUM_BGP_ORIGIN] = "enum bgp_origin", [T_ENUM_SCOPE] = "enum scope", - [T_ENUM_RTC] = "enum rtc", [T_ENUM_RTD] = "enum rtd", [T_ENUM_ROA] = "enum roa", [T_ENUM_NETTYPE] = "enum nettype", diff --git a/lib/type.h b/lib/type.h index e43389f3..abce1a1f 100644 --- a/lib/type.h +++ b/lib/type.h @@ -79,7 +79,6 @@ enum btype { T_ENUM_RTS = 0x31, T_ENUM_SCOPE = 0x33, - T_ENUM_RTC = 0x35, T_ENUM_RTD = 0x37, T_ENUM_ROA = 0x39, T_ENUM_NETTYPE = 0x3b, From 702c04fbef222e802ca4dfac645dc75ede522db6 Mon Sep 17 00:00:00 2001 From: Maria Matejka Date: Wed, 4 May 2022 12:41:54 +0200 Subject: [PATCH 4/4] Removing the route scope attribute. Use custom attributes instead. The route scope attribute was used for simple user route marking. As there is a better tool for this (custom attributes), the old and limited way can be dropped. --- doc/bird.sgml | 8 -------- filter/config.Y | 1 - filter/data.h | 1 - filter/f-inst.c | 5 ----- filter/test.conf2 | 6 ------ lib/route.h | 1 - nest/rt-attr.c | 8 +++----- nest/rt-dev.c | 1 - proto/babel/babel.c | 2 -- proto/bgp/packets.c | 1 - proto/ospf/rt.c | 1 - proto/perf/perf.c | 1 - proto/rip/rip.c | 1 - proto/rpki/rpki.c | 1 - proto/static/static.c | 1 - sysdep/bsd/krt-sock.c | 1 - sysdep/linux/netlink.c | 1 - 17 files changed, 3 insertions(+), 38 deletions(-) diff --git a/doc/bird.sgml b/doc/bird.sgml index a71624aa..aa058b37 100644 --- a/doc/bird.sgml +++ b/doc/bird.sgml @@ -1723,14 +1723,6 @@ Common route attributes are: primary key of the routing table. Read-only. (See the .) -