version 1.1.1.1, 2012/02/21 23:10:48
|
version 1.1.1.2.2.1, 2013/07/22 00:02:45
|
Line 259 void add_neighbor_to_routes(vifi_t vifi, u_int index)
|
Line 259 void add_neighbor_to_routes(vifi_t vifi, u_int index)
|
void delete_neighbor_from_routes(u_int32 addr, vifi_t vifi, u_int index) |
void delete_neighbor_from_routes(u_int32 addr, vifi_t vifi, u_int index) |
{ |
{ |
struct rtentry *r; |
struct rtentry *r; |
struct uvif *v; | struct uvif *v = &uvifs[vifi]; |
|
|
v = &uvifs[vifi]; |
|
for (r = routing_table; r != NULL; r = r->rt_next) { |
for (r = routing_table; r != NULL; r = r->rt_next) { |
if (r->rt_metric != UNREACHABLE) { |
if (r->rt_metric != UNREACHABLE) { |
if (r->rt_parent == vifi && r->rt_gateway == addr) { |
if (r->rt_parent == vifi && r->rt_gateway == addr) { |
Line 273 void delete_neighbor_from_routes(u_int32 addr, vifi_t
|
Line 272 void delete_neighbor_from_routes(u_int32 addr, vifi_t
|
} else if (r->rt_dominants[vifi] == addr) { |
} else if (r->rt_dominants[vifi] == addr) { |
VIFM_SET(vifi, r->rt_children); |
VIFM_SET(vifi, r->rt_children); |
r->rt_dominants[vifi] = 0; |
r->rt_dominants[vifi] = 0; |
if ((uvifs[vifi].uv_flags & VIFF_NOFLOOD) || | if ((v->uv_flags & VIFF_NOFLOOD) || AVOID_TRANSIT(vifi, r)) |
AVOID_TRANSIT(vifi, r)) | NBRM_CLRMASK(r->rt_subordinates, v->uv_nbrmap); |
NBRM_CLRMASK(r->rt_subordinates, uvifs[vifi].uv_nbrmap); | |
else |
else |
NBRM_SETMASK(r->rt_subordinates, uvifs[vifi].uv_nbrmap); | NBRM_SETMASK(r->rt_subordinates, v->uv_nbrmap); |
update_table_entry(r, r->rt_gateway); |
update_table_entry(r, r->rt_gateway); |
} else if (NBRM_ISSET(index, r->rt_subordinates)) { |
} else if (NBRM_ISSET(index, r->rt_subordinates)) { |
NBRM_CLR(index, r->rt_subordinates); |
NBRM_CLR(index, r->rt_subordinates); |
Line 295 void delete_neighbor_from_routes(u_int32 addr, vifi_t
|
Line 293 void delete_neighbor_from_routes(u_int32 addr, vifi_t
|
* beginning for each update; this relies on having the route reports in |
* beginning for each update; this relies on having the route reports in |
* a single message be in the same order as the route entries in the routing |
* a single message be in the same order as the route entries in the routing |
* table. |
* table. |
|
* |
|
* find_route() expects rtp to be the preceding entry in the linked list |
|
* where route insertion takes place. We need to be able to insert routes |
|
* before at the list head (routing table). |
*/ |
*/ |
void start_route_updates(void) |
void start_route_updates(void) |
{ |
{ |
rtp = routing_table; | rtp = NULL; |
} |
} |
|
|
|
|
Line 315 static int find_route(u_int32 origin, u_int32 mask)
|
Line 317 static int find_route(u_int32 origin, u_int32 mask)
|
{ |
{ |
struct rtentry *r; |
struct rtentry *r; |
|
|
r = rtp; | /* |
| * If rtp is NULL, we are preceding routing_table, so our first search |
| * candidate should be the routing_table. |
| */ |
| r = rtp ? rtp : routing_table; |
while (r != NULL) { |
while (r != NULL) { |
if (origin == r->rt_origin && mask == r->rt_originmask) { |
if (origin == r->rt_origin && mask == r->rt_originmask) { |
rtp = r; |
rtp = r; |
Line 386 static void create_route(u_int32 origin, u_int32 mask)
|
Line 392 static void create_route(u_int32 origin, u_int32 mask)
|
rt_end = this; |
rt_end = this; |
rtp->rt_next = this; |
rtp->rt_next = this; |
} else { |
} else { |
|
if (routing_table) { |
|
/* Change existing head to this */ |
|
this->rt_next = routing_table; |
|
routing_table->rt_prev = this; |
|
} |
|
else { |
|
/* this is the first route entry that exists */ |
|
rt_end = this; |
|
} |
routing_table = this; |
routing_table = this; |
rt_end = this; |
|
} |
} |
|
|
rtp = this; |
rtp = this; |
Line 1233 static int report_chunk(int which_routes, struct rtent
|
Line 1247 static int report_chunk(int which_routes, struct rtent
|
int datalen = 0; |
int datalen = 0; |
int width = 0; |
int width = 0; |
u_int32 mask = 0; |
u_int32 mask = 0; |
u_int32 src; |
|
int admetric = v->uv_admetric; |
int admetric = v->uv_admetric; |
int metric; |
int metric; |
|
|
src = v->uv_lcl_addr; |
|
p = send_buf + MIN_IP_HEADER_LEN + IGMP_MINLEN; |
p = send_buf + MIN_IP_HEADER_LEN + IGMP_MINLEN; |
|
|
for (r = start_rt; r != routing_table; r = r->rt_prev) { |
for (r = start_rt; r != routing_table; r = r->rt_prev) { |
Line 1399 void dump_routes(FILE *fp)
|
Line 1411 void dump_routes(FILE *fp)
|
inet_fmts(r->rt_origin, r->rt_originmask, s1, sizeof(s1)), |
inet_fmts(r->rt_origin, r->rt_originmask, s1, sizeof(s1)), |
(r->rt_gateway == 0) ? "" : inet_fmt(r->rt_gateway, s2, sizeof(s2))); |
(r->rt_gateway == 0) ? "" : inet_fmt(r->rt_gateway, s2, sizeof(s2))); |
|
|
fprintf(fp, (r->rt_metric == UNREACHABLE) ? " NR " : "%4u ", | if (r->rt_metric == UNREACHABLE) |
r->rt_metric); | fprintf(fp, " NR "); |
| else |
| fprintf(fp, "%4u ", r->rt_metric); |
|
|
fprintf(fp, " %3u %c%c %3u ", r->rt_timer, |
fprintf(fp, " %3u %c%c %3u ", r->rt_timer, |
(r->rt_flags & RTF_CHANGED) ? 'C' : '.', |
(r->rt_flags & RTF_CHANGED) ? 'C' : '.', |