diff options
Diffstat (limited to 'ripngd')
| -rw-r--r-- | ripngd/ripng_interface.c | 54 | ||||
| -rw-r--r-- | ripngd/ripng_main.c | 2 | ||||
| -rw-r--r-- | ripngd/ripng_route.c | 42 | ||||
| -rw-r--r-- | ripngd/ripng_route.h | 6 | ||||
| -rw-r--r-- | ripngd/ripng_zebra.c | 8 | ||||
| -rw-r--r-- | ripngd/ripngd.c | 136 | ||||
| -rw-r--r-- | ripngd/ripngd.h | 12 |
7 files changed, 132 insertions, 128 deletions
diff --git a/ripngd/ripng_interface.c b/ripngd/ripng_interface.c index ef324b001a..d7d3d245d6 100644 --- a/ripngd/ripng_interface.c +++ b/ripngd/ripng_interface.c @@ -31,7 +31,7 @@ #include "stream.h" #include "zclient.h" #include "command.h" -#include "table.h" +#include "agg_table.h" #include "thread.h" #include "privs.h" #include "vrf.h" @@ -159,14 +159,15 @@ static int ripng_if_ipv6_lladdress_check(struct interface *ifp) static int ripng_if_down(struct interface *ifp) { - struct route_node *rp; + struct agg_node *rp; struct ripng_info *rinfo; struct ripng_interface *ri; struct list *list = NULL; struct listnode *listnode = NULL, *nextnode = NULL; if (ripng) - for (rp = route_top(ripng->table); rp; rp = route_next(rp)) + for (rp = agg_route_top(ripng->table); rp; + rp = agg_route_next(rp)) if ((list = rp->info) != NULL) for (ALL_LIST_ELEMENTS(list, listnode, nextnode, rinfo)) @@ -479,7 +480,7 @@ int ripng_interface_address_delete(int command, struct zclient *zclient, vector ripng_enable_if; /* RIPng enable network table. */ -struct route_table *ripng_enable_network; +struct agg_table *ripng_enable_network; /* Lookup RIPng enable network. */ /* Check wether the interface has at least a connected prefix that @@ -492,7 +493,7 @@ static int ripng_enable_network_lookup_if(struct interface *ifp) for (ALL_LIST_ELEMENTS_RO(ifp->connected, node, connected)) { struct prefix *p; - struct route_node *n; + struct agg_node *n; p = connected->address; @@ -501,10 +502,10 @@ static int ripng_enable_network_lookup_if(struct interface *ifp) address.prefix = p->u.prefix6; address.prefixlen = IPV6_MAX_BITLEN; - n = route_node_match(ripng_enable_network, - (struct prefix *)&address); + n = agg_node_match(ripng_enable_network, + (struct prefix *)&address); if (n) { - route_unlock_node(n); + agg_unlock_node(n); return 1; } } @@ -521,7 +522,7 @@ static int ripng_enable_network_lookup2(struct connected *connected) p = connected->address; if (p->family == AF_INET6) { - struct route_node *node; + struct agg_node *node; address.family = p->family; address.prefix = p->u.prefix6; @@ -529,11 +530,11 @@ static int ripng_enable_network_lookup2(struct connected *connected) /* LPM on p->family, p->u.prefix6/IPV6_MAX_BITLEN within * ripng_enable_network */ - node = route_node_match(ripng_enable_network, - (struct prefix *)&address); + node = agg_node_match(ripng_enable_network, + (struct prefix *)&address); if (node) { - route_unlock_node(node); + agg_unlock_node(node); return 1; } } @@ -544,12 +545,12 @@ static int ripng_enable_network_lookup2(struct connected *connected) /* Add RIPng enable network. */ static int ripng_enable_network_add(struct prefix *p) { - struct route_node *node; + struct agg_node *node; - node = route_node_get(ripng_enable_network, p); + node = agg_node_get(ripng_enable_network, p); if (node->info) { - route_unlock_node(node); + agg_unlock_node(node); return -1; } else node->info = (void *)1; @@ -563,17 +564,17 @@ static int ripng_enable_network_add(struct prefix *p) /* Delete RIPng enable network. */ static int ripng_enable_network_delete(struct prefix *p) { - struct route_node *node; + struct agg_node *node; - node = route_node_lookup(ripng_enable_network, p); + node = agg_node_lookup(ripng_enable_network, p); if (node) { node->info = NULL; /* Unlock info lock. */ - route_unlock_node(node); + agg_unlock_node(node); /* Unlock lookup lock. */ - route_unlock_node(node); + agg_unlock_node(node); return 1; } @@ -771,13 +772,14 @@ void ripng_clean_network() { unsigned int i; char *str; - struct route_node *rn; + struct agg_node *rn; /* ripng_enable_network */ - for (rn = route_top(ripng_enable_network); rn; rn = route_next(rn)) + for (rn = agg_route_top(ripng_enable_network); rn; + rn = agg_route_next(rn)) if (rn->info) { rn->info = NULL; - route_unlock_node(rn); + agg_unlock_node(rn); } /* ripng_enable_if */ @@ -877,12 +879,12 @@ int ripng_network_write(struct vty *vty, int config_mode) { unsigned int i; const char *ifname; - struct route_node *node; + struct agg_node *node; char buf[BUFSIZ]; /* Write enable network. */ - for (node = route_top(ripng_enable_network); node; - node = route_next(node)) + for (node = agg_route_top(ripng_enable_network); node; + node = agg_route_next(node)) if (node->info) { struct prefix *p = &node->p; vty_out(vty, "%s%s/%d\n", @@ -1124,7 +1126,7 @@ void ripng_if_init() hook_register_prio(if_del, 0, ripng_if_delete_hook); /* RIPng enable network init. */ - ripng_enable_network = route_table_init(); + ripng_enable_network = agg_table_init(); /* RIPng enable interface init. */ ripng_enable_if = vector_init(1); diff --git a/ripngd/ripng_main.c b/ripngd/ripng_main.c index e4501d6f80..bc81a956d6 100644 --- a/ripngd/ripng_main.c +++ b/ripngd/ripng_main.c @@ -166,7 +166,7 @@ int main(int argc, char **argv) master = frr_init(); /* Library inits. */ - vrf_init(NULL, NULL, NULL, NULL); + vrf_init(NULL, NULL, NULL, NULL, NULL); /* RIPngd inits. */ ripng_init(); diff --git a/ripngd/ripng_route.c b/ripngd/ripng_route.c index 83cb59c8b8..f66a0b9527 100644 --- a/ripngd/ripng_route.c +++ b/ripngd/ripng_route.c @@ -22,7 +22,7 @@ #include <zebra.h> #include "prefix.h" -#include "table.h" +#include "agg_table.h" #include "memory.h" #include "if.h" #include "vty.h" @@ -44,13 +44,12 @@ void ripng_aggregate_free(struct ripng_aggregate *aggregate) } /* Aggregate count increment check. */ -void ripng_aggregate_increment(struct route_node *child, - struct ripng_info *rinfo) +void ripng_aggregate_increment(struct agg_node *child, struct ripng_info *rinfo) { - struct route_node *np; + struct agg_node *np; struct ripng_aggregate *aggregate; - for (np = child; np; np = np->parent) + for (np = child; np; np = agg_node_parent(np)) if ((aggregate = np->aggregate) != NULL) { aggregate->count++; rinfo->suppress++; @@ -58,13 +57,12 @@ void ripng_aggregate_increment(struct route_node *child, } /* Aggregate count decrement check. */ -void ripng_aggregate_decrement(struct route_node *child, - struct ripng_info *rinfo) +void ripng_aggregate_decrement(struct agg_node *child, struct ripng_info *rinfo) { - struct route_node *np; + struct agg_node *np; struct ripng_aggregate *aggregate; - for (np = child; np; np = np->parent) + for (np = child; np; np = agg_node_parent(np)) if ((aggregate = np->aggregate) != NULL) { aggregate->count--; rinfo->suppress--; @@ -72,14 +70,14 @@ void ripng_aggregate_decrement(struct route_node *child, } /* Aggregate count decrement check for a list. */ -void ripng_aggregate_decrement_list(struct route_node *child, struct list *list) +void ripng_aggregate_decrement_list(struct agg_node *child, struct list *list) { - struct route_node *np; + struct agg_node *np; struct ripng_aggregate *aggregate; struct ripng_info *rinfo = NULL; struct listnode *node = NULL; - for (np = child; np; np = np->parent) + for (np = child; np; np = agg_node_parent(np)) if ((aggregate = np->aggregate) != NULL) aggregate->count -= listcount(list); @@ -90,8 +88,8 @@ void ripng_aggregate_decrement_list(struct route_node *child, struct list *list) /* RIPng routes treatment. */ int ripng_aggregate_add(struct prefix *p) { - struct route_node *top; - struct route_node *rp; + struct agg_node *top; + struct agg_node *rp; struct ripng_info *rinfo; struct ripng_aggregate *aggregate; struct ripng_aggregate *sub; @@ -99,7 +97,7 @@ int ripng_aggregate_add(struct prefix *p) struct listnode *node = NULL; /* Get top node for aggregation. */ - top = route_node_get(ripng->table, p); + top = agg_node_get(ripng->table, p); /* Allocate new aggregate. */ aggregate = ripng_aggregate_new(); @@ -108,7 +106,7 @@ int ripng_aggregate_add(struct prefix *p) top->aggregate = aggregate; /* Suppress routes match to the aggregate. */ - for (rp = route_lock_node(top); rp; rp = route_next_until(rp, top)) { + for (rp = agg_lock_node(top); rp; rp = agg_route_next_until(rp, top)) { /* Suppress normal route. */ if ((list = rp->info) != NULL) for (ALL_LIST_ELEMENTS_RO(list, node, rinfo)) { @@ -128,8 +126,8 @@ int ripng_aggregate_add(struct prefix *p) /* Delete RIPng static route. */ int ripng_aggregate_delete(struct prefix *p) { - struct route_node *top; - struct route_node *rp; + struct agg_node *top; + struct agg_node *rp; struct ripng_info *rinfo; struct ripng_aggregate *aggregate; struct ripng_aggregate *sub; @@ -137,13 +135,13 @@ int ripng_aggregate_delete(struct prefix *p) struct listnode *node = NULL; /* Get top node for aggregation. */ - top = route_node_get(ripng->table, p); + top = agg_node_get(ripng->table, p); /* Allocate new aggregate. */ aggregate = top->aggregate; /* Suppress routes match to the aggregate. */ - for (rp = route_lock_node(top); rp; rp = route_next_until(rp, top)) { + for (rp = agg_lock_node(top); rp; rp = agg_route_next_until(rp, top)) { /* Suppress normal route. */ if ((list = rp->info) != NULL) for (ALL_LIST_ELEMENTS_RO(list, node, rinfo)) { @@ -160,8 +158,8 @@ int ripng_aggregate_delete(struct prefix *p) top->aggregate = NULL; ripng_aggregate_free(aggregate); - route_unlock_node(top); - route_unlock_node(top); + agg_unlock_node(top); + agg_unlock_node(top); return 0; } diff --git a/ripngd/ripng_route.h b/ripngd/ripng_route.h index dc7d422d1e..e402f4a66c 100644 --- a/ripngd/ripng_route.h +++ b/ripngd/ripng_route.h @@ -42,11 +42,11 @@ struct ripng_aggregate { uint16_t tag_out; }; -extern void ripng_aggregate_increment(struct route_node *rp, +extern void ripng_aggregate_increment(struct agg_node *rp, struct ripng_info *rinfo); -extern void ripng_aggregate_decrement(struct route_node *rp, +extern void ripng_aggregate_decrement(struct agg_node *rp, struct ripng_info *rinfo); -extern void ripng_aggregate_decrement_list(struct route_node *rp, +extern void ripng_aggregate_decrement_list(struct agg_node *rp, struct list *list); extern int ripng_aggregate_add(struct prefix *p); extern int ripng_aggregate_delete(struct prefix *p); diff --git a/ripngd/ripng_zebra.c b/ripngd/ripng_zebra.c index 6830e0e926..a8cc9ee128 100644 --- a/ripngd/ripng_zebra.c +++ b/ripngd/ripng_zebra.c @@ -23,7 +23,7 @@ #include "command.h" #include "prefix.h" -#include "table.h" +#include "agg_table.h" #include "stream.h" #include "memory.h" #include "routemap.h" @@ -37,7 +37,7 @@ struct zclient *zclient = NULL; /* Send ECMP routes to zebra. */ -static void ripng_zebra_ipv6_send(struct route_node *rp, uint8_t cmd) +static void ripng_zebra_ipv6_send(struct agg_node *rp, uint8_t cmd) { struct list *list = (struct list *)rp->info; struct zapi_route api; @@ -100,13 +100,13 @@ static void ripng_zebra_ipv6_send(struct route_node *rp, uint8_t cmd) } /* Add/update ECMP routes to zebra. */ -void ripng_zebra_ipv6_add(struct route_node *rp) +void ripng_zebra_ipv6_add(struct agg_node *rp) { ripng_zebra_ipv6_send(rp, ZEBRA_ROUTE_ADD); } /* Delete ECMP routes from zebra. */ -void ripng_zebra_ipv6_delete(struct route_node *rp) +void ripng_zebra_ipv6_delete(struct agg_node *rp) { ripng_zebra_ipv6_send(rp, ZEBRA_ROUTE_DELETE); } diff --git a/ripngd/ripngd.c b/ripngd/ripngd.c index 934a87b075..d1341d67b7 100644 --- a/ripngd/ripngd.c +++ b/ripngd/ripngd.c @@ -27,7 +27,7 @@ #include "memory.h" #include "if.h" #include "stream.h" -#include "table.h" +#include "agg_table.h" #include "command.h" #include "sockopt.h" #include "distribute.h" @@ -394,7 +394,7 @@ static int ripng_lladdr_check(struct interface *ifp, struct in6_addr *addr) static int ripng_garbage_collect(struct thread *t) { struct ripng_info *rinfo; - struct route_node *rp; + struct agg_node *rp; rinfo = THREAD_ARG(t); rinfo->t_garbage_collect = NULL; @@ -409,7 +409,7 @@ static int ripng_garbage_collect(struct thread *t) listnode_delete(rp->info, rinfo); if (list_isempty((struct list *)rp->info)) { list_delete_and_null((struct list **)&rp->info); - route_unlock_node(rp); + agg_unlock_node(rp); } /* Free RIPng routing information. */ @@ -426,7 +426,7 @@ static void ripng_timeout_update(struct ripng_info *rinfo); */ struct ripng_info *ripng_ecmp_add(struct ripng_info *rinfo_new) { - struct route_node *rp = rinfo_new->rp; + struct agg_node *rp = rinfo_new->rp; struct ripng_info *rinfo = NULL; struct list *list = NULL; @@ -465,7 +465,7 @@ struct ripng_info *ripng_ecmp_add(struct ripng_info *rinfo_new) */ struct ripng_info *ripng_ecmp_replace(struct ripng_info *rinfo_new) { - struct route_node *rp = rinfo_new->rp; + struct agg_node *rp = rinfo_new->rp; struct list *list = (struct list *)rp->info; struct ripng_info *rinfo = NULL, *tmp_rinfo = NULL; struct listnode *node = NULL, *nextnode = NULL; @@ -522,7 +522,7 @@ struct ripng_info *ripng_ecmp_replace(struct ripng_info *rinfo_new) */ struct ripng_info *ripng_ecmp_delete(struct ripng_info *rinfo) { - struct route_node *rp = rinfo->rp; + struct agg_node *rp = rinfo->rp; struct list *list = (struct list *)rp->info; RIPNG_TIMER_OFF(rinfo->t_timeout); @@ -664,7 +664,7 @@ static void ripng_route_process(struct rte *rte, struct sockaddr_in6 *from, { int ret; struct prefix_ipv6 p; - struct route_node *rp; + struct agg_node *rp; struct ripng_info *rinfo = NULL, newinfo; struct ripng_interface *ri; struct in6_addr *nexthop; @@ -773,7 +773,7 @@ static void ripng_route_process(struct rte *rte, struct sockaddr_in6 *from, nexthop = &from->sin6_addr; /* Lookup RIPng routing table. */ - rp = route_node_get(ripng->table, (struct prefix *)&p); + rp = agg_node_get(ripng->table, (struct prefix *)&p); newinfo.rp = rp; newinfo.nexthop = *nexthop; @@ -798,7 +798,7 @@ static void ripng_route_process(struct rte *rte, struct sockaddr_in6 *from, if (rte->metric > rinfo->metric) { /* New route has a greater metric. * Discard it. */ - route_unlock_node(rp); + agg_unlock_node(rp); return; } @@ -821,7 +821,7 @@ static void ripng_route_process(struct rte *rte, struct sockaddr_in6 *from, /* Redistributed route check. */ if (rinfo->type != ZEBRA_ROUTE_RIPNG && rinfo->metric != RIPNG_METRIC_INFINITY) { - route_unlock_node(rp); + agg_unlock_node(rp); return; } @@ -830,7 +830,7 @@ static void ripng_route_process(struct rte *rte, struct sockaddr_in6 *from, && ((rinfo->sub_type == RIPNG_ROUTE_STATIC) || (rinfo->sub_type == RIPNG_ROUTE_DEFAULT)) && rinfo->metric != RIPNG_METRIC_INFINITY) { - route_unlock_node(rp); + agg_unlock_node(rp); return; } } @@ -844,7 +844,7 @@ static void ripng_route_process(struct rte *rte, struct sockaddr_in6 *from, if (rte->metric != RIPNG_METRIC_INFINITY) ripng_ecmp_add(&newinfo); else - route_unlock_node(rp); + agg_unlock_node(rp); } else { /* If there is an existing route, compare the next hop address to the address of the router from which the datagram came. @@ -890,7 +890,7 @@ static void ripng_route_process(struct rte *rte, struct sockaddr_in6 *from, ripng_timeout_update(rinfo); /* Unlock tempolary lock of the route. */ - route_unlock_node(rp); + agg_unlock_node(rp); } } @@ -899,7 +899,7 @@ void ripng_redistribute_add(int type, int sub_type, struct prefix_ipv6 *p, ifindex_t ifindex, struct in6_addr *nexthop, route_tag_t tag) { - struct route_node *rp; + struct agg_node *rp; struct ripng_info *rinfo = NULL, newinfo; struct list *list = NULL; @@ -909,7 +909,7 @@ void ripng_redistribute_add(int type, int sub_type, struct prefix_ipv6 *p, if (IN6_IS_ADDR_LOOPBACK(&p->prefix)) return; - rp = route_node_get(ripng->table, (struct prefix *)p); + rp = agg_node_get(ripng->table, (struct prefix *)p); memset(&newinfo, 0, sizeof(struct ripng_info)); newinfo.type = type; @@ -928,7 +928,7 @@ void ripng_redistribute_add(int type, int sub_type, struct prefix_ipv6 *p, if (rinfo->type == ZEBRA_ROUTE_CONNECT && rinfo->sub_type == RIPNG_ROUTE_INTERFACE && rinfo->metric != RIPNG_METRIC_INFINITY) { - route_unlock_node(rp); + agg_unlock_node(rp); return; } @@ -941,13 +941,13 @@ void ripng_redistribute_add(int type, int sub_type, struct prefix_ipv6 *p, if (type != ZEBRA_ROUTE_RIPNG || ((sub_type != RIPNG_ROUTE_STATIC) && (sub_type != RIPNG_ROUTE_DEFAULT))) { - route_unlock_node(rp); + agg_unlock_node(rp); return; } } ripng_ecmp_replace(&newinfo); - route_unlock_node(rp); + agg_unlock_node(rp); } else ripng_ecmp_add(&newinfo); @@ -972,7 +972,7 @@ void ripng_redistribute_add(int type, int sub_type, struct prefix_ipv6 *p, void ripng_redistribute_delete(int type, int sub_type, struct prefix_ipv6 *p, ifindex_t ifindex) { - struct route_node *rp; + struct agg_node *rp; struct ripng_info *rinfo; if (IN6_IS_ADDR_LINKLOCAL(&p->prefix)) @@ -980,7 +980,7 @@ void ripng_redistribute_delete(int type, int sub_type, struct prefix_ipv6 *p, if (IN6_IS_ADDR_LOOPBACK(&p->prefix)) return; - rp = route_node_lookup(ripng->table, (struct prefix *)p); + rp = agg_node_lookup(ripng->table, (struct prefix *)p); if (rp) { struct list *list = rp->info; @@ -1014,21 +1014,21 @@ void ripng_redistribute_delete(int type, int sub_type, struct prefix_ipv6 *p, ripng_event(RIPNG_TRIGGERED_UPDATE, 0); } } - route_unlock_node(rp); + agg_unlock_node(rp); } } /* Withdraw redistributed route. */ void ripng_redistribute_withdraw(int type) { - struct route_node *rp; + struct agg_node *rp; struct ripng_info *rinfo = NULL; struct list *list = NULL; if (!ripng) return; - for (rp = route_top(ripng->table); rp; rp = route_next(rp)) + for (rp = agg_route_top(ripng->table); rp; rp = agg_route_next(rp)) if ((list = rp->info) != NULL) { rinfo = listgetdata(listhead(list)); if ((rinfo->type == type) @@ -1199,7 +1199,7 @@ static void ripng_request_process(struct ripng_packet *packet, int size, caddr_t lim; struct rte *rte; struct prefix_ipv6 p; - struct route_node *rp; + struct agg_node *rp; struct ripng_info *rinfo; struct ripng_interface *ri; @@ -1255,14 +1255,13 @@ static void ripng_request_process(struct ripng_packet *packet, int size, p.prefixlen = rte->prefixlen; apply_mask_ipv6(&p); - rp = route_node_lookup(ripng->table, - (struct prefix *)&p); + rp = agg_node_lookup(ripng->table, (struct prefix *)&p); if (rp) { rinfo = listgetdata( listhead((struct list *)rp->info)); rte->metric = rinfo->metric; - route_unlock_node(rp); + agg_unlock_node(rp); } else rte->metric = RIPNG_METRIC_INFINITY; } @@ -1361,12 +1360,12 @@ static int ripng_read(struct thread *thread) /* Walk down the RIPng routing table then clear changed flag. */ static void ripng_clear_changed_flag(void) { - struct route_node *rp; + struct agg_node *rp; struct ripng_info *rinfo = NULL; struct list *list = NULL; struct listnode *listnode = NULL; - for (rp = route_top(ripng->table); rp; rp = route_next(rp)) + for (rp = agg_route_top(ripng->table); rp; rp = agg_route_next(rp)) if ((list = rp->info) != NULL) for (ALL_LIST_ELEMENTS_RO(list, listnode, rinfo)) { UNSET_FLAG(rinfo->flags, RIPNG_RTF_CHANGED); @@ -1535,7 +1534,7 @@ void ripng_output_process(struct interface *ifp, struct sockaddr_in6 *to, int route_type) { int ret; - struct route_node *rp; + struct agg_node *rp; struct ripng_info *rinfo; struct ripng_interface *ri; struct ripng_aggregate *aggregate; @@ -1558,7 +1557,7 @@ void ripng_output_process(struct interface *ifp, struct sockaddr_in6 *to, ripng_rte_list = ripng_rte_new(); - for (rp = route_top(ripng->table); rp; rp = route_next(rp)) { + for (rp = agg_route_top(ripng->table); rp; rp = agg_route_next(rp)) { if ((list = rp->info) != NULL && (rinfo = listgetdata(listhead(list))) != NULL && rinfo->suppress == 0) { @@ -1807,9 +1806,9 @@ static int ripng_create(void) ripng->obuf = stream_new(RIPNG_MAX_PACKET_SIZE); /* Initialize RIPng routig table. */ - ripng->table = route_table_init(); - ripng->route = route_table_init(); - ripng->aggregate = route_table_init(); + ripng->table = agg_table_init(); + ripng->route = agg_table_init(); + ripng->aggregate = agg_table_init(); /* Make socket. */ ripng->sock = ripng_make_socket(); @@ -1952,7 +1951,7 @@ DEFUN (show_ipv6_ripng, IPV6_STR "Show RIPng routes\n") { - struct route_node *rp; + struct agg_node *rp; struct ripng_info *rinfo; struct ripng_aggregate *aggregate; struct prefix_ipv6 *p; @@ -1971,7 +1970,7 @@ DEFUN (show_ipv6_ripng, " (i) - interface, (a/S) - aggregated/Suppressed\n\n" " Network Next Hop Via Metric Tag Time\n"); - for (rp = route_top(ripng->table); rp; rp = route_next(rp)) { + for (rp = agg_route_top(ripng->table); rp; rp = agg_route_next(rp)) { if ((aggregate = rp->aggregate) != NULL) { p = (struct prefix_ipv6 *)&rp->p; @@ -2125,13 +2124,13 @@ DEFUN (clear_ipv6_rip, IPV6_STR "Clear IPv6 RIP database\n") { - struct route_node *rp; + struct agg_node *rp; struct ripng_info *rinfo; struct list *list; struct listnode *listnode; /* Clear received RIPng routes */ - for (rp = route_top(ripng->table); rp; rp = route_next(rp)) { + for (rp = agg_route_top(ripng->table); rp; rp = agg_route_next(rp)) { list = rp->info; if (list == NULL) continue; @@ -2155,7 +2154,7 @@ DEFUN (clear_ipv6_rip, if (list_isempty(list)) { list_delete_and_null(&list); rp->info = NULL; - route_unlock_node(rp); + agg_unlock_node(rp); } } @@ -2206,7 +2205,7 @@ DEFUN (ripng_route, int idx_ipv6addr = 1; int ret; struct prefix_ipv6 p; - struct route_node *rp; + struct agg_node *rp; ret = str2prefix_ipv6(argv[idx_ipv6addr]->arg, (struct prefix_ipv6 *)&p); @@ -2216,10 +2215,10 @@ DEFUN (ripng_route, } apply_mask_ipv6(&p); - rp = route_node_get(ripng->route, (struct prefix *)&p); + rp = agg_node_get(ripng->route, (struct prefix *)&p); if (rp->info) { vty_out(vty, "There is already same static route.\n"); - route_unlock_node(rp); + agg_unlock_node(rp); return CMD_WARNING; } rp->info = (void *)1; @@ -2240,7 +2239,7 @@ DEFUN (no_ripng_route, int idx_ipv6addr = 2; int ret; struct prefix_ipv6 p; - struct route_node *rp; + struct agg_node *rp; ret = str2prefix_ipv6(argv[idx_ipv6addr]->arg, (struct prefix_ipv6 *)&p); @@ -2250,17 +2249,17 @@ DEFUN (no_ripng_route, } apply_mask_ipv6(&p); - rp = route_node_lookup(ripng->route, (struct prefix *)&p); + rp = agg_node_lookup(ripng->route, (struct prefix *)&p); if (!rp) { vty_out(vty, "Can't find static route.\n"); return CMD_WARNING_CONFIG_FAILED; } ripng_redistribute_delete(ZEBRA_ROUTE_RIPNG, RIPNG_ROUTE_STATIC, &p, 0); - route_unlock_node(rp); + agg_unlock_node(rp); rp->info = NULL; - route_unlock_node(rp); + agg_unlock_node(rp); return CMD_SUCCESS; } @@ -2274,7 +2273,7 @@ DEFUN (ripng_aggregate_address, int idx_ipv6_prefixlen = 1; int ret; struct prefix p; - struct route_node *node; + struct agg_node *node; ret = str2prefix_ipv6(argv[idx_ipv6_prefixlen]->arg, (struct prefix_ipv6 *)&p); @@ -2284,10 +2283,10 @@ DEFUN (ripng_aggregate_address, } /* Check aggregate alredy exist or not. */ - node = route_node_get(ripng->aggregate, &p); + node = agg_node_get(ripng->aggregate, &p); if (node->info) { vty_out(vty, "There is already same aggregate route.\n"); - route_unlock_node(node); + agg_unlock_node(node); return CMD_WARNING; } node->info = (void *)1; @@ -2307,7 +2306,7 @@ DEFUN (no_ripng_aggregate_address, int idx_ipv6_prefixlen = 2; int ret; struct prefix p; - struct route_node *rn; + struct agg_node *rn; ret = str2prefix_ipv6(argv[idx_ipv6_prefixlen]->arg, (struct prefix_ipv6 *)&p); @@ -2316,14 +2315,14 @@ DEFUN (no_ripng_aggregate_address, return CMD_WARNING_CONFIG_FAILED; } - rn = route_node_lookup(ripng->aggregate, &p); + rn = agg_node_lookup(ripng->aggregate, &p); if (!rn) { vty_out(vty, "Can't find aggregate route.\n"); return CMD_WARNING_CONFIG_FAILED; } - route_unlock_node(rn); + agg_unlock_node(rn); rn->info = NULL; - route_unlock_node(rn); + agg_unlock_node(rn); ripng_aggregate_delete(&p); @@ -2582,7 +2581,7 @@ DEFUN (no_ripng_default_information_originate, /* Update ECMP routes to zebra when ECMP is disabled. */ static void ripng_ecmp_disable(void) { - struct route_node *rp; + struct agg_node *rp; struct ripng_info *rinfo, *tmp_rinfo; struct list *list; struct listnode *node, *nextnode; @@ -2590,7 +2589,7 @@ static void ripng_ecmp_disable(void) if (!ripng) return; - for (rp = route_top(ripng->table); rp; rp = route_next(rp)) + for (rp = agg_route_top(ripng->table); rp; rp = agg_route_next(rp)) if ((list = rp->info) != NULL && listcount(list) > 1) { rinfo = listgetdata(listhead(list)); if (!ripng_route_rte(rinfo)) @@ -2655,7 +2654,7 @@ static int ripng_config_write(struct vty *vty) int ripng_network_write(struct vty *, int); void ripng_redistribute_write(struct vty *, int); int write = 0; - struct route_node *rp; + struct agg_node *rp; if (ripng) { @@ -2678,7 +2677,8 @@ static int ripng_config_write(struct vty *vty) config_write_ripng_offset_list(vty); /* RIPng aggregate routes. */ - for (rp = route_top(ripng->aggregate); rp; rp = route_next(rp)) + for (rp = agg_route_top(ripng->aggregate); rp; + rp = agg_route_next(rp)) if (rp->info != NULL) vty_out(vty, " aggregate-address %s/%d\n", inet6_ntoa(rp->p.u.prefix6), @@ -2689,7 +2689,8 @@ static int ripng_config_write(struct vty *vty) vty_out(vty, " allow-ecmp\n"); /* RIPng static routes. */ - for (rp = route_top(ripng->route); rp; rp = route_next(rp)) + for (rp = agg_route_top(ripng->route); rp; + rp = agg_route_next(rp)) if (rp->info != NULL) vty_out(vty, " route %s/%d\n", inet6_ntoa(rp->p.u.prefix6), @@ -2811,7 +2812,7 @@ static void ripng_distribute_update_all_wrapper(struct access_list *notused) void ripng_clean() { int i; - struct route_node *rp; + struct agg_node *rp; struct ripng_info *rinfo; struct ripng_aggregate *aggregate; struct list *list = NULL; @@ -2819,7 +2820,8 @@ void ripng_clean() if (ripng) { /* Clear RIPng routes */ - for (rp = route_top(ripng->table); rp; rp = route_next(rp)) { + for (rp = agg_route_top(ripng->table); rp; + rp = agg_route_next(rp)) { if ((list = rp->info) != NULL) { rinfo = listgetdata(listhead(list)); if (ripng_route_rte(rinfo)) @@ -2834,13 +2836,13 @@ void ripng_clean() } list_delete_and_null(&list); rp->info = NULL; - route_unlock_node(rp); + agg_unlock_node(rp); } if ((aggregate = rp->aggregate) != NULL) { ripng_aggregate_free(aggregate); rp->aggregate = NULL; - route_unlock_node(rp); + agg_unlock_node(rp); } } @@ -2862,17 +2864,19 @@ void ripng_clean() } /* Static RIPng route configuration. */ - for (rp = route_top(ripng->route); rp; rp = route_next(rp)) + for (rp = agg_route_top(ripng->route); rp; + rp = agg_route_next(rp)) if (rp->info) { rp->info = NULL; - route_unlock_node(rp); + agg_unlock_node(rp); } /* RIPng aggregated prefixes */ - for (rp = route_top(ripng->aggregate); rp; rp = route_next(rp)) + for (rp = agg_route_top(ripng->aggregate); rp; + rp = agg_route_next(rp)) if (rp->info) { rp->info = NULL; - route_unlock_node(rp); + agg_unlock_node(rp); } for (i = 0; i < ZEBRA_ROUTE_MAX; i++) diff --git a/ripngd/ripngd.h b/ripngd/ripngd.h index 534905d895..1095a33494 100644 --- a/ripngd/ripngd.h +++ b/ripngd/ripngd.h @@ -109,13 +109,13 @@ struct ripng { struct stream *obuf; /* RIPng routing information base. */ - struct route_table *table; + struct agg_table *table; /* RIPng only static route information. */ - struct route_table *route; + struct agg_table *route; /* RIPng aggregate route information. */ - struct route_table *aggregate; + struct agg_table *aggregate; /* RIPng threads. */ struct thread *t_read; @@ -198,7 +198,7 @@ struct ripng_info { uint8_t metric_out; uint16_t tag_out; - struct route_node *rp; + struct agg_node *rp; }; #ifdef notyet @@ -377,8 +377,8 @@ extern void ripng_redistribute_withdraw(int type); extern void ripng_distribute_update_interface(struct interface *); extern void ripng_if_rmap_update_interface(struct interface *); -extern void ripng_zebra_ipv6_add(struct route_node *); -extern void ripng_zebra_ipv6_delete(struct route_node *); +extern void ripng_zebra_ipv6_add(struct agg_node *node); +extern void ripng_zebra_ipv6_delete(struct agg_node *node); extern void ripng_redistribute_clean(void); extern int ripng_redistribute_check(int); |
