1999-01-15 16:49:17 +00:00
|
|
|
/*
|
|
|
|
* Filters: utility functions
|
|
|
|
*
|
|
|
|
* Copyright 1998 Pavel Machek <pavel@ucw.cz>
|
|
|
|
*
|
|
|
|
* Can be freely distributed and used under the terms of the GNU GPL.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <sys/signal.h>
|
1999-03-17 10:19:07 +00:00
|
|
|
#include <setjmp.h>
|
1999-01-15 16:49:17 +00:00
|
|
|
|
|
|
|
#include "nest/bird.h"
|
|
|
|
#include "lib/lists.h"
|
|
|
|
#include "lib/resource.h"
|
|
|
|
#include "lib/socket.h"
|
|
|
|
#include "nest/route.h"
|
|
|
|
#include "nest/protocol.h"
|
|
|
|
#include "nest/iface.h"
|
|
|
|
#include "conf/conf.h"
|
|
|
|
#include "filter/filter.h"
|
|
|
|
|
1999-03-08 20:30:06 +00:00
|
|
|
struct f_inst *
|
1999-03-02 19:49:28 +00:00
|
|
|
f_new_inst(void)
|
|
|
|
{
|
1999-03-08 20:30:06 +00:00
|
|
|
struct f_inst * ret;
|
|
|
|
ret = cfg_alloc(sizeof(struct f_inst));
|
1999-11-18 14:01:36 +00:00
|
|
|
ret->code = ret->aux = 0;
|
1999-03-02 19:49:28 +00:00
|
|
|
ret->arg1 = ret->arg2 = ret->next = NULL;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2000-03-01 11:32:23 +00:00
|
|
|
struct f_inst *
|
2000-03-01 14:42:59 +00:00
|
|
|
f_new_dynamic_attr(int type, int code)
|
2000-03-01 11:32:23 +00:00
|
|
|
{
|
|
|
|
struct f_inst *f = f_new_inst();
|
2000-03-01 14:42:59 +00:00
|
|
|
f->aux = type;
|
2000-03-01 11:32:23 +00:00
|
|
|
f->a2.i = code;
|
|
|
|
return f;
|
|
|
|
}
|
|
|
|
|
1999-04-05 20:10:31 +00:00
|
|
|
char *
|
|
|
|
filter_name(struct filter *filter)
|
|
|
|
{
|
|
|
|
if (!filter)
|
|
|
|
return "ACCEPT";
|
|
|
|
else if (filter == FILTER_REJECT)
|
|
|
|
return "REJECT";
|
|
|
|
else
|
|
|
|
return filter->name;
|
|
|
|
}
|