mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-12-22 17:51:53 +00:00
Merge commit 'a5a6de58' into thread-next
Conflicts: filter/config.Y filter/data.h filter/data.c
This commit is contained in:
commit
c4bcded8b9
@ -207,11 +207,11 @@ f_generate_empty(const struct symbol *sym)
|
||||
cf_error("Can't empty %s: not an attribute", sym->name);
|
||||
|
||||
const struct ea_class *def = sym->attribute;
|
||||
const struct f_val *empty = f_get_empty(def->type);
|
||||
if (!empty)
|
||||
const struct f_val empty = f_get_empty(def->type);
|
||||
if (empty.type == T_VOID)
|
||||
cf_error("Can't empty attribute %s", def->name);
|
||||
|
||||
return f_new_inst(FI_EA_SET, f_new_inst(FI_CONSTANT, *empty), def);
|
||||
return f_new_inst(FI_EA_SET, f_new_inst(FI_CONSTANT, empty), def);
|
||||
}
|
||||
|
||||
static inline struct f_inst *
|
||||
@ -875,10 +875,10 @@ term:
|
||||
| dynamic_attr '.' RESET{ }
|
||||
*/
|
||||
|
||||
| '+' EMPTY '+' { $$ = f_new_inst(FI_CONSTANT, f_const_empty_path); }
|
||||
| '-' EMPTY '-' { $$ = f_new_inst(FI_CONSTANT, f_const_empty_clist); }
|
||||
| '-' '-' EMPTY '-' '-' { $$ = f_new_inst(FI_CONSTANT, f_const_empty_eclist); }
|
||||
| '-' '-' '-' EMPTY '-' '-' '-' { $$ = f_new_inst(FI_CONSTANT, f_const_empty_lclist); }
|
||||
| '+' EMPTY '+' { $$ = f_new_inst(FI_CONSTANT, f_get_empty(T_PATH)); }
|
||||
| '-' EMPTY '-' { $$ = f_new_inst(FI_CONSTANT, f_get_empty(T_CLIST)); }
|
||||
| '-' '-' EMPTY '-' '-' { $$ = f_new_inst(FI_CONSTANT, f_get_empty(T_ECLIST)); }
|
||||
| '-' '-' '-' EMPTY '-' '-' '-' { $$ = f_new_inst(FI_CONSTANT, f_get_empty(T_LCLIST)); }
|
||||
| PREPEND '(' term ',' term ')' { $$ = f_new_inst(FI_PATH_PREPEND, $3, $5); }
|
||||
| ADD '(' term ',' term ')' { $$ = f_new_inst(FI_CLIST_ADD, $3, $5); }
|
||||
| DELETE '(' term ',' term ')' { $$ = f_new_inst(FI_CLIST_DEL, $3, $5); }
|
||||
|
@ -81,20 +81,7 @@ f_type_element_type(btype t)
|
||||
}
|
||||
|
||||
const struct f_trie f_const_empty_trie = { .ipv4 = -1, };
|
||||
|
||||
const struct f_val f_const_empty_path = {
|
||||
.type = T_PATH,
|
||||
.val.ad = &null_adata,
|
||||
}, f_const_empty_clist = {
|
||||
.type = T_CLIST,
|
||||
.val.ad = &null_adata,
|
||||
}, f_const_empty_eclist = {
|
||||
.type = T_ECLIST,
|
||||
.val.ad = &null_adata,
|
||||
}, f_const_empty_lclist = {
|
||||
.type = T_LCLIST,
|
||||
.val.ad = &null_adata,
|
||||
}, f_const_empty_prefix_set = {
|
||||
const struct f_val f_const_empty_prefix_set = {
|
||||
.type = T_PREFIX_SET,
|
||||
.val.ti = &f_const_empty_trie,
|
||||
};
|
||||
|
@ -242,15 +242,20 @@ undef_value(struct f_val v)
|
||||
(v.val.ad == &null_adata);
|
||||
}
|
||||
|
||||
extern const struct f_val f_const_empty_path, f_const_empty_clist, f_const_empty_eclist, f_const_empty_lclist, f_const_empty_prefix_set;
|
||||
static inline const struct f_val *f_get_empty(btype t)
|
||||
extern const struct f_val f_const_empty_prefix_set;
|
||||
static inline struct f_val f_get_empty(btype t)
|
||||
{
|
||||
switch (t) {
|
||||
case T_PATH: return &f_const_empty_path;
|
||||
case T_CLIST: return &f_const_empty_clist;
|
||||
case T_ECLIST: return &f_const_empty_eclist;
|
||||
case T_LCLIST: return &f_const_empty_lclist;
|
||||
default: return NULL;
|
||||
case T_PATH:
|
||||
case T_CLIST:
|
||||
case T_ECLIST:
|
||||
case T_LCLIST:
|
||||
return (struct f_val) {
|
||||
.type = t,
|
||||
.val.ad = &null_adata,
|
||||
};
|
||||
default:
|
||||
return (struct f_val) { .type = T_VOID };
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -873,7 +873,7 @@
|
||||
ACCESS_RTE;
|
||||
RESULT_TYPE(da->type);
|
||||
{
|
||||
const struct f_val *empty;
|
||||
struct f_val empty;
|
||||
const eattr *e = ea_find(fs->rte->attrs, da->id);
|
||||
|
||||
if (e)
|
||||
@ -891,8 +891,8 @@
|
||||
}]]);
|
||||
}
|
||||
}
|
||||
else if (empty = f_get_empty(da->type))
|
||||
RESULT_VAL(*empty);
|
||||
else if ((empty = f_get_empty(da->type)).type != T_VOID)
|
||||
RESULT_VAL(empty);
|
||||
else
|
||||
RESULT_VOID;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user