mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-11-18 17:18:42 +00:00
Merge commit '702c04fbef222e802ca4dfac645dc75ede522db6' into haugesund
This commit is contained in:
commit
65254128e1
@ -25,7 +25,6 @@ class BIRDFValPrinter(BIRDPrinter):
|
|||||||
"T_ENUM_RTS": "i",
|
"T_ENUM_RTS": "i",
|
||||||
"T_ENUM_BGP_ORIGIN": "i",
|
"T_ENUM_BGP_ORIGIN": "i",
|
||||||
"T_ENUM_SCOPE": "i",
|
"T_ENUM_SCOPE": "i",
|
||||||
"T_ENUM_RTC": "i",
|
|
||||||
"T_ENUM_RTD": "i",
|
"T_ENUM_RTD": "i",
|
||||||
"T_ENUM_ROA": "i",
|
"T_ENUM_ROA": "i",
|
||||||
"T_ENUM_NETTYPE": "i",
|
"T_ENUM_NETTYPE": "i",
|
||||||
|
@ -709,10 +709,7 @@ cf_lex_symbol(const char *data)
|
|||||||
struct symbol *sym = cf_get_symbol(data);
|
struct symbol *sym = cf_get_symbol(data);
|
||||||
cf_lval.s = sym;
|
cf_lval.s = sym;
|
||||||
|
|
||||||
if (sym->class != SYM_VOID)
|
/* Is it a keyword? Prefer the keyword. */
|
||||||
return CF_SYM_KNOWN;
|
|
||||||
|
|
||||||
/* Is it a keyword? */
|
|
||||||
struct keyword *k = HASH_FIND(kw_hash, KW, data);
|
struct keyword *k = HASH_FIND(kw_hash, KW, data);
|
||||||
if (k)
|
if (k)
|
||||||
{
|
{
|
||||||
@ -725,9 +722,11 @@ cf_lex_symbol(const char *data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* OK, undefined symbol */
|
/* OK, only a symbol. */
|
||||||
cf_lval.s = sym;
|
if (sym->class == SYM_VOID)
|
||||||
return CF_SYM_UNDEFINED;
|
return CF_SYM_UNDEFINED;
|
||||||
|
else
|
||||||
|
return CF_SYM_KNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -116,7 +116,7 @@ CF_DECLS
|
|||||||
%type <mls> label_stack_start label_stack
|
%type <mls> label_stack_start label_stack
|
||||||
|
|
||||||
%type <t> text opttext
|
%type <t> text opttext
|
||||||
%type <s> symbol
|
%type <s> symbol symbol_known toksym
|
||||||
|
|
||||||
%nonassoc PREFIX_DUMMY
|
%nonassoc PREFIX_DUMMY
|
||||||
%left AND OR
|
%left AND OR
|
||||||
@ -162,7 +162,7 @@ definition:
|
|||||||
expr:
|
expr:
|
||||||
NUM
|
NUM
|
||||||
| '(' term ')' { $$ = f_eval_int(f_linearize($2)); }
|
| '(' term ')' { $$ = f_eval_int(f_linearize($2)); }
|
||||||
| CF_SYM_KNOWN {
|
| symbol_known {
|
||||||
if ($1->class != (SYM_CONSTANT | T_INT)) cf_error("Number constant expected");
|
if ($1->class != (SYM_CONSTANT | T_INT)) cf_error("Number constant expected");
|
||||||
$$ = SYM_VAL($1).i; }
|
$$ = SYM_VAL($1).i; }
|
||||||
;
|
;
|
||||||
@ -173,7 +173,9 @@ expr_us:
|
|||||||
| expr US { $$ = $1 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 */
|
/* Switches */
|
||||||
|
|
||||||
|
@ -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_define(CF_handle_kw, `m4_divert(1){ "m4_translit($1,[[A-Z]],[[a-z]])", $1, NULL },
|
||||||
m4_divert(-1)')
|
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_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
|
m4_define(CF_KEYWORDS, `CF_iterate([[CF_keywd]], [[$@]])DNL')
|
||||||
)DNL')
|
|
||||||
|
|
||||||
# CLI commands generate keywords as well
|
# CLI commands generate keywords as well
|
||||||
m4_define(CF_CLI, `CF_KEYWORDS(m4_translit($1, [[ ]], [[,]]))
|
m4_define(CF_CLI, `CF_KEYWORDS(m4_translit($1, [[ ]], [[,]]))
|
||||||
|
@ -31,7 +31,7 @@ m4_define(CF_iterate, `m4_define([[CF_iter]], m4_defn([[$1]]))CF_itera($2)')
|
|||||||
|
|
||||||
# Keywords act as untyped %token
|
# 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_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<s>[[]]CF_toks
|
||||||
)DNL')
|
)DNL')
|
||||||
|
|
||||||
# CLI commands
|
# CLI commands
|
||||||
|
@ -1723,14 +1723,6 @@ Common route attributes are:
|
|||||||
primary key of the routing table. Read-only. (See the <ref id="routes"
|
primary key of the routing table. Read-only. (See the <ref id="routes"
|
||||||
name="chapter about routes">.)
|
name="chapter about routes">.)
|
||||||
|
|
||||||
<tag><label id="rta-scope"><m/enum/ scope</tag>
|
|
||||||
The scope of the route. Possible values: <cf/SCOPE_HOST/ for routes
|
|
||||||
local to this host, <cf/SCOPE_LINK/ for those specific for a physical
|
|
||||||
link, <cf/SCOPE_SITE/ and <cf/SCOPE_ORGANIZATION/ for private routes and
|
|
||||||
<cf/SCOPE_UNIVERSE/ for globally visible routes. This attribute is not
|
|
||||||
interpreted by BIRD and can be used to mark routes in filters. The
|
|
||||||
default value for new routes is <cf/SCOPE_UNIVERSE/.
|
|
||||||
|
|
||||||
<tag><label id="rta-preference"><m/int/ preference</tag>
|
<tag><label id="rta-preference"><m/int/ preference</tag>
|
||||||
Preference of the route.
|
Preference of the route.
|
||||||
|
|
||||||
|
@ -291,8 +291,8 @@ CF_KEYWORDS(FUNCTION, PRINT, PRINTN, UNSET, RETURN,
|
|||||||
LEN, MAXLEN,
|
LEN, MAXLEN,
|
||||||
DATA, DATA1, DATA2,
|
DATA, DATA1, DATA2,
|
||||||
DEFINED,
|
DEFINED,
|
||||||
ADD, DELETE, CONTAINS, RESET,
|
ADD, DELETE, RESET,
|
||||||
PREPEND, FIRST, LAST, LAST_NONAGGREGATED, MATCH,
|
PREPEND, FIRST, LAST, LAST_NONAGGREGATED,
|
||||||
MIN, MAX,
|
MIN, MAX,
|
||||||
EMPTY,
|
EMPTY,
|
||||||
FILTER, WHERE, EVAL, ATTRIBUTE,
|
FILTER, WHERE, EVAL, ATTRIBUTE,
|
||||||
@ -357,7 +357,7 @@ custom_attr: ATTRIBUTE type symbol ';' {
|
|||||||
|
|
||||||
conf: bt_test_suite ;
|
conf: bt_test_suite ;
|
||||||
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);
|
cf_assert_symbol($3, SYM_FUNCTION);
|
||||||
struct f_bt_test_suite *t = cfg_allocz(sizeof(struct f_bt_test_suite));
|
struct f_bt_test_suite *t = cfg_allocz(sizeof(struct f_bt_test_suite));
|
||||||
t->fn = $3->function;
|
t->fn = $3->function;
|
||||||
@ -370,7 +370,7 @@ bt_test_suite:
|
|||||||
|
|
||||||
conf: bt_test_same ;
|
conf: bt_test_same ;
|
||||||
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($3, SYM_FUNCTION);
|
||||||
cf_assert_symbol($5, SYM_FUNCTION);
|
cf_assert_symbol($5, SYM_FUNCTION);
|
||||||
struct f_bt_test_suite *t = cfg_allocz(sizeof(struct f_bt_test_suite));
|
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_body: function_body ;
|
||||||
|
|
||||||
filter:
|
filter:
|
||||||
CF_SYM_KNOWN {
|
symbol_known {
|
||||||
cf_assert_symbol($1, SYM_FILTER);
|
cf_assert_symbol($1, SYM_FILTER);
|
||||||
$$ = $1->filter;
|
$$ = $1->filter;
|
||||||
}
|
}
|
||||||
@ -549,7 +549,7 @@ set_atom:
|
|||||||
if (f_eval(f_linearize($2), &($$)) > F_RETURN) cf_error("Runtime error");
|
if (f_eval(f_linearize($2), &($$)) > F_RETURN) cf_error("Runtime error");
|
||||||
if (!f_valid_set_type($$.type)) cf_error("Set-incompatible type");
|
if (!f_valid_set_type($$.type)) cf_error("Set-incompatible type");
|
||||||
}
|
}
|
||||||
| CF_SYM_KNOWN {
|
| symbol_known {
|
||||||
cf_assert_symbol($1, SYM_CONSTANT);
|
cf_assert_symbol($1, SYM_CONSTANT);
|
||||||
if (!f_valid_set_type(SYM_TYPE($1))) cf_error("%s: set-incompatible type", $1->name);
|
if (!f_valid_set_type(SYM_TYPE($1))) cf_error("%s: set-incompatible type", $1->name);
|
||||||
$$ = *$1->val;
|
$$ = *$1->val;
|
||||||
@ -719,7 +719,7 @@ var_list: /* EMPTY */ { $$ = NULL; }
|
|||||||
| var_list ',' term { $$ = $3; $$->next = $1; }
|
| var_list ',' term { $$ = $3; $$->next = $1; }
|
||||||
|
|
||||||
function_call:
|
function_call:
|
||||||
CF_SYM_KNOWN '(' var_list ')' {
|
symbol_known '(' var_list ')' {
|
||||||
if ($1->class != SYM_FUNCTION)
|
if ($1->class != SYM_FUNCTION)
|
||||||
cf_error("You can't call something which is not a function. Really.");
|
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) {
|
switch ($1->class) {
|
||||||
case SYM_CONSTANT_RANGE:
|
case SYM_CONSTANT_RANGE:
|
||||||
@ -762,12 +762,10 @@ symbol_value: CF_SYM_KNOWN
|
|||||||
;
|
;
|
||||||
|
|
||||||
static_attr:
|
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); }
|
| NET { $$ = f_new_static_attr(T_NET, SA_NET, 1); }
|
||||||
| PROTO { $$ = f_new_static_attr(T_STRING, SA_PROTO, 1); }
|
| PROTO { $$ = f_new_static_attr(T_STRING, SA_PROTO, 1); }
|
||||||
| SOURCE { $$ = f_new_static_attr(T_ENUM_RTS, SA_SOURCE, 1); }
|
| SOURCE { $$ = f_new_static_attr(T_ENUM_RTS, SA_SOURCE, 1); }
|
||||||
| SCOPE { $$ = f_new_static_attr(T_ENUM_SCOPE, SA_SCOPE, 0); }
|
|
||||||
| DEST { $$ = f_new_static_attr(T_ENUM_RTD, SA_DEST, 0); }
|
| DEST { $$ = f_new_static_attr(T_ENUM_RTD, SA_DEST, 0); }
|
||||||
| IFNAME { $$ = f_new_static_attr(T_STRING, SA_IFNAME, 0); }
|
| IFNAME { $$ = f_new_static_attr(T_STRING, SA_IFNAME, 0); }
|
||||||
| IFINDEX { $$ = f_new_static_attr(T_INT, SA_IFINDEX, 1); }
|
| IFINDEX { $$ = f_new_static_attr(T_INT, SA_IFINDEX, 1); }
|
||||||
@ -873,7 +871,7 @@ cmd:
|
|||||||
| IF term THEN block ELSE block {
|
| IF term THEN block ELSE block {
|
||||||
$$ = f_new_inst(FI_CONDITION, $2, $4, $6);
|
$$ = f_new_inst(FI_CONDITION, $2, $4, $6);
|
||||||
}
|
}
|
||||||
| CF_SYM_KNOWN '=' term ';' {
|
| symbol_known '=' term ';' {
|
||||||
switch ($1->class) {
|
switch ($1->class) {
|
||||||
case SYM_VARIABLE_RANGE:
|
case SYM_VARIABLE_RANGE:
|
||||||
$$ = f_new_inst(FI_VAR_SET, $3, $1);
|
$$ = f_new_inst(FI_VAR_SET, $3, $1);
|
||||||
@ -896,7 +894,7 @@ cmd:
|
|||||||
cf_error( "This static attribute is read-only.");
|
cf_error( "This static attribute is read-only.");
|
||||||
$$ = f_new_inst(FI_RTA_SET, $3, $1);
|
$$ = f_new_inst(FI_RTA_SET, $3, $1);
|
||||||
}
|
}
|
||||||
| UNSET '(' CF_SYM_KNOWN ')' ';' {
|
| UNSET '(' symbol_known ')' ';' {
|
||||||
if ($3->class != SYM_ATTRIBUTE)
|
if ($3->class != SYM_ATTRIBUTE)
|
||||||
cf_error("Can't unset %s", $3->name);
|
cf_error("Can't unset %s", $3->name);
|
||||||
if ($3->attribute->readonly)
|
if ($3->attribute->readonly)
|
||||||
@ -934,11 +932,11 @@ cmd:
|
|||||||
$$ = f_new_inst(FI_SWITCH, $2, build_tree($4));
|
$$ = f_new_inst(FI_SWITCH, $2, build_tree($4));
|
||||||
}
|
}
|
||||||
|
|
||||||
| CF_SYM_KNOWN '.' EMPTY ';' { $$ = f_generate_empty($1); }
|
| symbol_known '.' EMPTY ';' { $$ = f_generate_empty($1); }
|
||||||
| CF_SYM_KNOWN '.' PREPEND '(' term ')' ';' { $$ = f_generate_complex_sym( FI_PATH_PREPEND, $1, $5 ); }
|
| symbol_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 ); }
|
| symbol_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 ); }
|
| symbol_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 '.' 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_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); }
|
| BT_CHECK_ASSIGN '(' get_cf_position lvalue get_cf_position ',' term ')' ';' { $$ = assert_assign(&$4, $7, $3 + 1, $5 - 1); }
|
||||||
;
|
;
|
||||||
@ -949,7 +947,7 @@ get_cf_position:
|
|||||||
};
|
};
|
||||||
|
|
||||||
lvalue:
|
lvalue:
|
||||||
CF_SYM_KNOWN {
|
symbol_known {
|
||||||
switch ($1->class) {
|
switch ($1->class) {
|
||||||
case SYM_VARIABLE_RANGE:
|
case SYM_VARIABLE_RANGE:
|
||||||
$$ = (struct f_lval) { .type = F_LVAL_VARIABLE, .sym = $1 };
|
$$ = (struct f_lval) { .type = F_LVAL_VARIABLE, .sym = $1 };
|
||||||
|
@ -38,7 +38,6 @@ static const char * const f_type_str[] = {
|
|||||||
[T_ENUM_RTS] = "enum rts",
|
[T_ENUM_RTS] = "enum rts",
|
||||||
[T_ENUM_BGP_ORIGIN] = "enum bgp_origin",
|
[T_ENUM_BGP_ORIGIN] = "enum bgp_origin",
|
||||||
[T_ENUM_SCOPE] = "enum scope",
|
[T_ENUM_SCOPE] = "enum scope",
|
||||||
[T_ENUM_RTC] = "enum rtc",
|
|
||||||
[T_ENUM_RTD] = "enum rtd",
|
[T_ENUM_RTD] = "enum rtd",
|
||||||
[T_ENUM_ROA] = "enum roa",
|
[T_ENUM_ROA] = "enum roa",
|
||||||
[T_ENUM_NETTYPE] = "enum nettype",
|
[T_ENUM_NETTYPE] = "enum nettype",
|
||||||
|
@ -22,12 +22,10 @@ struct f_val {
|
|||||||
#define fputip(a) ({ ip_addr *ax = falloc(sizeof(*ax)); *ax = (a); ax; })
|
#define fputip(a) ({ ip_addr *ax = falloc(sizeof(*ax)); *ax = (a); ax; })
|
||||||
|
|
||||||
enum f_sa_code {
|
enum f_sa_code {
|
||||||
SA_FROM = 1,
|
SA_GW = 1,
|
||||||
SA_GW,
|
|
||||||
SA_NET,
|
SA_NET,
|
||||||
SA_PROTO,
|
SA_PROTO,
|
||||||
SA_SOURCE,
|
SA_SOURCE,
|
||||||
SA_SCOPE,
|
|
||||||
SA_DEST,
|
SA_DEST,
|
||||||
SA_IFNAME,
|
SA_IFNAME,
|
||||||
SA_IFINDEX,
|
SA_IFINDEX,
|
||||||
|
@ -533,12 +533,10 @@
|
|||||||
|
|
||||||
switch (sa.sa_code)
|
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_GW: RESULT(sa.type, ip, rta->nh.gw); break;
|
||||||
case SA_NET: RESULT(sa.type, net, fs->rte->net); break;
|
case SA_NET: RESULT(sa.type, net, fs->rte->net); break;
|
||||||
case SA_PROTO: RESULT(sa.type, s, fs->rte->src->proto->name); break;
|
case SA_PROTO: RESULT(sa.type, s, fs->rte->src->proto->name); break;
|
||||||
case SA_SOURCE: RESULT(sa.type, i, rta->source); break;
|
case SA_SOURCE: RESULT(sa.type, i, rta->source); break;
|
||||||
case SA_SCOPE: RESULT(sa.type, i, rta->scope); break;
|
|
||||||
case SA_DEST: RESULT(sa.type, i, rta->dest); break;
|
case SA_DEST: RESULT(sa.type, i, rta->dest); break;
|
||||||
case SA_IFNAME: RESULT(sa.type, s, rta->nh.iface ? rta->nh.iface->name : ""); break;
|
case SA_IFNAME: RESULT(sa.type, s, rta->nh.iface ? rta->nh.iface->name : ""); break;
|
||||||
case SA_IFINDEX: RESULT(sa.type, i, rta->nh.iface ? rta->nh.iface->index : 0); break;
|
case SA_IFINDEX: RESULT(sa.type, i, rta->nh.iface ? rta->nh.iface->index : 0); break;
|
||||||
@ -563,10 +561,6 @@
|
|||||||
|
|
||||||
switch (sa.sa_code)
|
switch (sa.sa_code)
|
||||||
{
|
{
|
||||||
case SA_FROM:
|
|
||||||
rta->from = v1.val.ip;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SA_GW:
|
case SA_GW:
|
||||||
{
|
{
|
||||||
ip_addr ip = v1.val.ip;
|
ip_addr ip = v1.val.ip;
|
||||||
@ -584,10 +578,6 @@
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SA_SCOPE:
|
|
||||||
rta->scope = v1.val.i;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SA_DEST:
|
case SA_DEST:
|
||||||
{
|
{
|
||||||
int i = v1.val.i;
|
int i = v1.val.i;
|
||||||
|
@ -38,12 +38,6 @@ protocol static {
|
|||||||
print from;
|
print from;
|
||||||
from = 1.2.3.4;
|
from = 1.2.3.4;
|
||||||
print from;
|
print from;
|
||||||
print scope;
|
|
||||||
scope = SCOPE_HOST;
|
|
||||||
print scope;
|
|
||||||
if !(scope ~ [ SCOPE_HOST, SCOPE_SITE ]) then {
|
|
||||||
print "Failed in test";
|
|
||||||
}
|
|
||||||
|
|
||||||
preference = 15;
|
preference = 15;
|
||||||
print preference;
|
print preference;
|
||||||
|
11
lib/route.h
11
lib/route.h
@ -86,10 +86,8 @@ typedef struct rta {
|
|||||||
u32 hash_key; /* Hash over important fields */
|
u32 hash_key; /* Hash over important fields */
|
||||||
struct ea_list *eattrs; /* Extended Attribute chain */
|
struct ea_list *eattrs; /* Extended Attribute chain */
|
||||||
struct hostentry *hostentry; /* Hostentry for recursive next-hops */
|
struct hostentry *hostentry; /* Hostentry for recursive next-hops */
|
||||||
ip_addr from; /* Advertising router */
|
|
||||||
u16 cached:1; /* Are attributes cached? */
|
u16 cached:1; /* Are attributes cached? */
|
||||||
u16 source:7; /* Route source (RTS_...) */
|
u16 source:7; /* Route source (RTS_...) */
|
||||||
u16 scope:4; /* Route scope (SCOPE_... -- see ip.h) */
|
|
||||||
u16 dest:4; /* Route destination type (RTD_...) */
|
u16 dest:4; /* Route destination type (RTD_...) */
|
||||||
struct nexthop nh; /* Next hop */
|
struct nexthop nh; /* Next hop */
|
||||||
} rta;
|
} rta;
|
||||||
@ -221,6 +219,13 @@ static inline eattr *ea_find_by_name(ea_list *l, const char *name)
|
|||||||
(ea ? ea->u.data : (_def)); \
|
(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);
|
eattr *ea_walk(struct ea_walk_state *s, uint id, uint max);
|
||||||
void ea_dump(ea_list *);
|
void ea_dump(ea_list *);
|
||||||
int ea_same(ea_list *x, ea_list *y); /* Test whether two ea_lists are identical */
|
int ea_same(ea_list *x, ea_list *y); /* Test whether two ea_lists are identical */
|
||||||
@ -302,6 +307,8 @@ u32 rt_get_igp_metric(const rte *rt);
|
|||||||
#define IGP_METRIC_UNKNOWN 0x80000000 /* Default igp_metric used when no other
|
#define IGP_METRIC_UNKNOWN 0x80000000 /* Default igp_metric used when no other
|
||||||
protocol-specific metric is availabe */
|
protocol-specific metric is availabe */
|
||||||
|
|
||||||
|
/* From: Advertising router */
|
||||||
|
extern struct ea_class ea_gen_from;
|
||||||
|
|
||||||
/* Next hop structures */
|
/* Next hop structures */
|
||||||
|
|
||||||
|
@ -79,7 +79,6 @@ enum btype {
|
|||||||
|
|
||||||
T_ENUM_RTS = 0x31,
|
T_ENUM_RTS = 0x31,
|
||||||
T_ENUM_SCOPE = 0x33,
|
T_ENUM_SCOPE = 0x33,
|
||||||
T_ENUM_RTC = 0x35,
|
|
||||||
T_ENUM_RTD = 0x37,
|
T_ENUM_RTD = 0x37,
|
||||||
T_ENUM_ROA = 0x39,
|
T_ENUM_ROA = 0x39,
|
||||||
T_ENUM_NETTYPE = 0x3b,
|
T_ENUM_NETTYPE = 0x3b,
|
||||||
|
@ -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(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)
|
||||||
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, FOR, IN, COMMANDS, PREEXPORT, NOEXPORT, EXPORTED, GENERATE)
|
||||||
CF_KEYWORDS(BGP, PASSWORDS, DESCRIPTION)
|
CF_KEYWORDS(BGP, PASSWORDS, DESCRIPTION)
|
||||||
CF_KEYWORDS(RELOAD, IN, OUT, MRTDUMP, MESSAGES, RESTRICT, MEMORY, CLASS, DSCP)
|
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(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(MIN, IDLE, RX, TX, INTERVAL, MULTIPLIER, PASSIVE)
|
||||||
CF_KEYWORDS(CHECK, LINK)
|
CF_KEYWORDS(CHECK, LINK)
|
||||||
CF_KEYWORDS(SORTED, TRIE, MIN, MAX, SETTLE, TIME)
|
CF_KEYWORDS(SORTED, TRIE, MIN, MAX, SETTLE, TIME)
|
||||||
@ -660,7 +660,7 @@ r_args:
|
|||||||
$$->addr = $3;
|
$$->addr = $3;
|
||||||
$$->addr_mode = RSD_ADDR_IN;
|
$$->addr_mode = RSD_ADDR_IN;
|
||||||
}
|
}
|
||||||
| r_args TABLE CF_SYM_KNOWN {
|
| r_args TABLE symbol_known {
|
||||||
cf_assert_symbol($3, SYM_TABLE);
|
cf_assert_symbol($3, SYM_TABLE);
|
||||||
$$ = $1;
|
$$ = $1;
|
||||||
rt_show_add_table($$, $3->table->table);
|
rt_show_add_table($$, $3->table->table);
|
||||||
@ -705,7 +705,7 @@ r_args:
|
|||||||
$$ = $1;
|
$$ = $1;
|
||||||
$$->filtered = 1;
|
$$->filtered = 1;
|
||||||
}
|
}
|
||||||
| r_args export_mode CF_SYM_KNOWN {
|
| r_args export_mode symbol_known {
|
||||||
cf_assert_symbol($3, SYM_PROTO);
|
cf_assert_symbol($3, SYM_PROTO);
|
||||||
struct proto_config *c = (struct proto_config *) $3->proto;
|
struct proto_config *c = (struct proto_config *) $3->proto;
|
||||||
$$ = $1;
|
$$ = $1;
|
||||||
@ -722,7 +722,7 @@ r_args:
|
|||||||
$$->export_channel = $3;
|
$$->export_channel = $3;
|
||||||
$$->tables_defined_by = RSD_TDB_INDIRECT;
|
$$->tables_defined_by = RSD_TDB_INDIRECT;
|
||||||
}
|
}
|
||||||
| r_args PROTOCOL CF_SYM_KNOWN {
|
| r_args PROTOCOL symbol_known {
|
||||||
cf_assert_symbol($3, SYM_PROTO);
|
cf_assert_symbol($3, SYM_PROTO);
|
||||||
struct proto_config *c = (struct proto_config *) $3->proto;
|
struct proto_config *c = (struct proto_config *) $3->proto;
|
||||||
$$ = $1;
|
$$ = $1;
|
||||||
|
@ -70,6 +70,11 @@ struct ea_class ea_gen_preference = {
|
|||||||
.type = T_INT,
|
.type = T_INT,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct ea_class ea_gen_from = {
|
||||||
|
.name = "from",
|
||||||
|
.type = T_IP,
|
||||||
|
};
|
||||||
|
|
||||||
const char * const rta_src_names[RTS_MAX] = {
|
const char * const rta_src_names[RTS_MAX] = {
|
||||||
[RTS_STATIC] = "static",
|
[RTS_STATIC] = "static",
|
||||||
[RTS_INHERIT] = "inherit",
|
[RTS_INHERIT] = "inherit",
|
||||||
@ -1229,9 +1234,7 @@ rta_hash(rta *a)
|
|||||||
#define MIX(f) mem_hash_mix(&h, &(a->f), sizeof(a->f));
|
#define MIX(f) mem_hash_mix(&h, &(a->f), sizeof(a->f));
|
||||||
#define BMIX(f) mem_hash_mix_num(&h, a->f);
|
#define BMIX(f) mem_hash_mix_num(&h, a->f);
|
||||||
MIX(hostentry);
|
MIX(hostentry);
|
||||||
MIX(from);
|
|
||||||
BMIX(source);
|
BMIX(source);
|
||||||
BMIX(scope);
|
|
||||||
BMIX(dest);
|
BMIX(dest);
|
||||||
#undef MIX
|
#undef MIX
|
||||||
|
|
||||||
@ -1242,9 +1245,7 @@ static inline int
|
|||||||
rta_same(rta *x, rta *y)
|
rta_same(rta *x, rta *y)
|
||||||
{
|
{
|
||||||
return (x->source == y->source &&
|
return (x->source == y->source &&
|
||||||
x->scope == y->scope &&
|
|
||||||
x->dest == y->dest &&
|
x->dest == y->dest &&
|
||||||
ipa_equal(x->from, y->from) &&
|
|
||||||
x->hostentry == y->hostentry &&
|
x->hostentry == y->hostentry &&
|
||||||
nexthop_same(&(x->nh), &(y->nh)) &&
|
nexthop_same(&(x->nh), &(y->nh)) &&
|
||||||
ea_same(x->eattrs, y->eattrs));
|
ea_same(x->eattrs, y->eattrs));
|
||||||
@ -1393,12 +1394,11 @@ rta_dump(rta *a)
|
|||||||
"RTS_OSPF_EXT2", "RTS_BGP", "RTS_PIPE", "RTS_BABEL" };
|
"RTS_OSPF_EXT2", "RTS_BGP", "RTS_PIPE", "RTS_BABEL" };
|
||||||
static char *rtd[] = { "", " DEV", " HOLE", " UNREACH", " PROHIBIT" };
|
static char *rtd[] = { "", " DEV", " HOLE", " UNREACH", " PROHIBIT" };
|
||||||
|
|
||||||
debug("uc=%d %s %s%s h=%04x",
|
debug("uc=%d %s %s h=%04x",
|
||||||
a->uc, rts[a->source], ip_scope_text(a->scope),
|
a->uc, rts[a->source],
|
||||||
rtd[a->dest], a->hash_key);
|
rtd[a->dest], a->hash_key);
|
||||||
if (!a->cached)
|
if (!a->cached)
|
||||||
debug(" !CACHED");
|
debug(" !CACHED");
|
||||||
debug(" <-%I", a->from);
|
|
||||||
if (a->dest == RTD_UNICAST)
|
if (a->dest == RTD_UNICAST)
|
||||||
for (struct nexthop *nh = &(a->nh); nh; nh = nh->next)
|
for (struct nexthop *nh = &(a->nh); nh; nh = nh->next)
|
||||||
{
|
{
|
||||||
@ -1441,7 +1441,7 @@ rta_dump_all(void)
|
|||||||
void
|
void
|
||||||
rta_show(struct cli *c, rta *a)
|
rta_show(struct cli *c, rta *a)
|
||||||
{
|
{
|
||||||
cli_printf(c, -1008, "\tType: %s %s", rta_src_names[a->source], ip_scope_text(a->scope));
|
cli_printf(c, -1008, "\tType: %s", rta_src_names[a->source]);
|
||||||
|
|
||||||
for(ea_list *eal = a->eattrs; eal; eal=eal->next)
|
for(ea_list *eal = a->eattrs; eal; eal=eal->next)
|
||||||
for(int i=0; i<eal->count; i++)
|
for(int i=0; i<eal->count; i++)
|
||||||
@ -1475,6 +1475,7 @@ rta_init(void)
|
|||||||
|
|
||||||
ea_register_init(&ea_gen_preference);
|
ea_register_init(&ea_gen_preference);
|
||||||
ea_register_init(&ea_gen_igp_metric);
|
ea_register_init(&ea_gen_igp_metric);
|
||||||
|
ea_register_init(&ea_gen_from);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -81,7 +81,6 @@ dev_ifa_notify(struct proto *P, uint flags, struct ifa *ad)
|
|||||||
|
|
||||||
rta a0 = {
|
rta a0 = {
|
||||||
.source = RTS_DEVICE,
|
.source = RTS_DEVICE,
|
||||||
.scope = SCOPE_UNIVERSE,
|
|
||||||
.dest = RTD_UNICAST,
|
.dest = RTD_UNICAST,
|
||||||
.nh.iface = ad->iface,
|
.nh.iface = ad->iface,
|
||||||
};
|
};
|
||||||
|
@ -48,8 +48,9 @@ rt_show_rte(struct cli *c, byte *ia, rte *e, struct rt_show_data *d, int primary
|
|||||||
struct nexthop *nh;
|
struct nexthop *nh;
|
||||||
|
|
||||||
tm_format_time(tm, &config->tf_route, e->lastmod);
|
tm_format_time(tm, &config->tf_route, e->lastmod);
|
||||||
if (ipa_nonzero(a->from) && !ipa_equal(a->from, a->nh.gw))
|
ip_addr a_from = ea_get_ip(a->eattrs, &ea_gen_from, IPA_NONE);
|
||||||
bsprintf(from, " from %I", a->from);
|
if (ipa_nonzero(a_from) && !ipa_equal(a_from, a->nh.gw))
|
||||||
|
bsprintf(from, " from %I", a_from);
|
||||||
else
|
else
|
||||||
from[0] = 0;
|
from[0] = 0;
|
||||||
|
|
||||||
|
@ -2713,7 +2713,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);
|
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) */
|
/* 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;
|
return 0;
|
||||||
|
|
||||||
|
|
||||||
|
@ -645,11 +645,12 @@ babel_announce_rte(struct babel_proto *p, struct babel_entry *e)
|
|||||||
{
|
{
|
||||||
struct {
|
struct {
|
||||||
ea_list l;
|
ea_list l;
|
||||||
eattr a[4];
|
eattr a[5];
|
||||||
} eattrs = {
|
} eattrs = {
|
||||||
.l.count = ARRAY_SIZE(eattrs.a),
|
.l.count = ARRAY_SIZE(eattrs.a),
|
||||||
.a = {
|
.a = {
|
||||||
EA_LITERAL_EMBEDDED(&ea_gen_preference, 0, c->preference),
|
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_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_STORE_ADATA(&ea_babel_router_id, 0, &r->router_id, sizeof(r->router_id)),
|
||||||
EA_LITERAL_EMBEDDED(&ea_babel_seqno, 0, r->seqno),
|
EA_LITERAL_EMBEDDED(&ea_babel_seqno, 0, r->seqno),
|
||||||
@ -658,9 +659,7 @@ babel_announce_rte(struct babel_proto *p, struct babel_entry *e)
|
|||||||
|
|
||||||
rta a0 = {
|
rta a0 = {
|
||||||
.source = RTS_BABEL,
|
.source = RTS_BABEL,
|
||||||
.scope = SCOPE_UNIVERSE,
|
|
||||||
.dest = RTD_UNICAST,
|
.dest = RTD_UNICAST,
|
||||||
.from = r->neigh->addr,
|
|
||||||
.nh.gw = r->next_hop,
|
.nh.gw = r->next_hop,
|
||||||
.nh.iface = r->neigh->ifa->iface,
|
.nh.iface = r->neigh->ifa->iface,
|
||||||
.eattrs = &eattrs.l,
|
.eattrs = &eattrs.l,
|
||||||
@ -687,7 +686,6 @@ babel_announce_rte(struct babel_proto *p, struct babel_entry *e)
|
|||||||
/* Unreachable */
|
/* Unreachable */
|
||||||
rta a0 = {
|
rta a0 = {
|
||||||
.source = RTS_BABEL,
|
.source = RTS_BABEL,
|
||||||
.scope = SCOPE_UNIVERSE,
|
|
||||||
.dest = RTD_UNREACHABLE,
|
.dest = RTD_UNREACHABLE,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ CF_DECLS
|
|||||||
|
|
||||||
CF_KEYWORDS(BABEL, INTERFACE, METRIC, RXCOST, HELLO, UPDATE, INTERVAL, PORT,
|
CF_KEYWORDS(BABEL, INTERFACE, METRIC, RXCOST, HELLO, UPDATE, INTERVAL, PORT,
|
||||||
TYPE, WIRED, WIRELESS, RX, TX, BUFFER, PRIORITY, LENGTH, CHECK, LINK,
|
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)
|
ENTRIES, RANDOMIZE, ROUTER, ID, AUTHENTICATION, NONE, MAC, PERMISSIVE)
|
||||||
|
|
||||||
CF_GRAMMAR
|
CF_GRAMMAR
|
||||||
|
@ -19,18 +19,17 @@ CF_DECLS
|
|||||||
|
|
||||||
CF_KEYWORDS(BGP, LOCAL, NEIGHBOR, AS, HOLD, TIME, CONNECT, RETRY, KEEPALIVE,
|
CF_KEYWORDS(BGP, LOCAL, NEIGHBOR, AS, HOLD, TIME, CONNECT, RETRY, KEEPALIVE,
|
||||||
MULTIHOP, STARTUP, VIA, NEXT, HOP, SELF, DEFAULT, PATH, METRIC, ERROR,
|
MULTIHOP, STARTUP, VIA, NEXT, HOP, SELF, DEFAULT, PATH, METRIC, ERROR,
|
||||||
START, DELAY, FORGET, WAIT, ENABLE, DISABLE, AFTER, BGP_PATH,
|
START, DELAY, FORGET, WAIT, ENABLE, DISABLE, AFTER,
|
||||||
BGP_LOCAL_PREF, BGP_MED, BGP_ORIGIN, BGP_NEXT_HOP, BGP_ATOMIC_AGGR,
|
BGP_LOCAL_PREF, BGP_MED,
|
||||||
BGP_AGGREGATOR, BGP_COMMUNITY, BGP_EXT_COMMUNITY, BGP_LARGE_COMMUNITY,
|
|
||||||
SOURCE, ADDRESS, PASSWORD, RR, RS, CLIENT, CLUSTER, ID, AS4, ADVERTISE,
|
SOURCE, ADDRESS, PASSWORD, RR, RS, CLIENT, CLUSTER, ID, AS4, ADVERTISE,
|
||||||
IPV4, CAPABILITIES, LIMIT, PASSIVE, PREFER, OLDER, MISSING, LLADDR,
|
IPV4, CAPABILITIES, LIMIT, PASSIVE, PREFER, OLDER, MISSING, LLADDR,
|
||||||
DROP, IGNORE, ROUTE, REFRESH, INTERPRET, COMMUNITIES, BGP_ORIGINATOR_ID,
|
DROP, IGNORE, ROUTE, REFRESH, INTERPRET, COMMUNITIES,
|
||||||
BGP_CLUSTER_LIST, IGP, TABLE, GATEWAY, DIRECT, RECURSIVE, MED, TTL,
|
IGP, TABLE, GATEWAY, DIRECT, RECURSIVE, MED, TTL,
|
||||||
SECURITY, DETERMINISTIC, SECONDARY, ALLOW, BFD, ADD, PATHS, RX, TX,
|
SECURITY, DETERMINISTIC, SECONDARY, ALLOW, BFD, ADD, PATHS, RX, TX,
|
||||||
GRACEFUL, RESTART, AWARE, CHECK, LINK, PORT, EXTENDED, MESSAGES, SETKEY,
|
GRACEFUL, RESTART, AWARE, CHECK, LINK, PORT, EXTENDED, MESSAGES, SETKEY,
|
||||||
STRICT, BIND, CONFEDERATION, MEMBER, MULTICAST, FLOW4, FLOW6, LONG,
|
STRICT, BIND, CONFEDERATION, MEMBER, MULTICAST, FLOW4, FLOW6, LONG,
|
||||||
LIVED, STALE, IMPORT, IBGP, EBGP, MANDATORY, INTERNAL, EXTERNAL, SETS,
|
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)
|
FIRST, FREE, VALIDATE, BASE)
|
||||||
|
|
||||||
%type <i> bgp_nh
|
%type <i> bgp_nh
|
||||||
@ -44,6 +43,8 @@ CF_KEYWORDS(CEASE, PREFIX, LIMIT, HIT, ADMINISTRATIVE, SHUTDOWN, RESET, PEER,
|
|||||||
|
|
||||||
CF_GRAMMAR
|
CF_GRAMMAR
|
||||||
|
|
||||||
|
toksym: BGP_MED | BGP_LOCAL_PREF ;
|
||||||
|
|
||||||
proto: bgp_proto '}' ;
|
proto: bgp_proto '}' ;
|
||||||
|
|
||||||
bgp_proto_start: proto_start BGP {
|
bgp_proto_start: proto_start BGP {
|
||||||
|
@ -2476,9 +2476,9 @@ bgp_decode_nlri(struct bgp_parse_state *s, u32 afi, byte *nlri, uint len, ea_lis
|
|||||||
a = allocz(RTA_MAX_SIZE);
|
a = allocz(RTA_MAX_SIZE);
|
||||||
|
|
||||||
a->source = RTS_BGP;
|
a->source = RTS_BGP;
|
||||||
a->scope = SCOPE_UNIVERSE;
|
|
||||||
a->from = s->proto->remote_ip;
|
|
||||||
a->eattrs = ea;
|
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);
|
ea_set_attr_u32(&a->eattrs, &ea_gen_preference, 0, c->c.preference);
|
||||||
|
|
||||||
c->desc->decode_next_hop(s, nh, nh_len, a);
|
c->desc->decode_next_hop(s, nh, nh_len, a);
|
||||||
|
@ -190,7 +190,7 @@ ospf_check_auth(void)
|
|||||||
|
|
||||||
CF_DECLS
|
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(AREA, NEIGHBORS, RFC1583COMPAT, STUB, TICK, COST, COST2, RETRANSMIT)
|
||||||
CF_KEYWORDS(HELLO, TRANSMIT, PRIORITY, DEAD, TYPE, BROADCAST, BCAST, DEFAULT)
|
CF_KEYWORDS(HELLO, TRANSMIT, PRIORITY, DEAD, TYPE, BROADCAST, BCAST, DEFAULT)
|
||||||
CF_KEYWORDS(NONBROADCAST, NBMA, POINTOPOINT, PTP, POINTOMULTIPOINT, PTMP)
|
CF_KEYWORDS(NONBROADCAST, NBMA, POINTOPOINT, PTP, POINTOMULTIPOINT, PTMP)
|
||||||
|
@ -2054,7 +2054,6 @@ again1:
|
|||||||
{
|
{
|
||||||
rta a0 = {
|
rta a0 = {
|
||||||
.source = nf->n.type,
|
.source = nf->n.type,
|
||||||
.scope = SCOPE_UNIVERSE,
|
|
||||||
.dest = RTD_UNICAST,
|
.dest = RTD_UNICAST,
|
||||||
.nh = *(nf->n.nhs),
|
.nh = *(nf->n.nhs),
|
||||||
};
|
};
|
||||||
|
@ -144,7 +144,6 @@ perf_loop(void *data)
|
|||||||
if (!p->attrs_per_rte || !(i % p->attrs_per_rte)) {
|
if (!p->attrs_per_rte || !(i % p->attrs_per_rte)) {
|
||||||
struct rta a0 = {
|
struct rta a0 = {
|
||||||
.source = RTS_PERF,
|
.source = RTS_PERF,
|
||||||
.scope = SCOPE_UNIVERSE,
|
|
||||||
.dest = RTD_UNICAST,
|
.dest = RTD_UNICAST,
|
||||||
.nh.iface = p->ifa->iface,
|
.nh.iface = p->ifa->iface,
|
||||||
.nh.gw = gw,
|
.nh.gw = gw,
|
||||||
|
@ -33,7 +33,7 @@ CF_KEYWORDS(RADV, PREFIX, INTERFACE, MIN, MAX, RA, DELAY, INTERVAL, SOLICITED,
|
|||||||
RETRANS, TIMER, CURRENT, HOP, LIMIT, DEFAULT, VALID, PREFERRED, MULT,
|
RETRANS, TIMER, CURRENT, HOP, LIMIT, DEFAULT, VALID, PREFERRED, MULT,
|
||||||
LIFETIME, SKIP, ONLINK, AUTONOMOUS, RDNSS, DNSSL, NS, DOMAIN, LOCAL,
|
LIFETIME, SKIP, ONLINK, AUTONOMOUS, RDNSS, DNSSL, NS, DOMAIN, LOCAL,
|
||||||
TRIGGER, SENSITIVE, PREFERENCE, LOW, MEDIUM, HIGH, PROPAGATE, ROUTE,
|
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)
|
CF_ENUM(T_ENUM_RA_PREFERENCE, RA_PREF_, LOW, MEDIUM, HIGH)
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ CF_KEYWORDS(RIP, NG, ECMP, LIMIT, WEIGHT, INFINITY, METRIC, UPDATE, TIMEOUT,
|
|||||||
PASSIVE, VERSION, SPLIT, HORIZON, POISON, REVERSE, CHECK, ZERO,
|
PASSIVE, VERSION, SPLIT, HORIZON, POISON, REVERSE, CHECK, ZERO,
|
||||||
TIME, BFD, AUTHENTICATION, NONE, PLAINTEXT, CRYPTOGRAPHIC, MD5,
|
TIME, BFD, AUTHENTICATION, NONE, PLAINTEXT, CRYPTOGRAPHIC, MD5,
|
||||||
TTL, SECURITY, RX, TX, BUFFER, LENGTH, PRIORITY, ONLY, LINK,
|
TTL, SECURITY, RX, TX, BUFFER, LENGTH, PRIORITY, ONLY, LINK,
|
||||||
DEMAND, CIRCUIT, RIP_METRIC, RIP_TAG)
|
DEMAND, CIRCUIT)
|
||||||
|
|
||||||
%type <i> rip_variant rip_auth
|
%type <i> rip_variant rip_auth
|
||||||
|
|
||||||
|
@ -153,11 +153,21 @@ rip_announce_rte(struct rip_proto *p, struct rip_entry *en)
|
|||||||
/* Update */
|
/* Update */
|
||||||
rta a0 = {
|
rta a0 = {
|
||||||
.source = RTS_RIP,
|
.source = RTS_RIP,
|
||||||
.scope = SCOPE_UNIVERSE,
|
|
||||||
.dest = RTD_UNICAST,
|
.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;
|
u16 rt_tag = rt->tag;
|
||||||
|
|
||||||
if (p->ecmp)
|
if (p->ecmp)
|
||||||
@ -189,30 +199,19 @@ rip_announce_rte(struct rip_proto *p, struct rip_entry *en)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Unipath route */
|
/* Unipath route */
|
||||||
a0.from = rt->from->nbr->addr;
|
|
||||||
a0.nh.gw = rt->next_hop;
|
a0.nh.gw = rt->next_hop;
|
||||||
a0.nh.iface = rt->from->ifa->iface;
|
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_set_attr_u32(&a0.eattrs, &ea_rip_tag, 0, rt_tag);
|
||||||
ea_list l;
|
|
||||||
eattr a[4];
|
struct rip_iface_adata riad = {
|
||||||
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) },
|
.ad = { .length = sizeof(struct rip_iface_adata) - sizeof(struct adata) },
|
||||||
.iface = a0.nh.iface,
|
.iface = a0.nh.iface,
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
ea_set_attr(&a0.eattrs,
|
||||||
a0.eattrs = &ea_block.l;
|
EA_LITERAL_DIRECT_ADATA(&ea_rip_from, 0, &riad.ad));
|
||||||
|
|
||||||
rte e0 = {
|
rte e0 = {
|
||||||
.attrs = &a0,
|
.attrs = &a0,
|
||||||
|
@ -122,7 +122,6 @@ rpki_table_add_roa(struct rpki_cache *cache, struct channel *channel, const net_
|
|||||||
|
|
||||||
rta a0 = {
|
rta a0 = {
|
||||||
.source = RTS_RPKI,
|
.source = RTS_RPKI,
|
||||||
.scope = SCOPE_UNIVERSE,
|
|
||||||
.dest = RTD_NONE,
|
.dest = RTD_NONE,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -56,7 +56,6 @@ static_announce_rte(struct static_proto *p, struct static_route *r)
|
|||||||
rta *a = allocz(RTA_MAX_SIZE);
|
rta *a = allocz(RTA_MAX_SIZE);
|
||||||
struct rte_src *src = static_get_source(p, r->index);
|
struct rte_src *src = static_get_source(p, r->index);
|
||||||
a->source = RTS_STATIC;
|
a->source = RTS_STATIC;
|
||||||
a->scope = SCOPE_UNIVERSE;
|
|
||||||
a->dest = r->dest;
|
a->dest = r->dest;
|
||||||
ea_set_attr_u32(&a->eattrs, &ea_gen_preference, 0, p->p.main_channel->preference);
|
ea_set_attr_u32(&a->eattrs, &ea_gen_preference, 0, p->p.main_channel->preference);
|
||||||
|
|
||||||
|
@ -519,7 +519,6 @@ krt_read_route(struct ks_msg *msg, struct krt_proto *p, int scan)
|
|||||||
|
|
||||||
rta a = {
|
rta a = {
|
||||||
.source = RTS_INHERIT,
|
.source = RTS_INHERIT,
|
||||||
.scope = SCOPE_UNIVERSE,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* reject/blackhole routes have also set RTF_GATEWAY,
|
/* reject/blackhole routes have also set RTF_GATEWAY,
|
||||||
|
@ -11,9 +11,6 @@ CF_HDR
|
|||||||
CF_DECLS
|
CF_DECLS
|
||||||
|
|
||||||
CF_KEYWORDS(KERNEL, TABLE, METRIC, NETLINK, RX, BUFFER,
|
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_MTU, KRT_LOCK_WINDOW, KRT_LOCK_RTT, KRT_LOCK_RTTVAR,
|
||||||
KRT_LOCK_SSTRESH, KRT_LOCK_CWND, KRT_LOCK_ADVMSS, KRT_LOCK_REORDERING,
|
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)
|
KRT_LOCK_HOPLIMIT, KRT_LOCK_RTO_MIN, KRT_FEATURE_ECN, KRT_FEATURE_ALLFRAG)
|
||||||
|
@ -1854,7 +1854,6 @@ nl_parse_route(struct nl_parse_state *s, struct nlmsghdr *h)
|
|||||||
|
|
||||||
rta *ra = lp_allocz(s->pool, RTA_MAX_SIZE);
|
rta *ra = lp_allocz(s->pool, RTA_MAX_SIZE);
|
||||||
ra->source = RTS_INHERIT;
|
ra->source = RTS_INHERIT;
|
||||||
ra->scope = SCOPE_UNIVERSE;
|
|
||||||
|
|
||||||
if (a[RTA_FLOW])
|
if (a[RTA_FLOW])
|
||||||
s->rta_flow = rta_get_u32(a[RTA_FLOW]);
|
s->rta_flow = rta_get_u32(a[RTA_FLOW]);
|
||||||
|
@ -29,7 +29,7 @@ kif_set_preferred(ip_addr ip)
|
|||||||
|
|
||||||
CF_DECLS
|
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)
|
CF_KEYWORDS(INTERFACE, PREFERRED)
|
||||||
|
|
||||||
%type <i> kern_mp_limit
|
%type <i> kern_mp_limit
|
||||||
|
Loading…
Reference in New Issue
Block a user