summaryrefslogtreecommitdiff
path: root/ospf6d/ospf6_route.c
diff options
context:
space:
mode:
Diffstat (limited to 'ospf6d/ospf6_route.c')
-rw-r--r--ospf6d/ospf6_route.c74
1 files changed, 20 insertions, 54 deletions
diff --git a/ospf6d/ospf6_route.c b/ospf6d/ospf6_route.c
index 4b87c4cf30..f5d60d80fa 100644
--- a/ospf6d/ospf6_route.c
+++ b/ospf6d/ospf6_route.c
@@ -580,9 +580,7 @@ ospf6_route_lookup_identical(struct ospf6_route *route,
for (target = ospf6_route_lookup(&route->prefix, table); target;
target = target->next) {
if (target->type == route->type
- && (memcmp(&target->prefix, &route->prefix,
- sizeof(struct prefix))
- == 0)
+ && prefix_same(&target->prefix, &route->prefix)
&& target->path.type == route->path.type
&& target->path.cost == route->path.cost
&& target->path.u.cost_e2 == route->path.u.cost_e2
@@ -706,27 +704,6 @@ struct ospf6_route *ospf6_route_add(struct ospf6_route *route,
}
if (old) {
- /* if route does not actually change, return unchanged */
- if (ospf6_route_is_identical(old, route)) {
- if (IS_OSPF6_DEBUG_ROUTE(MEMORY))
- zlog_debug(
- "%s %p: route add %p: needless update of %p old cost %u",
- ospf6_route_table_name(table),
- (void *)table, (void *)route,
- (void *)old, old->path.cost);
- else if (IS_OSPF6_DEBUG_ROUTE(TABLE))
- zlog_debug("%s: route add: needless update",
- ospf6_route_table_name(table));
-
- ospf6_route_delete(route);
- SET_FLAG(old->flag, OSPF6_ROUTE_ADD);
- ospf6_route_table_assert(table);
-
- /* to free the lookup lock */
- route_unlock_node(node);
- return old;
- }
-
if (IS_OSPF6_DEBUG_ROUTE(MEMORY))
zlog_debug(
"%s %p: route add %p cost %u paths %u nh %u: update of %p cost %u paths %u nh %u",
@@ -1098,7 +1075,6 @@ struct ospf6_route_table *ospf6_route_table_create(int s, int t)
void ospf6_route_table_delete(struct ospf6_route_table *table)
{
ospf6_route_remove_all(table);
- bf_free(table->idspace);
route_table_finish(table->table);
XFREE(MTYPE_OSPF6_ROUTE_TABLE, table);
}
@@ -1117,6 +1093,7 @@ void ospf6_route_show(struct vty *vty, struct ospf6_route *route,
json_object *json_route = NULL;
json_object *json_array_next_hops = NULL;
json_object *json_next_hop;
+ vrf_id_t vrf_id = route->ospf6->vrf_id;
monotime(&now);
timersub(&now, &route->changed, &res);
@@ -1150,16 +1127,15 @@ void ospf6_route_show(struct vty *vty, struct ospf6_route *route,
else
i = 0;
for (ALL_LIST_ELEMENTS_RO(route->nh_list, node, nh)) {
- struct interface *ifp;
/* nexthop */
inet_ntop(AF_INET6, &nh->address, nexthop, sizeof(nexthop));
- ifp = if_lookup_by_index_all_vrf(nh->ifindex);
if (use_json) {
json_next_hop = json_object_new_object();
json_object_string_add(json_next_hop, "nextHop",
nexthop);
- json_object_string_add(json_next_hop, "interfaceName",
- ifp->name);
+ json_object_string_add(
+ json_next_hop, "interfaceName",
+ ifindex2ifname(nh->ifindex, vrf_id));
json_object_array_add(json_array_next_hops,
json_next_hop);
} else {
@@ -1171,12 +1147,14 @@ void ospf6_route_show(struct vty *vty, struct ospf6_route *route,
OSPF6_PATH_TYPE_SUBSTR(
route->path.type),
destination, nexthop, IFNAMSIZ,
- ifp->name, duration);
+ ifindex2ifname(nh->ifindex, vrf_id),
+ duration);
i++;
} else
vty_out(vty, "%c%1s %2s %-30s %-25s %6.*s %s\n",
' ', "", "", "", nexthop, IFNAMSIZ,
- ifp->name, "");
+ ifindex2ifname(nh->ifindex, vrf_id),
+ "");
}
}
if (use_json) {
@@ -1200,6 +1178,7 @@ void ospf6_route_show_detail(struct vty *vty, struct ospf6_route *route,
json_object *json_route = NULL;
json_object *json_array_next_hops = NULL;
json_object *json_next_hop;
+ vrf_id_t vrf_id = route->ospf6->vrf_id;
monotime(&now);
@@ -1350,8 +1329,6 @@ void ospf6_route_show_detail(struct vty *vty, struct ospf6_route *route,
vty_out(vty, "Nexthop:\n");
for (ALL_LIST_ELEMENTS_RO(route->nh_list, node, nh)) {
- struct interface *ifp;
- ifp = if_lookup_by_index_all_vrf(nh->ifindex);
/* nexthop */
if (use_json) {
inet_ntop(AF_INET6, &nh->address, nexthop,
@@ -1359,13 +1336,14 @@ void ospf6_route_show_detail(struct vty *vty, struct ospf6_route *route,
json_next_hop = json_object_new_object();
json_object_string_add(json_next_hop, "nextHop",
nexthop);
- json_object_string_add(json_next_hop, "interfaceName",
- ifp->name);
+ json_object_string_add(
+ json_next_hop, "interfaceName",
+ ifindex2ifname(nh->ifindex, vrf_id));
json_object_array_add(json_array_next_hops,
json_next_hop);
} else
vty_out(vty, " %pI6 %.*s\n", &nh->address, IFNAMSIZ,
- ifp->name);
+ ifindex2ifname(nh->ifindex, vrf_id));
}
if (use_json) {
json_object_object_add(json_route, "nextHops",
@@ -1632,12 +1610,8 @@ int ospf6_route_table_show(struct vty *vty, int argc_start, int argc,
/* Give summary of this route table */
if (summary) {
ospf6_route_show_table_summary(vty, table, json, use_json);
- if (use_json) {
- vty_out(vty, "%s\n",
- json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
- json_object_free(json);
- }
+ if (use_json)
+ vty_json(vty, json);
return CMD_SUCCESS;
}
@@ -1651,12 +1625,8 @@ int ospf6_route_table_show(struct vty *vty, int argc_start, int argc,
ospf6_route_show_table_prefix(vty, &prefix, table, json,
use_json);
- if (use_json) {
- vty_out(vty, "%s\n",
- json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
- json_object_free(json);
- }
+ if (use_json)
+ vty_json(vty, json);
return CMD_SUCCESS;
}
@@ -1669,12 +1639,8 @@ int ospf6_route_table_show(struct vty *vty, int argc_start, int argc,
else
ospf6_route_show_table(vty, detail, table, json, use_json);
- if (use_json) {
- vty_out(vty, "%s\n",
- json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
- json_object_free(json);
- }
+ if (use_json)
+ vty_json(vty, json);
return CMD_SUCCESS;
}