Commit 2b757086 authored by Denis Ovsienko's avatar Denis Ovsienko Committed by Juliusz Chroboczek

Address FreeBSD "struct route" issue

FreeBSD system headers have their own "struct route", which made it
impossible to compile babeld. Switching babeld to "struct babel_route".
parent 6c86994e
......@@ -919,7 +919,7 @@ init_signals(void)
}
static void
dump_route_callback(struct route *route, void *closure)
dump_route_callback(struct babel_route *route, void *closure)
{
FILE *out = (FILE*)closure;
const unsigned char *nexthop =
......
......@@ -188,7 +188,7 @@ local_notify_xroute(struct xroute *xroute, int kind)
}
void
local_notify_route(struct route *route, int kind)
local_notify_route(struct babel_route *route, int kind)
{
char buf[512];
int rc;
......@@ -229,7 +229,7 @@ local_notify_xroute_callback(struct xroute *xroute, void *closure)
}
static void
local_notify_route_callback(struct route *route, void *closure)
local_notify_route_callback(struct babel_route *route, void *closure)
{
local_notify_route(route, LOCAL_ADD);
}
......
......@@ -21,7 +21,7 @@ THE SOFTWARE.
*/
struct neighbour;
struct route;
struct babel_route;
struct xroute;
#define LOCAL_FLUSH 0
......@@ -34,7 +34,7 @@ int local_read(int s);
void local_notify_self(void);
void local_notify_neighbour(struct neighbour *neigh, int kind);
void local_notify_xroute(struct xroute *xroute, int kind);
void local_notify_route(struct route *route, int kind);
void local_notify_route(struct babel_route *route, int kind);
void local_notify_all(void);
#else
......
......@@ -923,7 +923,7 @@ void
flushupdates(struct interface *ifp)
{
struct xroute *xroute;
struct route *route;
struct babel_route *route;
const unsigned char *last_prefix = NULL;
unsigned char last_plen = 0xFF;
int i;
......@@ -1090,7 +1090,7 @@ buffer_update(struct interface *ifp,
}
void
buffer_update_callback(struct route *route, void *closure)
buffer_update_callback(struct babel_route *route, void *closure)
{
buffer_update((struct interface*)closure,
route->src->prefix, route->src->plen);
......@@ -1102,7 +1102,7 @@ send_update(struct interface *ifp, int urgent,
{
if(ifp == NULL) {
struct interface *ifp_aux;
struct route *route;
struct babel_route *route;
FOR_ALL_INTERFACES(ifp_aux)
send_update(ifp_aux, urgent, prefix, plen);
if(prefix) {
......@@ -1460,7 +1460,7 @@ handle_request(struct neighbour *neigh, const unsigned char *prefix,
unsigned short seqno, const unsigned char *id)
{
struct xroute *xroute;
struct route *route;
struct babel_route *route;
struct neighbour *successor = NULL;
xroute = find_xroute(prefix, plen);
......@@ -1506,7 +1506,7 @@ handle_request(struct neighbour *neigh, const unsigned char *prefix,
if(!successor || successor == neigh) {
/* We were about to forward a request to its requestor. Try to
find a different neighbour to forward the request to. */
struct route *other_route;
struct babel_route *other_route;
other_route = find_best_route(prefix, plen, 0, neigh);
if(other_route && route_metric(other_route) < INFINITY)
......
This diff is collapsed.
......@@ -27,7 +27,7 @@ THE SOFTWARE.
#define DIVERSITY_HOPS 8
struct route {
struct babel_route {
struct source *src;
unsigned short refmetric;
unsigned short cost;
......@@ -39,23 +39,23 @@ struct route {
unsigned short hold_time; /* in seconds */
short installed;
unsigned char channels[DIVERSITY_HOPS];
struct route *next;
struct babel_route *next;
};
extern struct route **routes;
extern struct babel_route **routes;
extern int kernel_metric, allow_duplicates;
extern int diversity_kind, diversity_factor;
extern int keep_unfeasible;
static inline int
route_metric(const struct route *route)
route_metric(const struct babel_route *route)
{
int m = (int)route->refmetric + route->cost + route->add_metric;
return MIN(m, INFINITY);
}
static inline int
route_metric_noninterfering(const struct route *route)
route_metric_noninterfering(const struct babel_route *route)
{
int m =
(int)route->refmetric +
......@@ -65,34 +65,34 @@ route_metric_noninterfering(const struct route *route)
return MIN(m, INFINITY);
}
struct route *find_route(const unsigned char *prefix, unsigned char plen,
struct babel_route *find_route(const unsigned char *prefix, unsigned char plen,
struct neighbour *neigh, const unsigned char *nexthop);
struct route *find_installed_route(const unsigned char *prefix,
struct babel_route *find_installed_route(const unsigned char *prefix,
unsigned char plen);
int installed_routes_estimate(void);
void flush_route(struct route *route);
void flush_route(struct babel_route *route);
void flush_all_routes(void);
void flush_neighbour_routes(struct neighbour *neigh);
void flush_interface_routes(struct interface *ifp, int v4only);
void for_all_routes(void (*f)(struct route*, void*), void *closure);
void for_all_installed_routes(void (*f)(struct route*, void*), void *closure);
void install_route(struct route *route);
void uninstall_route(struct route *route);
void switch_route(struct route *old, struct route *new);
int route_feasible(struct route *route);
int route_old(struct route *route);
int route_expired(struct route *route);
int route_interferes(struct route *route, struct interface *ifp);
void for_all_routes(void (*f)(struct babel_route*, void*), void *closure);
void for_all_installed_routes(void (*f)(struct babel_route*, void*), void *closure);
void install_route(struct babel_route *route);
void uninstall_route(struct babel_route *route);
void switch_route(struct babel_route *old, struct babel_route *new);
int route_feasible(struct babel_route *route);
int route_old(struct babel_route *route);
int route_expired(struct babel_route *route);
int route_interferes(struct babel_route *route, struct interface *ifp);
int update_feasible(struct source *src,
unsigned short seqno, unsigned short refmetric);
struct route *find_best_route(const unsigned char *prefix, unsigned char plen,
struct babel_route *find_best_route(const unsigned char *prefix, unsigned char plen,
int feasible, struct neighbour *exclude);
struct route *install_best_route(const unsigned char prefix[16],
struct babel_route *install_best_route(const unsigned char prefix[16],
unsigned char plen);
void update_neighbour_metric(struct neighbour *neigh, int changed);
void update_interface_metric(struct interface *ifp);
void update_route_metric(struct route *route);
struct route *update_route(const unsigned char *id,
void update_route_metric(struct babel_route *route);
struct babel_route *update_route(const unsigned char *id,
const unsigned char *prefix, unsigned char plen,
unsigned short seqno, unsigned short refmetric,
unsigned short interval, struct neighbour *neigh,
......@@ -102,10 +102,10 @@ void retract_neighbour_routes(struct neighbour *neigh);
void send_unfeasible_request(struct neighbour *neigh, int force,
unsigned short seqno, unsigned short metric,
struct source *src);
void consider_route(struct route *route);
void send_triggered_update(struct route *route,
void consider_route(struct babel_route *route);
void send_triggered_update(struct babel_route *route,
struct source *oldsrc, unsigned oldmetric);
void route_changed(struct route *route,
void route_changed(struct babel_route *route,
struct source *oldsrc, unsigned short oldmetric);
void route_lost(struct source *src, unsigned oldmetric);
void expire_routes(void);
......@@ -192,7 +192,7 @@ check_xroutes(int send_updates)
if(!export) {
unsigned char prefix[16], plen;
struct route *route;
struct babel_route *route;
memcpy(prefix, xroutes[i].prefix, 16);
plen = xroutes[i].plen;
flush_xroute(&xroutes[i]);
......@@ -220,7 +220,7 @@ check_xroutes(int send_updates)
rc = add_xroute(routes[i].prefix, routes[i].plen,
metric, routes[i].ifindex, routes[i].proto);
if(rc > 0) {
struct route *route;
struct babel_route *route;
route = find_installed_route(routes[i].prefix, routes[i].plen);
if(route) {
if(allow_duplicates < 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