Commit 928a970f authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Simplify interface of input/output filter.

parent 0bffdbe3
......@@ -1005,6 +1005,7 @@ do_filter(struct filter *f, const unsigned char *id,
{
if(result)
memset(result, 0, sizeof(struct filter_result));
while(f) {
if(filter_match(f, id, prefix, plen, src_prefix, src_plen,
neigh, ifindex, proto)) {
......@@ -1014,6 +1015,7 @@ do_filter(struct filter *f, const unsigned char *id,
}
f = f->next;
}
return -1;
}
......@@ -1021,12 +1023,11 @@ int
input_filter(const unsigned char *id,
const unsigned char *prefix, unsigned short plen,
const unsigned char *src_prefix, unsigned short src_plen,
const unsigned char *neigh, unsigned int ifindex,
struct filter_result *result)
const unsigned char *neigh, unsigned int ifindex)
{
int res;
res = do_filter(input_filters, id, prefix, plen,
src_prefix, src_plen, neigh, ifindex, 0, result);
src_prefix, src_plen, neigh, ifindex, 0, NULL);
if(res < 0)
res = 0;
return res;
......@@ -1036,12 +1037,11 @@ int
output_filter(const unsigned char *id,
const unsigned char *prefix, unsigned short plen,
const unsigned char *src_prefix, unsigned short src_plen,
unsigned int ifindex,
struct filter_result *result)
unsigned int ifindex)
{
int res;
res = do_filter(output_filters, id, prefix, plen,
src_prefix, src_plen, NULL, ifindex, 0, result);
src_prefix, src_plen, NULL, ifindex, 0, NULL);
if(res < 0)
res = 0;
return res;
......
......@@ -52,13 +52,11 @@ void renumber_filters(void);
int input_filter(const unsigned char *id,
const unsigned char *prefix, unsigned short plen,
const unsigned char *src_prefix, unsigned short src_plen,
const unsigned char *neigh, unsigned int ifindex,
struct filter_result *result);
const unsigned char *neigh, unsigned int ifindex);
int output_filter(const unsigned char *id,
const unsigned char *prefix, unsigned short plen,
const unsigned char *src_prefix, unsigned short src_plen,
unsigned int ifindex,
struct filter_result *result);
unsigned int ifindex);
int redistribute_filter(const unsigned char *prefix, unsigned short plen,
const unsigned char *src_prefix, unsigned short src_plen,
unsigned int ifindex, int proto,
......
......@@ -1160,7 +1160,7 @@ really_send_update(struct interface *ifp,
return;
add_metric = output_filter(id, prefix, plen, src_prefix,
src_plen, ifp->ifindex, NULL);
src_plen, ifp->ifindex);
if(add_metric >= INFINITY)
return;
......
......@@ -97,11 +97,10 @@ record_resend(int kind, const unsigned char *prefix, unsigned char plen,
if((kind == RESEND_REQUEST &&
input_filter(NULL, prefix, plen, src_prefix, src_plen, NULL,
ifindex, NULL) >=
ifindex) >=
INFINITY) ||
(kind == RESEND_UPDATE &&
output_filter(NULL, prefix, plen, src_prefix, src_plen,
ifindex, NULL) >=
output_filter(NULL, prefix, plen, src_prefix, src_plen, ifindex) >=
INFINITY))
return 0;
......
......@@ -806,7 +806,7 @@ update_route_metric(struct babel_route *route)
route->src->src_prefix,
route->src->src_plen,
neigh->address,
neigh->ifp->ifindex, NULL);
neigh->ifp->ifindex);
change_route_metric(route, route->refmetric,
neighbour_cost(route->neigh), add_metric);
if(route_metric(route) != oldmetric ||
......@@ -889,8 +889,7 @@ update_route(const unsigned char *id,
add_metric = input_filter(id, prefix, plen, src_prefix, src_plen,
neigh->address, neigh->ifp->ifindex,
NULL);
neigh->address, neigh->ifp->ifindex);
if(add_metric >= INFINITY)
return NULL;
......
Markdown is supported
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