Commit 497eeb51 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Rename src->address to src->id.

parent 87e87774
......@@ -894,7 +894,7 @@ dump_tables(FILE *out)
for(i = 0; i < numroutes; i++) {
int id =
routes[i].src->plen != 128 ||
memcmp(routes[i].src->prefix, routes[i].src->address, 16) != 0;
memcmp(routes[i].src->prefix, routes[i].src->id, 16) != 0;
const unsigned char *nexthop =
memcmp(routes[i].nexthop, routes[i].neigh->address, 16) == 0 ?
NULL : routes[i].nexthop;
......@@ -903,7 +903,7 @@ dump_tables(FILE *out)
format_prefix(routes[i].src->prefix, routes[i].src->plen),
routes[i].metric, routes[i].refmetric,
id ? "id " : "",
id ? format_address(routes[i].src->address) : "",
id ? format_address(routes[i].src->id) : "",
(int)routes[i].seqno,
(int)(now.tv_sec - routes[i].time),
routes[i].neigh->network->ifname,
......
......@@ -269,7 +269,7 @@ handle_request(struct neighbour *neigh, const unsigned char *prefix,
if(route &&
(hop_count == 0 ||
(route->metric < INFINITY &&
(router_hash != hash_id(route->src->address) ||
(router_hash != hash_id(route->src->id) ||
seqno_compare(seqno, route->seqno) <= 0)))) {
/* We can satisfy this request straight away. Note that in the
hop_count=0 case, we do send a recent retraction, in order to
......@@ -281,7 +281,7 @@ handle_request(struct neighbour *neigh, const unsigned char *prefix,
if(hop_count <= 1)
return;
if(route && router_hash == hash_id(route->src->address) &&
if(route && router_hash == hash_id(route->src->id) &&
seqno_minus(seqno, route->seqno) > 100) {
/* Hopelessly out-of-date */
return;
......@@ -594,7 +594,7 @@ message_source_id(struct network *net)
static void
really_send_update(struct network *net,
const unsigned char *address,
const unsigned char *id,
const unsigned char *prefix, unsigned char plen,
unsigned short seqno, unsigned short metric)
{
......@@ -603,7 +603,7 @@ really_send_update(struct network *net,
if(!net->up)
return;
add_metric = output_filter(address, prefix, plen, net->ifindex);
add_metric = output_filter(id, prefix, plen, net->ifindex);
if(add_metric < INFINITY) {
if(plen >= 96 && v4mapped(prefix)) {
......@@ -616,25 +616,25 @@ really_send_update(struct network *net,
memcpy(v4route + 12, prefix + 12, 4);
start_message(net, 48);
sid = message_source_id(net);
if(sid == NULL || memcmp(address, sid, 16) != 0)
send_message(net, 3, 0xFF, 0, 0, 0xFFFF, address);
if(sid == NULL || memcmp(id, sid, 16) != 0)
send_message(net, 3, 0xFF, 0, 0, 0xFFFF, id);
send_message(net, 5, plen - 96, 0, seqno, metric + add_metric,
v4route);
} else {
if(in_prefix(address, prefix, plen)) {
send_message(net, 3, plen, 0, seqno, metric, address);
if(in_prefix(id, prefix, plen)) {
send_message(net, 3, plen, 0, seqno, metric, id);
} else {
const unsigned char *sid;
start_message(net, 48);
sid = message_source_id(net);
if(sid == NULL || memcmp(address, sid, 16) != 0)
send_message(net, 3, 0xFF, 0, 0, 0xFFFF, address);
if(sid == NULL || memcmp(id, sid, 16) != 0)
send_message(net, 3, 0xFF, 0, 0, 0xFFFF, id);
send_message(net, 4, plen, 0, seqno, metric + add_metric,
prefix);
}
}
}
satisfy_request(prefix, plen, seqno, hash_id(address), net);
satisfy_request(prefix, plen, seqno, hash_id(id), net);
}
void
......@@ -672,7 +672,7 @@ flushupdates(void)
continue;
seqno = route->seqno;
metric = route->metric;
really_send_update(net, route->src->address,
really_send_update(net, route->src->id,
route->src->prefix,
route->src->plen,
seqno, metric);
......@@ -682,7 +682,7 @@ flushupdates(void)
src = find_recent_source(buffered_updates[i].prefix,
buffered_updates[i].plen);
if(src) {
really_send_update(net, src->address, src->prefix, src->plen,
really_send_update(net, src->id, src->prefix, src->plen,
src->metric >= INFINITY ?
src->seqno : seqno_plus(src->seqno, 1),
INFINITY);
......@@ -751,7 +751,7 @@ send_update(struct network *net, int urgent,
if(route) {
urgent = 1;
satisfy_request(prefix, plen, route->seqno,
hash_id(route->src->address), net);
hash_id(route->src->id), net);
}
}
}
......
......@@ -214,17 +214,17 @@ change_route_metric(struct route *route, int newmetric)
int
route_feasible(struct route *route)
{
return update_feasible(route->src->address,
return update_feasible(route->src->id,
route->src->prefix, route->src->plen,
route->seqno, route->refmetric);
}
int
update_feasible(const unsigned char *a,
update_feasible(const unsigned char *id,
const unsigned char *p, unsigned char plen,
unsigned short seqno, unsigned short refmetric)
{
struct source *src = find_source(a, p, plen, 0, 0);
struct source *src = find_source(id, p, plen, 0, 0);
if(src == NULL)
return 1;
......@@ -404,9 +404,9 @@ update_route(const unsigned char *a, const unsigned char *p, unsigned char plen,
debugf("Unfeasible update for installed route to %s "
"(%s %d %d -> %s %d %d).\n",
format_prefix(src->prefix, src->plen),
format_address(route->src->address),
format_address(route->src->id),
route->seqno, route->refmetric,
format_address(src->address), seqno, refmetric);
format_address(src->id), seqno, refmetric);
uninstall_route(route);
lost = 1;
}
......@@ -477,7 +477,7 @@ send_unfeasible_request(struct neighbour *neigh,
send_request_resend(neigh, prefix, plen,
src->metric >= INFINITY ?
src->seqno : seqno_plus(src->seqno, 1),
hash_id(src->address));
hash_id(src->id));
}
}
......@@ -552,7 +552,7 @@ send_triggered_update(struct route *route, struct source *oldsrc, int oldmetric)
/* Make sure that requests are satisfied speedily */
if(unsatisfied_request(route->src->prefix, route->src->plen,
route->seqno, hash_id(route->src->address)))
route->seqno, hash_id(route->src->id)))
urgent = 1;
if(urgent ||
......@@ -567,7 +567,7 @@ send_triggered_update(struct route *route, struct source *oldsrc, int oldmetric)
route->src->metric >= INFINITY ?
route->src->seqno :
seqno_plus(route->src->seqno, 1),
hash_id(route->src->address));
hash_id(route->src->id));
} else if(newmetric >= oldmetric + 288) {
/* Ensure that the update goes out before the request */
flushupdates();
......@@ -618,7 +618,7 @@ route_lost(struct source *src, int oldmetric)
send_request_resend(NULL, src->prefix, src->plen,
src->metric >= INFINITY ?
src->seqno : seqno_plus(src->seqno, 1),
hash_id(src->address));
hash_id(src->id));
}
}
......
......@@ -49,7 +49,7 @@ void uninstall_route(struct route *route);
void change_route(struct route *old, struct route *new);
void change_route_metric(struct route *route, int newmetric);
int route_feasible(struct route *route);
int update_feasible(const unsigned char *a,
int update_feasible(const unsigned char *id,
const unsigned char *p, unsigned char plen,
unsigned short seqno, unsigned short refmetric);
struct route *find_best_route(const unsigned char *prefix, unsigned char plen,
......
......@@ -34,7 +34,7 @@ struct source srcs[MAXSRCS];
int numsrcs = 0;
struct source *
find_source(const unsigned char *a, const unsigned char *p, unsigned char plen,
find_source(const unsigned char *id, const unsigned char *p, unsigned char plen,
int create, unsigned short seqno)
{
struct source *src;
......@@ -45,9 +45,9 @@ find_source(const unsigned char *a, const unsigned char *p, unsigned char plen,
continue;
/* This should really be a hash table. For now, check the
last byte first. */
if(srcs[i].address[15] != a[15])
if(srcs[i].id[15] != id[15])
continue;
if(memcmp(srcs[i].address, a, 16) != 0)
if(memcmp(srcs[i].id, id, 16) != 0)
continue;
if(source_match(&srcs[i], p, plen))
return &srcs[i];
......@@ -79,7 +79,7 @@ find_source(const unsigned char *a, const unsigned char *p, unsigned char plen,
}
src->valid = 1;
memcpy(src->address, a, 16);
memcpy(src->id, id, 16);
memcpy(src->prefix, p, 16);
src->plen = plen;
src->seqno = seqno;
......
......@@ -23,7 +23,7 @@ THE SOFTWARE.
#define SOURCE_GC_TIME 200
struct source {
unsigned char address[16];
unsigned char id[16];
unsigned char prefix[16];
unsigned char plen;
unsigned char valid;
......@@ -34,7 +34,7 @@ struct source {
int source_match(struct source *src,
const unsigned char *p, unsigned char plen);
struct source *find_source(const unsigned char *a,
struct source *find_source(const unsigned char *id,
const unsigned char *p,
unsigned char plen,
int create, unsigned short seqno);
......
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