summaryrefslogtreecommitdiff
path: root/isisd/isis_route.c
diff options
context:
space:
mode:
authorhasso <hasso>2004-09-10 20:48:21 +0000
committerhasso <hasso>2004-09-10 20:48:21 +0000
commitf390d2c7839c04100e4de8246215ce10ea96b653 (patch)
tree9910d250bfb6605d44e7104ef786ba0c84ddb01a /isisd/isis_route.c
parentf3f27f60fdfc81fce2944ee89087417b04935663 (diff)
Indentation only. No any functional changes.
Diffstat (limited to 'isisd/isis_route.c')
-rw-r--r--isisd/isis_route.c568
1 files changed, 301 insertions, 267 deletions
diff --git a/isisd/isis_route.c b/isisd/isis_route.c
index b889d3b8..90808681 100644
--- a/isisd/isis_route.c
+++ b/isisd/isis_route.c
@@ -55,27 +55,28 @@ extern struct thread_master *master;
struct isis_nexthop *
isis_nexthop_create (struct in_addr *ip, unsigned int ifindex)
-
{
struct listnode *node;
struct isis_nexthop *nexthop;
-
- for (node = listhead (isis->nexthops); node; nextnode (node)) {
- nexthop = getdata (node);
- if (nexthop->ifindex != ifindex)
- continue;
- if (ip && memcmp (&nexthop->ip, ip, sizeof (struct in_addr)) != 0)
- continue;
-
- nexthop->lock++;
- return nexthop;
- }
-
+
+ for (node = listhead (isis->nexthops); node; nextnode (node))
+ {
+ nexthop = getdata (node);
+ if (nexthop->ifindex != ifindex)
+ continue;
+ if (ip && memcmp (&nexthop->ip, ip, sizeof (struct in_addr)) != 0)
+ continue;
+
+ nexthop->lock++;
+ return nexthop;
+ }
+
nexthop = XMALLOC (MTYPE_ISIS_NEXTHOP, sizeof (struct isis_nexthop));
- if (!nexthop) {
- zlog_err ("ISIS-Rte: isis_nexthop_create: out of memory!");
- }
-
+ if (!nexthop)
+ {
+ zlog_err ("ISIS-Rte: isis_nexthop_create: out of memory!");
+ }
+
memset (nexthop, 0, sizeof (struct isis_nexthop));
nexthop->ifindex = ifindex;
memcpy (&nexthop->ip, ip, sizeof (struct in_addr));
@@ -85,32 +86,33 @@ isis_nexthop_create (struct in_addr *ip, unsigned int ifindex)
return nexthop;
}
-
void
isis_nexthop_delete (struct isis_nexthop *nexthop)
{
nexthop->lock--;
- if (nexthop->lock == 0) {
- listnode_delete (isis->nexthops, nexthop);
- XFREE (MTYPE_ISIS_NEXTHOP, nexthop);
- }
-
+ if (nexthop->lock == 0)
+ {
+ listnode_delete (isis->nexthops, nexthop);
+ XFREE (MTYPE_ISIS_NEXTHOP, nexthop);
+ }
+
return;
}
int
-nexthoplookup (struct list *nexthops, struct in_addr *ip,
- unsigned int ifindex)
+nexthoplookup (struct list *nexthops, struct in_addr *ip,
+ unsigned int ifindex)
{
struct listnode *node;
struct isis_nexthop *nh;
- for (node = listhead (nexthops); node; nextnode (node)) {
- nh = getdata (node);
- if (!(memcmp (ip, &nh->ip, sizeof (struct in_addr))) &&
- ifindex == nh->ifindex)
- return 1;
- }
+ for (node = listhead (nexthops); node; nextnode (node))
+ {
+ nh = getdata (node);
+ if (!(memcmp (ip, &nh->ip, sizeof (struct in_addr))) &&
+ ifindex == nh->ifindex)
+ return 1;
+ }
return 0;
}
@@ -119,9 +121,9 @@ void
nexthop_print (struct isis_nexthop *nh)
{
u_char buf[BUFSIZ];
-
+
inet_ntop (AF_INET, &nh->ip, buf, BUFSIZ);
-
+
zlog_info (" %s %u", buf, nh->ifindex);
}
@@ -129,24 +131,25 @@ void
nexthops_print (struct list *nhs)
{
struct listnode *node;
-
- for (node = listhead(nhs); node; nextnode (node))
+
+ for (node = listhead (nhs); node; nextnode (node))
nexthop_print (getdata (node));
}
#ifdef HAVE_IPV6
struct isis_nexthop6 *
-isis_nexthop6_new (struct in6_addr *ip6, unsigned int ifindex)
+isis_nexthop6_new (struct in6_addr *ip6, unsigned int ifindex)
{
-
+
struct isis_nexthop6 *nexthop6;
-
+
nexthop6 = XMALLOC (MTYPE_ISIS_NEXTHOP6, sizeof (struct isis_nexthop6));
- if (!nexthop6) {
- zlog_err ("ISIS-Rte: isis_nexthop_create6: out of memory!");
- }
-
+ if (!nexthop6)
+ {
+ zlog_err ("ISIS-Rte: isis_nexthop_create6: out of memory!");
+ }
+
memset (nexthop6, 0, sizeof (struct isis_nexthop6));
nexthop6->ifindex = ifindex;
memcpy (&nexthop6->ip6, ip6, sizeof (struct in6_addr));
@@ -157,54 +160,55 @@ isis_nexthop6_new (struct in6_addr *ip6, unsigned int ifindex)
struct isis_nexthop6 *
isis_nexthop6_create (struct in6_addr *ip6, unsigned int ifindex)
-
{
struct listnode *node;
struct isis_nexthop6 *nexthop6;
-
- for (node = listhead (isis->nexthops6); node; nextnode (node)) {
- nexthop6 = getdata (node);
- if (nexthop6->ifindex != ifindex)
- continue;
- if (ip6 && memcmp (&nexthop6->ip6, ip6, sizeof (struct in6_addr)) != 0)
- continue;
-
- nexthop6->lock++;
- return nexthop6;
- }
-
+
+ for (node = listhead (isis->nexthops6); node; nextnode (node))
+ {
+ nexthop6 = getdata (node);
+ if (nexthop6->ifindex != ifindex)
+ continue;
+ if (ip6 && memcmp (&nexthop6->ip6, ip6, sizeof (struct in6_addr)) != 0)
+ continue;
+
+ nexthop6->lock++;
+ return nexthop6;
+ }
+
nexthop6 = isis_nexthop6_new (ip6, ifindex);
return nexthop6;
}
-
void
isis_nexthop6_delete (struct isis_nexthop6 *nexthop6)
{
nexthop6->lock--;
- if (nexthop6->lock == 0) {
- listnode_delete (isis->nexthops6, nexthop6);
- XFREE (MTYPE_ISIS_NEXTHOP6, nexthop6);
- }
-
+ if (nexthop6->lock == 0)
+ {
+ listnode_delete (isis->nexthops6, nexthop6);
+ XFREE (MTYPE_ISIS_NEXTHOP6, nexthop6);
+ }
+
return;
}
int
-nexthop6lookup (struct list *nexthops6, struct in6_addr *ip6,
- unsigned int ifindex)
+nexthop6lookup (struct list *nexthops6, struct in6_addr *ip6,
+ unsigned int ifindex)
{
struct listnode *node;
struct isis_nexthop6 *nh6;
- for (node = listhead (nexthops6); node; nextnode (node)) {
- nh6 = getdata (node);
- if (!(memcmp (ip6, &nh6->ip6, sizeof (struct in6_addr))) &&
- ifindex == nh6->ifindex)
- return 1;
- }
+ for (node = listhead (nexthops6); node; nextnode (node))
+ {
+ nh6 = getdata (node);
+ if (!(memcmp (ip6, &nh6->ip6, sizeof (struct in6_addr))) &&
+ ifindex == nh6->ifindex)
+ return 1;
+ }
return 0;
}
@@ -213,9 +217,9 @@ void
nexthop6_print (struct isis_nexthop6 *nh6)
{
u_char buf[BUFSIZ];
-
+
inet_ntop (AF_INET6, &nh6->ip6, buf, BUFSIZ);
-
+
zlog_info (" %s %u", buf, nh6->ifindex);
}
@@ -223,8 +227,8 @@ void
nexthops6_print (struct list *nhs6)
{
struct listnode *node;
-
- for (node = listhead(nhs6); node; nextnode (node))
+
+ for (node = listhead (nhs6); node; nextnode (node))
nexthop6_print (getdata (node));
}
@@ -240,15 +244,17 @@ adjinfo2nexthop (struct list *nexthops, struct isis_adjacency *adj)
if (adj->ipv4_addrs == NULL)
return;
- for (node = listhead (adj->ipv4_addrs); node; nextnode (node)) {
- ipv4_addr = getdata (node);
- if (!nexthoplookup (nexthops, ipv4_addr,
- adj->circuit->interface->ifindex)) {
- nh = isis_nexthop_create (ipv4_addr,
- adj->circuit->interface->ifindex);
- listnode_add (nexthops, nh);
+ for (node = listhead (adj->ipv4_addrs); node; nextnode (node))
+ {
+ ipv4_addr = getdata (node);
+ if (!nexthoplookup (nexthops, ipv4_addr,
+ adj->circuit->interface->ifindex))
+ {
+ nh = isis_nexthop_create (ipv4_addr,
+ adj->circuit->interface->ifindex);
+ listnode_add (nexthops, nh);
+ }
}
- }
}
#ifdef HAVE_IPV6
@@ -258,156 +264,170 @@ adjinfo2nexthop6 (struct list *nexthops6, struct isis_adjacency *adj)
struct listnode *node;
struct in6_addr *ipv6_addr;
struct isis_nexthop6 *nh6;
-
+
if (!adj->ipv6_addrs)
return;
- for (node = listhead (adj->ipv6_addrs); node; nextnode (node)) {
- ipv6_addr = getdata (node);
- if (!nexthop6lookup (nexthops6, ipv6_addr,
- adj->circuit->interface->ifindex)) {
- nh6 = isis_nexthop6_create (ipv6_addr,
- adj->circuit->interface->ifindex);
- listnode_add (nexthops6, nh6);
+ for (node = listhead (adj->ipv6_addrs); node; nextnode (node))
+ {
+ ipv6_addr = getdata (node);
+ if (!nexthop6lookup (nexthops6, ipv6_addr,
+ adj->circuit->interface->ifindex))
+ {
+ nh6 = isis_nexthop6_create (ipv6_addr,
+ adj->circuit->interface->ifindex);
+ listnode_add (nexthops6, nh6);
+ }
}
- }
}
#endif /* HAVE_IPV6 */
struct isis_route_info *
-isis_route_info_new (uint32_t cost, uint32_t depth, u_char family,
- struct list *adjacencies)
+isis_route_info_new (uint32_t cost, uint32_t depth, u_char family,
+ struct list *adjacencies)
{
struct isis_route_info *rinfo;
struct isis_adjacency *adj;
struct listnode *node;
-
+
rinfo = XMALLOC (MTYPE_ISIS_ROUTE_INFO, sizeof (struct isis_route_info));
- if (!rinfo) {
- zlog_err ("ISIS-Rte: isis_route_info_new: out of memory!");
- return NULL;
- }
+ if (!rinfo)
+ {
+ zlog_err ("ISIS-Rte: isis_route_info_new: out of memory!");
+ return NULL;
+ }
memset (rinfo, 0, sizeof (struct isis_route_info));
- if (family == AF_INET) {
- rinfo->nexthops = list_new ();
- for (node = listhead (adjacencies); node; nextnode (node)) {
- adj = getdata (node);
- adjinfo2nexthop (rinfo->nexthops, adj);
+ if (family == AF_INET)
+ {
+ rinfo->nexthops = list_new ();
+ for (node = listhead (adjacencies); node; nextnode (node))
+ {
+ adj = getdata (node);
+ adjinfo2nexthop (rinfo->nexthops, adj);
+ }
}
- }
#ifdef HAVE_IPV6
- if (family == AF_INET6) {
- rinfo->nexthops6 = list_new ();
- for (node = listhead (adjacencies); node; nextnode (node)) {
- adj =getdata (node);
- adjinfo2nexthop6 (rinfo->nexthops6, adj);
+ if (family == AF_INET6)
+ {
+ rinfo->nexthops6 = list_new ();
+ for (node = listhead (adjacencies); node; nextnode (node))
+ {
+ adj = getdata (node);
+ adjinfo2nexthop6 (rinfo->nexthops6, adj);
+ }
}
- }
-
+
#endif /* HAVE_IPV6 */
rinfo->cost = cost;
rinfo->depth = depth;
-
+
return rinfo;
}
-
void
isis_route_info_delete (struct isis_route_info *route_info)
{
-
- if (route_info->nexthops) {
- route_info->nexthops->del = (void *)isis_nexthop_delete;
- list_delete (route_info->nexthops);
- }
-
+ if (route_info->nexthops)
+ {
+ route_info->nexthops->del = (void *) isis_nexthop_delete;
+ list_delete (route_info->nexthops);
+ }
+
#ifdef HAVE_IPV6
- if (route_info->nexthops6) {
- route_info->nexthops6->del = (void *)isis_nexthop6_delete;
+ if (route_info->nexthops6)
+ {
+ route_info->nexthops6->del = (void *) isis_nexthop6_delete;
list_delete (route_info->nexthops6);
- }
+ }
#endif /* HAVE_IPV6 */
-
+
XFREE (MTYPE_ISIS_ROUTE_INFO, route_info);
}
int
-isis_route_info_same_attrib (struct isis_route_info *new,
- struct isis_route_info *old)
+isis_route_info_same_attrib (struct isis_route_info *new,
+ struct isis_route_info *old)
{
if (new->cost != old->cost)
return 0;
if (new->depth != old->depth)
return 0;
-
+
return 1;
}
int
-isis_route_info_same (struct isis_route_info *new, struct isis_route_info *old,
- u_char family)
+isis_route_info_same (struct isis_route_info *new,
+ struct isis_route_info *old, u_char family)
{
- struct listnode *node;
+ struct listnode *node;
struct isis_nexthop *nexthop;
#ifdef HAVE_IPV6
struct isis_nexthop6 *nexthop6;
#endif /* HAVE_IPV6 */
if (!isis_route_info_same_attrib (new, old))
return 0;
-
- if (family == AF_INET) {
- for (node = listhead (new->nexthops); node; nextnode (node)) {
- nexthop = (struct isis_nexthop *) getdata (node);
- if (nexthoplookup (old->nexthops, &nexthop->ip, nexthop->ifindex) == 0)
- return 0;
- }
-
- for (node = listhead (old->nexthops); node; nextnode (node)) {
- nexthop = (struct isis_nexthop *) getdata (node);
- if (nexthoplookup (new->nexthops, &nexthop->ip, nexthop->ifindex) == 0)
- return 0;
+
+ if (family == AF_INET)
+ {
+ for (node = listhead (new->nexthops); node; nextnode (node))
+ {
+ nexthop = (struct isis_nexthop *) getdata (node);
+ if (nexthoplookup (old->nexthops, &nexthop->ip, nexthop->ifindex) ==
+ 0)
+ return 0;
+ }
+
+ for (node = listhead (old->nexthops); node; nextnode (node))
+ {
+ nexthop = (struct isis_nexthop *) getdata (node);
+ if (nexthoplookup (new->nexthops, &nexthop->ip, nexthop->ifindex) ==
+ 0)
+ return 0;
+ }
}
- }
#ifdef HAVE_IPV6
- else if (family == AF_INET6) {
- for (node = listhead (new->nexthops6); node; nextnode (node)) {
- nexthop6 = (struct isis_nexthop6 *) getdata (node);
- if (nexthop6lookup (old->nexthops6, &nexthop6->ip6,
- nexthop6->ifindex) == 0)
- return 0;
- }
-
- for (node = listhead (old->nexthops6); node; nextnode (node)) {
- nexthop6 = (struct isis_nexthop6 *) getdata (node);
- if (nexthop6lookup (new->nexthops6, &nexthop6->ip6,
- nexthop6->ifindex) == 0)
- return 0;
+ else if (family == AF_INET6)
+ {
+ for (node = listhead (new->nexthops6); node; nextnode (node))
+ {
+ nexthop6 = (struct isis_nexthop6 *) getdata (node);
+ if (nexthop6lookup (old->nexthops6, &nexthop6->ip6,
+ nexthop6->ifindex) == 0)
+ return 0;
+ }
+
+ for (node = listhead (old->nexthops6); node; nextnode (node))
+ {
+ nexthop6 = (struct isis_nexthop6 *) getdata (node);
+ if (nexthop6lookup (new->nexthops6, &nexthop6->ip6,
+ nexthop6->ifindex) == 0)
+ return 0;
+ }
}
- }
#endif /* HAVE_IPV6 */
return 1;
}
-
void
isis_nexthops_merge (struct list *new, struct list *old)
{
struct listnode *node;
struct isis_nexthop *nexthop;
- for (node = listhead (new); node; nextnode (node)) {
- nexthop = (struct isis_nexthop *) getdata (node);
- if (nexthoplookup (old, &nexthop->ip, nexthop->ifindex))
- continue;
- listnode_add (old, nexthop);
- nexthop->lock++;
- }
+ for (node = listhead (new); node; nextnode (node))
+ {
+ nexthop = (struct isis_nexthop *) getdata (node);
+ if (nexthoplookup (old, &nexthop->ip, nexthop->ifindex))
+ continue;
+ listnode_add (old, nexthop);
+ nexthop->lock++;
+ }
}
-
#ifdef HAVE_IPV6
void
isis_nexthops6_merge (struct list *new, struct list *old)
@@ -415,123 +435,133 @@ isis_nexthops6_merge (struct list *new, struct list *old)
struct listnode *node;
struct isis_nexthop6 *nexthop6;
- for (node = listhead (new); node; nextnode (node)) {
- nexthop6 = (struct isis_nexthop6 *) getdata (node);
- if (nexthop6lookup (old, &nexthop6->ip6, nexthop6->ifindex))
- continue;
- listnode_add (old, nexthop6);
- nexthop6->lock++;
- }
+ for (node = listhead (new); node; nextnode (node))
+ {
+ nexthop6 = (struct isis_nexthop6 *) getdata (node);
+ if (nexthop6lookup (old, &nexthop6->ip6, nexthop6->ifindex))
+ continue;
+ listnode_add (old, nexthop6);
+ nexthop6->lock++;
+ }
}
#endif /* HAVE_IPV6 */
void
-isis_route_info_merge (struct isis_route_info *new,
- struct isis_route_info *old, u_char family)
+isis_route_info_merge (struct isis_route_info *new,
+ struct isis_route_info *old, u_char family)
{
-
- if (family == AF_INET)
+ if (family == AF_INET)
isis_nexthops_merge (new->nexthops, old->nexthops);
#ifdef HAVE_IPV6
- else if (family == AF_INET6)
+ else if (family == AF_INET6)
isis_nexthops6_merge (new->nexthops6, old->nexthops6);
#endif /* HAVE_IPV6 */
-
+
return;
}
-
int
-isis_route_info_prefer_new (struct isis_route_info *new,
- struct isis_route_info *old)
+isis_route_info_prefer_new (struct isis_route_info *new,
+ struct isis_route_info *old)
{
-
if (!CHECK_FLAG (old->flag, ISIS_ROUTE_FLAG_ACTIVE))
return 1;
if (new->cost < old->cost)
return 1;
-
+
return 0;
}
-
struct isis_route_info *
isis_route_create (struct prefix *prefix, u_int32_t cost, u_int32_t depth,
- struct list *adjacencies, struct isis_area *area)
+ struct list *adjacencies, struct isis_area *area)
{
struct route_node *route_node;
struct isis_route_info *rinfo_new, *rinfo_old, *route_info = NULL;
u_char buff[BUFSIZ];
u_char family;
-
+
family = prefix->family;
/* for debugs */
prefix2str (prefix, buff, BUFSIZ);
-
+
rinfo_new = isis_route_info_new (cost, depth, family, adjacencies);
- if (!rinfo_new) {
- zlog_err ("ISIS-Rte (%s): isis_route_create: out of memory!",
- area->area_tag);
- return NULL;
- }
-
+ if (!rinfo_new)
+ {
+ zlog_err ("ISIS-Rte (%s): isis_route_create: out of memory!",
+ area->area_tag);
+ return NULL;
+ }
+
if (family == AF_INET)
- route_node = route_node_get (area->route_table, prefix);
+ route_node = route_node_get (area->route_table, prefix);
#ifdef HAVE_IPV6
else if (family == AF_INET6)
- route_node = route_node_get (area->route_table6, prefix);
+ route_node = route_node_get (area->route_table6, prefix);
#endif /* HAVE_IPV6 */
- else
+ else
return NULL;
- rinfo_old = route_node->info;
- if (!rinfo_old) {
- if (isis->debugs & DEBUG_RTE_EVENTS)
- zlog_info ("ISIS-Rte (%s) route created: %s", area->area_tag, buff);
- SET_FLAG(rinfo_new->flag, ISIS_ROUTE_FLAG_ACTIVE);
- route_node->info = rinfo_new;
- return rinfo_new;
- }
-
+ rinfo_old = route_node->info;
+ if (!rinfo_old)
+ {
+ if (isis->debugs & DEBUG_RTE_EVENTS)
+ zlog_info ("ISIS-Rte (%s) route created: %s", area->area_tag, buff);
+ SET_FLAG (rinfo_new->flag, ISIS_ROUTE_FLAG_ACTIVE);
+ route_node->info = rinfo_new;
+ return rinfo_new;
+ }
+
if (isis->debugs & DEBUG_RTE_EVENTS)
- zlog_info ("ISIS-Rte (%s) route already exists: %s", area->area_tag, buff);
-
- if (isis_route_info_same (rinfo_new, rinfo_old, family)) {
- if (isis->debugs & DEBUG_RTE_EVENTS)
- zlog_info ("ISIS-Rte (%s) route unchanged: %s", area->area_tag, buff);
- isis_route_info_delete (rinfo_new);
- route_info = rinfo_old;
- } else if (isis_route_info_same_attrib (rinfo_new, rinfo_old)) {
- /* merge the nexthop lists */
- if (isis->debugs & DEBUG_RTE_EVENTS)
- zlog_info ("ISIS-Rte (%s) route changed (same attribs): %s",
- area->area_tag, buff);
-#ifdef EXTREME_DEBUG
- zlog_info ("Old nexthops");
- nexthops6_print (rinfo_old->nexthops6);
- zlog_info ("New nexthops");
- nexthops6_print (rinfo_new->nexthops6);
-#endif /* EXTREME_DEBUG */
- isis_route_info_merge (rinfo_new, rinfo_old, family);
- isis_route_info_delete (rinfo_new);
- route_info = rinfo_old;
- } else {
- if (isis_route_info_prefer_new (rinfo_new, rinfo_old)) {
+ zlog_info ("ISIS-Rte (%s) route already exists: %s", area->area_tag,
+ buff);
+
+ if (isis_route_info_same (rinfo_new, rinfo_old, family))
+ {
if (isis->debugs & DEBUG_RTE_EVENTS)
- zlog_info ("ISIS-Rte (%s) route changed: %s", area->area_tag, buff);
- isis_route_info_delete (rinfo_old);
- route_info = rinfo_new;
- } else {
+ zlog_info ("ISIS-Rte (%s) route unchanged: %s", area->area_tag, buff);
+ isis_route_info_delete (rinfo_new);
+ route_info = rinfo_old;
+ }
+ else if (isis_route_info_same_attrib (rinfo_new, rinfo_old))
+ {
+ /* merge the nexthop lists */
if (isis->debugs & DEBUG_RTE_EVENTS)
- zlog_info ("ISIS-Rte (%s) route rejected: %s", area->area_tag, buff);
+ zlog_info ("ISIS-Rte (%s) route changed (same attribs): %s",
+ area->area_tag, buff);
+#ifdef EXTREME_DEBUG
+ zlog_info ("Old nexthops");
+ nexthops6_print (rinfo_old->nexthops6);
+ zlog_info ("New nexthops");
+ nexthops6_print (rinfo_new->nexthops6);
+#endif /* EXTREME_DEBUG */
+ isis_route_info_merge (rinfo_new, rinfo_old, family);
isis_route_info_delete (rinfo_new);
route_info = rinfo_old;
}
- }
-
+ else
+ {
+ if (isis_route_info_prefer_new (rinfo_new, rinfo_old))
+ {
+ if (isis->debugs & DEBUG_RTE_EVENTS)
+ zlog_info ("ISIS-Rte (%s) route changed: %s", area->area_tag,
+ buff);
+ isis_route_info_delete (rinfo_old);
+ route_info = rinfo_new;
+ }
+ else
+ {
+ if (isis->debugs & DEBUG_RTE_EVENTS)
+ zlog_info ("ISIS-Rte (%s) route rejected: %s", area->area_tag,
+ buff);
+ isis_route_info_delete (rinfo_new);
+ route_info = rinfo_old;
+ }
+ }
+
SET_FLAG (route_info->flag, ISIS_ROUTE_FLAG_ACTIVE);
route_node->info = route_info;
-
+
return route_info;
}
@@ -549,21 +579,23 @@ isis_route_delete (struct prefix *prefix, struct route_table *table)
rode = route_node_get (table, prefix);
rinfo = rode->info;
- if (rinfo == NULL) {
- if (isis->debugs & DEBUG_RTE_EVENTS)
- zlog_info ("ISIS-Rte: tried to delete non-existant route %s", buff);
- return;
- }
-
- if (CHECK_FLAG (rinfo->flag, ISIS_ROUTE_FLAG_ZEBRA_SYNC)) {
- UNSET_FLAG (rinfo->flag, ISIS_ROUTE_FLAG_ACTIVE);
- if (isis->debugs & DEBUG_RTE_EVENTS)
- zlog_info ("ISIS-Rte: route delete %s", buff);
- isis_zebra_route_update (prefix, rinfo);
- }
+ if (rinfo == NULL)
+ {
+ if (isis->debugs & DEBUG_RTE_EVENTS)
+ zlog_info ("ISIS-Rte: tried to delete non-existant route %s", buff);
+ return;
+ }
+
+ if (CHECK_FLAG (rinfo->flag, ISIS_ROUTE_FLAG_ZEBRA_SYNC))
+ {
+ UNSET_FLAG (rinfo->flag, ISIS_ROUTE_FLAG_ACTIVE);
+ if (isis->debugs & DEBUG_RTE_EVENTS)
+ zlog_info ("ISIS-Rte: route delete %s", buff);
+ isis_zebra_route_update (prefix, rinfo);
+ }
isis_route_info_delete (rinfo);
rode->info = NULL;
-
+
return;
}
@@ -581,27 +613,29 @@ isis_route_validate (struct thread *thread)
area = THREAD_ARG (thread);
table = area->route_table;
#ifdef HAVE_IPV6
- again:
+again:
#endif
- for (rode = route_top (table); rode; rode = route_next (rode)) {
- if (rode->info == NULL)
- continue;
- rinfo = rode->info;
-
- if (isis->debugs & DEBUG_RTE_EVENTS) {
- prefix2str (&rode->p, buff, BUFSIZ);
- zlog_info ("ISIS-Rte (%s): route validate: %s %s %s",
- area->area_tag,
- (CHECK_FLAG (rinfo->flag, ISIS_ROUTE_FLAG_ZEBRA_SYNC) ?
- "sync'ed": "nosync"),
- (CHECK_FLAG (rinfo->flag, ISIS_ROUTE_FLAG_ACTIVE) ?
- "active": "inactive"), buff);
+ for (rode = route_top (table); rode; rode = route_next (rode))
+ {
+ if (rode->info == NULL)
+ continue;
+ rinfo = rode->info;
+
+ if (isis->debugs & DEBUG_RTE_EVENTS)
+ {
+ prefix2str (&rode->p, buff, BUFSIZ);
+ zlog_info ("ISIS-Rte (%s): route validate: %s %s %s",
+ area->area_tag,
+ (CHECK_FLAG (rinfo->flag, ISIS_ROUTE_FLAG_ZEBRA_SYNC) ?
+ "sync'ed" : "nosync"),
+ (CHECK_FLAG (rinfo->flag, ISIS_ROUTE_FLAG_ACTIVE) ?
+ "active" : "inactive"), buff);
+ }
+
+ isis_zebra_route_update (&rode->p, rinfo);
+ if (!CHECK_FLAG (rinfo->flag, ISIS_ROUTE_FLAG_ACTIVE))
+ isis_route_delete (&rode->p, area->route_table);
}
-
- isis_zebra_route_update (&rode->p, rinfo);
- if (!CHECK_FLAG (rinfo->flag, ISIS_ROUTE_FLAG_ACTIVE))
- isis_route_delete (&rode->p, area->route_table);
- }
#ifdef HAVE_IPV6
if (v6done)
return ISIS_OK;