mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-12-22 09:41:54 +00:00
Uninitialized filter variables of path/[el]?clist types are now explicitly empty
This commit is contained in:
parent
6f798683a3
commit
39f8f46d81
@ -225,34 +225,22 @@ f_new_lc_item(u32 f1, u32 t1, u32 f2, u32 t2, u32 f3, u32 t3)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline struct f_inst *
|
static inline struct f_inst *
|
||||||
f_const_empty(struct f_dynamic_attr dyn)
|
f_const_empty(enum f_type t)
|
||||||
{
|
{
|
||||||
struct f_val empty;
|
switch (t) {
|
||||||
|
case T_PATH:
|
||||||
switch (dyn.type) {
|
case T_CLIST:
|
||||||
case EAF_TYPE_AS_PATH:
|
case T_ECLIST:
|
||||||
case EAF_TYPE_INT_SET:
|
case T_LCLIST:
|
||||||
case EAF_TYPE_EC_SET:
|
return f_new_inst(FI_CONSTANT, (struct f_val) {
|
||||||
case EAF_TYPE_LC_SET:
|
.type = t,
|
||||||
empty = (struct f_val) {
|
|
||||||
.type = dyn.f_type,
|
|
||||||
.val.ad = &null_adata,
|
.val.ad = &null_adata,
|
||||||
};
|
});
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
cf_error("Can't empty that attribute");
|
return f_new_inst(FI_CONSTANT, (struct f_val) {});
|
||||||
}
|
}
|
||||||
|
|
||||||
return f_new_inst(FI_CONSTANT, empty);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define f_dummy_dynattr(_type, _f_type) ((struct f_dynamic_attr) { .type = _type, .f_type = _f_type, })
|
|
||||||
|
|
||||||
#define f_const_empty_path f_const_empty(f_dummy_dynattr(EAF_TYPE_AS_PATH, T_PATH))
|
|
||||||
#define f_const_empty_clist f_const_empty(f_dummy_dynattr(EAF_TYPE_INT_SET, T_CLIST))
|
|
||||||
#define f_const_empty_eclist f_const_empty(f_dummy_dynattr(EAF_TYPE_EC_SET, T_ECLIST))
|
|
||||||
#define f_const_empty_lclist f_const_empty(f_dummy_dynattr(EAF_TYPE_LC_SET, T_LCLIST))
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Remove all new lines and doubled whitespaces
|
* Remove all new lines and doubled whitespaces
|
||||||
* and convert all tabulators to spaces
|
* and convert all tabulators to spaces
|
||||||
@ -884,7 +872,7 @@ method_term:
|
|||||||
;
|
;
|
||||||
|
|
||||||
method_cmd:
|
method_cmd:
|
||||||
EMPTY { $$ = f_const_empty(FM.object->i_FI_EA_GET.da); }
|
EMPTY { $$ = f_const_empty(FM.object->i_FI_EA_GET.da.f_type); }
|
||||||
| PREPEND '(' term ')' { $$ = f_new_inst(FI_PATH_PREPEND, FM.object, $3 ); }
|
| PREPEND '(' term ')' { $$ = f_new_inst(FI_PATH_PREPEND, FM.object, $3 ); }
|
||||||
| ADD '(' term ')' { $$ = f_new_inst(FI_CLIST_ADD, FM.object, $3 ); }
|
| ADD '(' term ')' { $$ = f_new_inst(FI_CLIST_ADD, FM.object, $3 ); }
|
||||||
| DELETE '(' term ')' { $$ = f_new_inst(FI_CLIST_DEL, FM.object, $3 ); }
|
| DELETE '(' term ')' { $$ = f_new_inst(FI_CLIST_DEL, FM.object, $3 ); }
|
||||||
@ -925,10 +913,10 @@ term:
|
|||||||
$$ = $4;
|
$$ = $4;
|
||||||
}
|
}
|
||||||
|
|
||||||
| '+' EMPTY '+' { $$ = f_const_empty_path; }
|
| '+' EMPTY '+' { $$ = f_const_empty(T_PATH); }
|
||||||
| '-' EMPTY '-' { $$ = f_const_empty_clist; }
|
| '-' EMPTY '-' { $$ = f_const_empty(T_CLIST); }
|
||||||
| '-' '-' EMPTY '-' '-' { $$ = f_const_empty_eclist; }
|
| '-' '-' EMPTY '-' '-' { $$ = f_const_empty(T_ECLIST); }
|
||||||
| '-' '-' '-' EMPTY '-' '-' '-' { $$ = f_const_empty_lclist; }
|
| '-' '-' '-' EMPTY '-' '-' '-' { $$ = f_const_empty(T_LCLIST); }
|
||||||
| PREPEND '(' term ',' term ')' { $$ = f_new_inst(FI_PATH_PREPEND, $3, $5); }
|
| PREPEND '(' term ',' term ')' { $$ = f_new_inst(FI_PATH_PREPEND, $3, $5); }
|
||||||
| ADD '(' term ',' term ')' { $$ = f_new_inst(FI_CLIST_ADD, $3, $5); }
|
| ADD '(' term ',' term ')' { $$ = f_new_inst(FI_CLIST_ADD, $3, $5); }
|
||||||
| DELETE '(' term ',' term ')' { $$ = f_new_inst(FI_CLIST_DEL, $3, $5); }
|
| DELETE '(' term ',' term ')' { $$ = f_new_inst(FI_CLIST_DEL, $3, $5); }
|
||||||
|
Loading…
Reference in New Issue
Block a user