Commit d6e8d734 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Rename route->nexthop to route->neigh.

parent 078fe553
......@@ -706,8 +706,8 @@ dump_tables(FILE *out)
id ? format_address(routes[i].src->address) : "",
(int)routes[i].seqno,
(int)(now.tv_sec - routes[i].time),
routes[i].nexthop->network->ifname,
format_address(routes[i].nexthop->address),
routes[i].neigh->network->ifname,
format_address(routes[i].neigh->address),
routes[i].installed ? " (installed)" :
route_feasible(&routes[i]) ? " (feasible)" : "");
}
......
......@@ -27,7 +27,7 @@ THE SOFTWARE.
int
import_filter(const unsigned char *id,
const unsigned char *prefix, unsigned short plen,
const unsigned char *nexthop)
const unsigned char *neigh)
{
if(plen >= 96 && v4mapped(prefix))
return 1;
......
......@@ -22,6 +22,6 @@ THE SOFTWARE.
int import_filter(const unsigned char *id,
const unsigned char *prefix, unsigned short plen,
const unsigned char *nexthop);
const unsigned char *neigh);
int export_filter(const unsigned char *id,
const unsigned char *prefix, unsigned short plen);
......@@ -248,7 +248,7 @@ handle_request(struct neighbour *neigh, const unsigned char *prefix,
if(router_hash == hash_id(route->src->address) &&
seqno_compare(seqno, route->seqno) > 0) {
if(hop_count > 1) {
send_unicast_request(route->nexthop, prefix, plen,
send_unicast_request(route->neigh, prefix, plen,
hop_count - 1, seqno, router_hash);
record_request(prefix, plen, seqno, router_hash,
neigh->network, 0);
......@@ -570,7 +570,7 @@ flushupdates(void)
buffered_updates[i].plen);
if(route) {
if(split_horizon &&
net->wired && route->nexthop->network == net)
net->wired && route->neigh->network == net)
continue;
seqno = route->seqno;
metric = MIN((int)route->metric + add_cost, INFINITY);
......@@ -760,7 +760,7 @@ send_neighbour_update(struct neighbour *neigh, struct network *net)
{
int i;
for(i = 0; i < numroutes; i++) {
if(routes[i].installed && routes[i].nexthop == neigh)
if(routes[i].installed && routes[i].neigh == neigh)
send_update(net, 0, routes[i].src->prefix, routes[i].src->plen);
}
}
......
......@@ -205,7 +205,7 @@ update_neighbour(struct neighbour *neigh, int hello, int hello_interval)
struct route *route = NULL;
if(!martian_prefix(neigh->id, 128))
route = find_installed_route(neigh->id, 128);
if(!route || route->metric >= INFINITY || route->nexthop == neigh)
if(!route || route->metric >= INFINITY || route->neigh == neigh)
send_unicast_request(neigh, NULL, 0, 0, 0, 0);
}
return rc;
......
......@@ -45,11 +45,11 @@ int route_gc_delay = 180;
struct route *
find_route(const unsigned char *prefix, unsigned char plen,
struct neighbour *nexthop)
struct neighbour *neigh)
{
int i;
for(i = 0; i < numroutes; i++) {
if(routes[i].nexthop == nexthop &&
if(routes[i].neigh == neigh &&
source_match(routes[i].src, prefix, plen))
return &routes[i];
}
......@@ -102,7 +102,7 @@ flush_neighbour_routes(struct neighbour *neigh)
i = 0;
while(i < numroutes) {
if(routes[i].nexthop == neigh) {
if(routes[i].neigh == neigh) {
flush_route(routes + i);
continue;
}
......@@ -130,8 +130,8 @@ install_route(struct route *route)
return;
rc = kernel_route(ROUTE_ADD, route->src->prefix, route->src->plen,
route->nexthop->address,
route->nexthop->network->ifindex,
route->neigh->address,
route->neigh->network->ifindex,
metric_to_kernel(route->metric), NULL, 0, 0);
if(rc < 0) {
perror("kernel_route(ADD)");
......@@ -150,8 +150,8 @@ uninstall_route(struct route *route)
return;
rc = kernel_route(ROUTE_FLUSH, route->src->prefix, route->src->plen,
route->nexthop->address,
route->nexthop->network->ifindex,
route->neigh->address,
route->neigh->network->ifindex,
metric_to_kernel(route->metric), NULL, 0, 0);
if(rc < 0)
perror("kernel_route(FLUSH)");
......@@ -177,9 +177,9 @@ change_route(struct route *old, struct route *new)
return;
rc = kernel_route(ROUTE_MODIFY, old->src->prefix, old->src->plen,
old->nexthop->address, old->nexthop->network->ifindex,
old->neigh->address, old->neigh->network->ifindex,
metric_to_kernel(old->metric),
new->nexthop->address, new->nexthop->network->ifindex,
new->neigh->address, new->neigh->network->ifindex,
metric_to_kernel(new->metric));
if(rc >= 0) {
old->installed = 0;
......@@ -195,11 +195,11 @@ change_route_metric(struct route *route, int newmetric)
if(route->installed) {
rc = kernel_route(ROUTE_MODIFY,
route->src->prefix, route->src->plen,
route->nexthop->address,
route->nexthop->network->ifindex,
route->neigh->address,
route->neigh->network->ifindex,
metric_to_kernel(route->metric),
route->nexthop->address,
route->nexthop->network->ifindex,
route->neigh->address,
route->neigh->network->ifindex,
metric_to_kernel(newmetric));
if(rc < 0) {
perror("kernel_route(MODIFY)");
......@@ -282,7 +282,7 @@ update_route_metric(struct route *route)
}
newmetric = INFINITY;
} else {
newmetric = MIN(route->refmetric + neighbour_cost(route->nexthop),
newmetric = MIN(route->refmetric + neighbour_cost(route->neigh),
INFINITY);
}
......@@ -297,7 +297,7 @@ update_neighbour_metric(struct neighbour *neigh)
i = 0;
while(i < numroutes) {
if(routes[i].nexthop == neigh)
if(routes[i].neigh == neigh)
update_route_metric(&routes[i]);
i++;
}
......@@ -307,7 +307,7 @@ update_neighbour_metric(struct neighbour *neigh)
struct route *
update_route(const unsigned char *a, const unsigned char *p, unsigned char plen,
unsigned short seqno, unsigned short refmetric,
struct neighbour *nexthop)
struct neighbour *neigh)
{
struct route *route;
struct source *src;
......@@ -319,7 +319,7 @@ update_route(const unsigned char *a, const unsigned char *p, unsigned char plen,
return NULL;
}
if(import_filter(a, p, plen, nexthop->id))
if(import_filter(a, p, plen, neigh->id))
return NULL;
src = find_source(a, p, plen, 1, seqno);
......@@ -327,8 +327,8 @@ update_route(const unsigned char *a, const unsigned char *p, unsigned char plen,
return NULL;
feasible = update_feasible(a, p, plen, seqno, refmetric);
route = find_route(p, plen, nexthop);
metric = MIN((int)refmetric + neighbour_cost(nexthop), INFINITY);
route = find_route(p, plen, neigh);
metric = MIN((int)refmetric + neighbour_cost(neigh), INFINITY);
if(route) {
struct source *oldsrc;
......@@ -384,7 +384,7 @@ update_route(const unsigned char *a, const unsigned char *p, unsigned char plen,
route->refmetric = refmetric;
route->seqno = seqno;
route->metric = metric;
route->nexthop = nexthop;
route->neigh = neigh;
route->time = now.tv_sec;
route->origtime = now.tv_sec;
route->installed = 0;
......@@ -543,7 +543,7 @@ expire_routes(void)
if(route->installed && route->refmetric < INFINITY) {
if(route->time < now.tv_sec - MAX(10, route_timeout_delay - 25))
send_unicast_request(route->nexthop,
send_unicast_request(route->neigh,
route->src->prefix, route->src->plen,
0, 0, 0);
}
......
......@@ -25,7 +25,7 @@ struct route {
unsigned short metric;
unsigned short refmetric;
unsigned short seqno;
struct neighbour *nexthop;
struct neighbour *neigh;
int time;
int origtime;
int installed;
......@@ -38,7 +38,7 @@ extern int route_timeout_delay;
extern int route_gc_delay;
struct route *find_route(const unsigned char *prefix, unsigned char plen,
struct neighbour *nexthop);
struct neighbour *neigh);
struct route *find_installed_route(const unsigned char *prefix,
unsigned char plen);
void flush_route(struct route *route);
......@@ -60,7 +60,7 @@ void update_route_metric(struct route *route);
struct route *update_route(const unsigned char *a,
const unsigned char *p, unsigned char plen,
unsigned short seqno, unsigned short refmetric,
struct neighbour *nexthop);
struct neighbour *neigh);
void consider_route(struct route *route);
void send_triggered_update(struct route *route,
struct source *oldsrc, int oldmetric);
......
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