diff options
author | Martin Mares <mj@ucw.cz> | 1999-04-05 20:10:31 +0000 |
---|---|---|
committer | Martin Mares <mj@ucw.cz> | 1999-04-05 20:10:31 +0000 |
commit | 63a381dbf5e37c2740982d07988cea983c699816 (patch) | |
tree | 594c69300bfd73f56cb5a4381324aa90d1166775 | |
parent | d4ff748224fc18e460e74ab14d70d01fd50e4b92 (diff) |
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.
-rw-r--r-- | filter/f-util.c | 13 | ||||
-rw-r--r-- | filter/filter.h | 12 |
2 files changed, 20 insertions, 5 deletions
diff --git a/filter/f-util.c b/filter/f-util.c index 12902df6..6605091e 100644 --- a/filter/f-util.c +++ b/filter/f-util.c @@ -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) { diff --git a/filter/filter.h b/filter/filter.h index ba8dc853..d8ee7efa 100644 --- a/filter/filter.h +++ b/filter/filter.h @@ -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 |