Commit 580257c7 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Fix handling of infinite results from install_filter.

parent 3af9f09d
...@@ -467,19 +467,24 @@ change_route(int operation, const struct babel_route *route, int metric, ...@@ -467,19 +467,24 @@ change_route(int operation, const struct babel_route *route, int metric,
int new_ifindex, int new_metric) int new_ifindex, int new_metric)
{ {
struct filter_result filter_result; struct filter_result filter_result;
unsigned char *pref_src = NULL;
unsigned int ifindex = route->neigh->ifp->ifindex; unsigned int ifindex = route->neigh->ifp->ifindex;
int m = install_filter(route->src->prefix, route->src->plen, int m = install_filter(route->src->prefix, route->src->plen,
route->src->src_prefix, route->src->src_plen, route->src->src_prefix, route->src->src_plen,
ifindex, &filter_result); ifindex, &filter_result);
if (m < INFINITY) if(m >= INFINITY) {
pref_src = filter_result.pref_src; if(operation == ROUTE_ADD)
return 0;
else if(operation == ROUTE_MODIFY) {
operation = ROUTE_FLUSH;
}
}
int table = filter_result.table ? filter_result.table : export_table; int table = filter_result.table ? filter_result.table : export_table;
return kernel_route(operation, table, route->src->prefix, route->src->plen, return kernel_route(operation, table, route->src->prefix, route->src->plen,
route->src->src_prefix, route->src->src_plen, pref_src, route->src->src_prefix, route->src->src_plen,
filter_result.pref_src,
route->nexthop, ifindex, route->nexthop, ifindex,
metric, new_next_hop, new_ifindex, new_metric, metric, new_next_hop, new_ifindex, new_metric,
operation == ROUTE_MODIFY ? table : 0); operation == ROUTE_MODIFY ? table : 0);
......
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