Commit 63a381db authored by Martin Mareš's avatar Martin Mareš
Browse files

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.
parent d4ff7482
......@@ -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)
{
......
......@@ -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
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment