Commit 740e8228 authored by Matthieu Boutier's avatar Matthieu Boutier Committed by Juliusz Chroboczek

Filter: Rename "result" to "add_metric".

The field "result" is in fact an additional cost.
parent 2c93a100
...@@ -346,16 +346,16 @@ parse_filter(int c, gnc_t gnc, void *closure, struct filter **filter_return) ...@@ -346,16 +346,16 @@ parse_filter(int c, gnc_t gnc, void *closure, struct filter **filter_return)
filter->ifname = interface; filter->ifname = interface;
filter->ifindex = if_nametoindex(interface); filter->ifindex = if_nametoindex(interface);
} else if(strcmp(token, "allow") == 0) { } else if(strcmp(token, "allow") == 0) {
filter->result = 0; filter->add_metric = 0;
} else if(strcmp(token, "deny") == 0) { } else if(strcmp(token, "deny") == 0) {
filter->result = INFINITY; filter->add_metric = INFINITY;
} else if(strcmp(token, "metric") == 0) { } else if(strcmp(token, "metric") == 0) {
int metric; int metric;
c = getint(c, &metric, gnc, closure); c = getint(c, &metric, gnc, closure);
if(c < -1) goto error; if(c < -1) goto error;
if(metric <= 0 || metric > INFINITY) if(metric <= 0 || metric > INFINITY)
goto error; goto error;
filter->result = metric; filter->add_metric = metric;
} else { } else {
goto error; goto error;
} }
...@@ -929,7 +929,7 @@ do_filter(struct filter *f, const unsigned char *id, ...@@ -929,7 +929,7 @@ do_filter(struct filter *f, const unsigned char *id,
{ {
while(f) { while(f) {
if(filter_match(f, id, prefix, plen, neigh, ifindex, proto)) if(filter_match(f, id, prefix, plen, neigh, ifindex, proto))
return f->result; return f->add_metric;
f = f->next; f = f->next;
} }
return -1; return -1;
......
...@@ -30,7 +30,7 @@ struct filter { ...@@ -30,7 +30,7 @@ struct filter {
unsigned char plen_ge, plen_le; unsigned char plen_ge, plen_le;
unsigned char *neigh; unsigned char *neigh;
int proto; /* May be negative */ int proto; /* May be negative */
unsigned int result; unsigned int add_metric;
struct filter *next; struct filter *next;
}; };
......
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