static struct babel_route *
insert_route(struct babel_route *route)
{
- int i, n;
+ int i, n = 0;
assert(!route->installed);
}
void
-flush_all_routes()
+flush_all_routes(void)
{
int i;
return;
if(!route_feasible(route))
- flog_err(BABEL_ERR_ROUTE, "WARNING: installing unfeasible route "
- "(this shouldn't happen).");
+ flog_err(EC_BABEL_ROUTE,
+ "Installing unfeasible route (this shouldn't happen).");
i = find_route_slot(route->src->prefix, route->src->plen, NULL);
assert(i >= 0 && i < route_slots);
if(routes[i] != route && routes[i]->installed) {
- flog_err(BABEL_ERR_ROUTE,
- "WARNING: attempting to install duplicate route "
- "(this shouldn't happen).");
- return;
+ flog_err(
+ EC_BABEL_ROUTE,
+ "Attempting to install duplicate route (this shouldn't happen).");
+ return;
}
rc = kernel_route(ROUTE_ADD, route->src->prefix, route->src->plen,
metric_to_kernel(route_metric(route)), NULL, 0, 0);
if(rc < 0) {
int save = errno;
- flog_err(BABEL_ERR_ROUTE, "kernel_route(ADD): %s",
+ flog_err(EC_BABEL_ROUTE, "kernel_route(ADD): %s",
safe_strerror(errno));
if(save != EEXIST)
return;
route->neigh->ifp->ifindex,
metric_to_kernel(route_metric(route)), NULL, 0, 0);
if(rc < 0)
- flog_err(BABEL_ERR_ROUTE, "kernel_route(FLUSH): %s",
+ flog_err(EC_BABEL_ROUTE, "kernel_route(FLUSH): %s",
safe_strerror(errno));
route->installed = 0;
return;
if(!route_feasible(new))
- flog_err(BABEL_ERR_ROUTE, "WARNING: switching to unfeasible route "
- "(this shouldn't happen).");
+ flog_err(EC_BABEL_ROUTE,
+ "Switching to unfeasible route (this shouldn't happen).");
rc = kernel_route(ROUTE_MODIFY, old->src->prefix, old->src->plen,
old->nexthop, old->neigh->ifp->ifindex,
new->nexthop, new->neigh->ifp->ifindex,
metric_to_kernel(route_metric(new)));
if(rc < 0) {
- flog_err(BABEL_ERR_ROUTE, "kernel_route(MODIFY): %s",
+ flog_err(EC_BABEL_ROUTE, "kernel_route(MODIFY): %s",
safe_strerror(errno));
return;
}
route->nexthop, route->neigh->ifp->ifindex,
new);
if(rc < 0) {
- flog_err(BABEL_ERR_ROUTE, "kernel_route(MODIFY metric): %s",
+ flog_err(EC_BABEL_ROUTE, "kernel_route(MODIFY metric): %s",
safe_strerror(errno));
return;
}
return NULL;
if(martian_prefix(prefix, plen)) {
- flog_err(BABEL_ERR_ROUTE, "Rejecting martian route to %s through %s.",
+ flog_err(EC_BABEL_ROUTE, "Rejecting martian route to %s through %s.",
format_prefix(prefix, plen), format_address(nexthop));
return NULL;
}
in a timely manner. If the source remains the same, we ignore
the update. */
if(!feasible && route->installed) {
- debugf(BABEL_DEBUG_COMMON,"Unfeasible update for installed route to %s "
- "(%s %d %d -> %s %d %d).",
+ debugf(BABEL_DEBUG_COMMON,"Unfeasible update for installed route to %s (%s %d %d -> %s %d %d).",
format_prefix(src->prefix, src->plen),
format_eui64(route->src->id),
route->seqno, route->refmetric,
route->next = NULL;
new_route = insert_route(route);
if(new_route == NULL) {
- flog_err(BABEL_ERR_ROUTE, "Couldn't insert route.");
+ flog_err(EC_BABEL_ROUTE, "Couldn't insert route.");
free(route);
return NULL;
}