Commit 0858666b authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Use RTPROT_BABEL_LOCAL throughout.

parent e66658b0
...@@ -32,6 +32,8 @@ THE SOFTWARE. ...@@ -32,6 +32,8 @@ THE SOFTWARE.
#define RTPROT_BABEL 42 #define RTPROT_BABEL 42
#endif #endif
#define RTPROT_BABEL_LOCAL -2
#undef MAX #undef MAX
#undef MIN #undef MIN
......
...@@ -217,7 +217,7 @@ parse_filter(gnc_t gnc, void *closure) ...@@ -217,7 +217,7 @@ parse_filter(gnc_t gnc, void *closure)
goto error; goto error;
filter->proto = proto; filter->proto = proto;
} else if(strcmp(token, "local") == 0) { } else if(strcmp(token, "local") == 0) {
filter->proto = PROTO_LOCAL; filter->proto = RTPROT_BABEL_LOCAL;
} else if(strcmp(token, "if") == 0) { } else if(strcmp(token, "if") == 0) {
char *interface; char *interface;
c = getword(c, &interface, gnc, closure); c = getword(c, &interface, gnc, closure);
...@@ -422,7 +422,7 @@ filter_match(struct filter *f, const unsigned char *id, ...@@ -422,7 +422,7 @@ filter_match(struct filter *f, const unsigned char *id,
if(f->proto) { if(f->proto) {
if(!proto || f->proto != proto) if(!proto || f->proto != proto)
return 0; return 0;
} else if(proto == PROTO_LOCAL) { } else if(proto == RTPROT_BABEL_LOCAL) {
return 0; return 0;
} }
return 1; return 1;
......
...@@ -22,8 +22,6 @@ THE SOFTWARE. ...@@ -22,8 +22,6 @@ THE SOFTWARE.
#define METRIC_INHERIT (INFINITY + 1) #define METRIC_INHERIT (INFINITY + 1)
#define PROTO_LOCAL -2
struct filter { struct filter {
int af; int af;
char *ifname; char *ifname;
......
...@@ -24,8 +24,6 @@ THE SOFTWARE. ...@@ -24,8 +24,6 @@ THE SOFTWARE.
#define KERNEL_INFINITY 0xFFFF #define KERNEL_INFINITY 0xFFFF
#define RTPROTO_BABEL_LOCAL 257
struct kernel_route { struct kernel_route {
unsigned char prefix[16]; unsigned char prefix[16];
int plen; int plen;
......
...@@ -1101,7 +1101,7 @@ filter_addresses(struct nlmsghdr *nh, void *data) ...@@ -1101,7 +1101,7 @@ filter_addresses(struct nlmsghdr *nh, void *data)
route->plen = 128; route->plen = 128;
route->metric = 0; route->metric = 0;
route->ifindex = ifa->ifa_index; route->ifindex = ifa->ifa_index;
route->proto = RTPROTO_BABEL_LOCAL; route->proto = RTPROT_BABEL_LOCAL;
memset(route->gw, 0, 16); memset(route->gw, 0, 16);
*found = (*found)+1; *found = (*found)+1;
} }
......
...@@ -134,7 +134,8 @@ check_xroutes() ...@@ -134,7 +134,8 @@ check_xroutes()
export = 1; export = 1;
} else if(xroutes[i].kind == XROUTE_LOCAL) { } else if(xroutes[i].kind == XROUTE_LOCAL) {
metric = redistribute_filter(xroutes[i].prefix, xroutes[i].plen, metric = redistribute_filter(xroutes[i].prefix, xroutes[i].plen,
xroutes[i].ifindex, PROTO_LOCAL); xroutes[i].ifindex,
RTPROT_BABEL_LOCAL);
if(metric == METRIC_INHERIT) if(metric == METRIC_INHERIT)
metric = 0; metric = 0;
if(metric < INFINITY && metric == xroutes[i].metric) { if(metric < INFINITY && metric == xroutes[i].metric) {
...@@ -187,13 +188,13 @@ check_xroutes() ...@@ -187,13 +188,13 @@ check_xroutes()
if(martian_prefix(addresses[i].prefix, addresses[i].plen)) if(martian_prefix(addresses[i].prefix, addresses[i].plen))
continue; continue;
metric = redistribute_filter(addresses[i].prefix, addresses[i].plen, metric = redistribute_filter(addresses[i].prefix, addresses[i].plen,
addresses[i].ifindex, PROTO_LOCAL); addresses[i].ifindex, RTPROT_BABEL_LOCAL);
if(metric == METRIC_INHERIT) if(metric == METRIC_INHERIT)
metric = 0; metric = 0;
if(metric < INFINITY) { if(metric < INFINITY) {
rc = add_xroute(XROUTE_LOCAL, rc = add_xroute(XROUTE_LOCAL,
addresses[i].prefix, addresses[i].plen, addresses[i].prefix, addresses[i].plen,
0, addresses[i].ifindex, PROTO_LOCAL); 0, addresses[i].ifindex, RTPROT_BABEL_LOCAL);
if(rc) if(rc)
change = 1; change = 1;
} }
......
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