0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-11-09 12:48:43 +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:
Martin Mares 1999-04-05 20:10:31 +00:00
parent d4ff748224
commit 63a381dbf5
2 changed files with 20 additions and 5 deletions

View File

@ -146,7 +146,7 @@ f_new_inst(void)
}
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_val res;
@ -160,6 +160,17 @@ f_run(struct filter *filter, struct rte *rtein, struct rte **rteout)
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
filters_postconfig(void)
{

View File

@ -32,14 +32,18 @@ struct filter {
void filters_postconfig(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_REJECT 2
#define F_MODIFY 3
#define F_ACCEPT 1 /* Need to preserve ordering: accepts < rejects! */
#define F_MODIFY 2 /* FIXME: Introduce modification flags instead? */
#define F_REJECT 3
#define F_ERROR 4
#define F_QUITBIRD 5
#define FILTER_ACCEPT NULL
#define FILTER_REJECT ((void *) 1)
/* Type numbers must be in 0..0xff range */
#define T_MASK 0xff