mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-12-22 09:41:54 +00:00
Several filter changes. (Pavel, please check if they are OK.)
o Changed parameters of f_run. Changed rtein+rteout pair to rte pointer passed by reference, added ea_list of temporary attrs again passed by reference and finally added a pointer to memory pool for storing temporary data (new ea_lists's, temporary rta's etc.). o Re-ordered result codes, so that all accepts come before all rejects. o Introduced FILTER_ACCEPT and FILTER_REJECT dummy values (will be used in protocol configurations). o Added filter_name() which returns name of a filter or ACCEPT/REJECT for the dummies.
This commit is contained in:
parent
d4ff748224
commit
63a381dbf5
@ -146,7 +146,7 @@ f_new_inst(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
f_run(struct filter *filter, struct rte *rtein, struct rte **rteout)
|
f_run(struct filter *filter, struct rte **rte, struct ea_list **tmp_attrs, struct linpool *tmp_pool)
|
||||||
{
|
{
|
||||||
struct f_inst *inst;
|
struct f_inst *inst;
|
||||||
struct f_val res;
|
struct f_val res;
|
||||||
@ -160,6 +160,17 @@ f_run(struct filter *filter, struct rte *rtein, struct rte **rteout)
|
|||||||
return res.val.i;
|
return res.val.i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *
|
||||||
|
filter_name(struct filter *filter)
|
||||||
|
{
|
||||||
|
if (!filter)
|
||||||
|
return "ACCEPT";
|
||||||
|
else if (filter == FILTER_REJECT)
|
||||||
|
return "REJECT";
|
||||||
|
else
|
||||||
|
return filter->name;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
filters_postconfig(void)
|
filters_postconfig(void)
|
||||||
{
|
{
|
||||||
|
@ -32,14 +32,18 @@ struct filter {
|
|||||||
void filters_postconfig(void);
|
void filters_postconfig(void);
|
||||||
struct f_inst *f_new_inst(void);
|
struct f_inst *f_new_inst(void);
|
||||||
|
|
||||||
int f_run(struct filter *filter, struct rte *rtein, struct rte **rteout);
|
int f_run(struct filter *filter, struct rte **rte, struct ea_list **tmp_attrs, struct linpool *tmp_pool);
|
||||||
|
char *filter_name(struct filter *filter);
|
||||||
|
|
||||||
#define F_ACCEPT 1
|
#define F_ACCEPT 1 /* Need to preserve ordering: accepts < rejects! */
|
||||||
#define F_REJECT 2
|
#define F_MODIFY 2 /* FIXME: Introduce modification flags instead? */
|
||||||
#define F_MODIFY 3
|
#define F_REJECT 3
|
||||||
#define F_ERROR 4
|
#define F_ERROR 4
|
||||||
#define F_QUITBIRD 5
|
#define F_QUITBIRD 5
|
||||||
|
|
||||||
|
#define FILTER_ACCEPT NULL
|
||||||
|
#define FILTER_REJECT ((void *) 1)
|
||||||
|
|
||||||
/* Type numbers must be in 0..0xff range */
|
/* Type numbers must be in 0..0xff range */
|
||||||
#define T_MASK 0xff
|
#define T_MASK 0xff
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user