/* global ospf6d variable */
struct ospf6 *ospf6;
-void
+static void
ospf6_top_lsdb_hook_add (struct ospf6_lsa *lsa)
{
switch (ntohs (lsa->header->type))
}
}
-void
+static void
ospf6_top_lsdb_hook_remove (struct ospf6_lsa *lsa)
{
switch (ntohs (lsa->header->type))
}
}
-void
+static void
ospf6_top_route_hook_add (struct ospf6_route *route)
{
ospf6_abr_originate_summary (route);
ospf6_zebra_route_update_add (route);
}
-void
+static void
ospf6_top_route_hook_remove (struct ospf6_route *route)
{
ospf6_abr_originate_summary (route);
ospf6_zebra_route_update_remove (route);
}
-void
+static void
ospf6_top_brouter_hook_add (struct ospf6_route *route)
{
ospf6_abr_examin_brouter (ADV_ROUTER_IN_PREFIX (&route->prefix));
ospf6_abr_originate_summary (route);
}
-void
+static void
ospf6_top_brouter_hook_remove (struct ospf6_route *route)
{
ospf6_abr_examin_brouter (ADV_ROUTER_IN_PREFIX (&route->prefix));
ospf6_abr_originate_summary (route);
}
-struct ospf6 *
-ospf6_create ()
+static struct ospf6 *
+ospf6_create (void)
{
struct ospf6 *o;
o->lsdb->hook_add = ospf6_top_lsdb_hook_add;
o->lsdb->hook_remove = ospf6_top_lsdb_hook_remove;
- o->route_table = ospf6_route_table_create ();
+ o->route_table = OSPF6_ROUTE_TABLE_CREATE (GLOBAL, ROUTES);
+ o->route_table->scope = o;
o->route_table->hook_add = ospf6_top_route_hook_add;
o->route_table->hook_remove = ospf6_top_route_hook_remove;
- o->brouter_table = ospf6_route_table_create ();
+ o->brouter_table = OSPF6_ROUTE_TABLE_CREATE (GLOBAL, BORDER_ROUTERS);
+ o->brouter_table->scope = o;
o->brouter_table->hook_add = ospf6_top_brouter_hook_add;
o->brouter_table->hook_remove = ospf6_top_brouter_hook_remove;
- o->external_table = ospf6_route_table_create ();
+ o->external_table = OSPF6_ROUTE_TABLE_CREATE (GLOBAL, EXTERNAL_ROUTES);
+ o->external_table->scope = o;
+
o->external_id_table = route_table_init ();
return o;
}
-void
+static void
ospf6_delete (struct ospf6 *o)
{
- struct listnode *i;
+ struct listnode *node, *nnode;
struct ospf6_area *oa;
- for (i = listhead (o->area_list); i; nextnode (i))
- {
- oa = (struct ospf6_area *) getdata (i);
- ospf6_area_delete (oa);
- }
+ for (ALL_LIST_ELEMENTS (o->area_list, node, nnode, oa))
+ ospf6_area_delete (oa);
ospf6_lsdb_delete (o->lsdb);
ospf6_lsdb_delete (o->lsdb_self);
XFREE (MTYPE_OSPF6_TOP, o);
}
-void
+static void
ospf6_enable (struct ospf6 *o)
{
- struct listnode *i;
+ struct listnode *node, *nnode;
struct ospf6_area *oa;
if (CHECK_FLAG (o->flag, OSPF6_DISABLED))
{
UNSET_FLAG (o->flag, OSPF6_DISABLED);
- for (i = listhead (o->area_list); i; nextnode (i))
- {
- oa = (struct ospf6_area *) getdata (i);
- ospf6_area_enable (oa);
- }
+ for (ALL_LIST_ELEMENTS (o->area_list, node, nnode, oa))
+ ospf6_area_enable (oa);
}
}
-void
+static void
ospf6_disable (struct ospf6 *o)
{
- struct listnode *i;
+ struct listnode *node, *nnode;
struct ospf6_area *oa;
if (! CHECK_FLAG (o->flag, OSPF6_DISABLED))
{
SET_FLAG (o->flag, OSPF6_DISABLED);
- for (i = listhead (o->area_list); i; nextnode (i))
- {
- oa = (struct ospf6_area *) getdata (i);
- ospf6_area_disable (oa);
- }
+
+ for (ALL_LIST_ELEMENTS (o->area_list, node, nnode, oa))
+ ospf6_area_disable (oa);
ospf6_lsdb_remove_all (o->lsdb);
ospf6_route_remove_all (o->route_table);
}
}
-int
+static int
ospf6_maxage_remover (struct thread *thread)
{
struct ospf6 *o = (struct ospf6 *) THREAD_ARG (thread);
o->maxage_remover = (struct thread *) NULL;
- for (i = listhead (o->area_list); i; nextnode (i))
+ for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
{
- oa = (struct ospf6_area *) getdata (i);
- for (j = listhead (oa->if_list); j; nextnode (j))
+ for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
{
- oi = (struct ospf6_interface *) getdata (j);
- for (k = listhead (oi->neighbor_list); k; nextnode (k))
+ for (ALL_LIST_ELEMENTS_RO (oi->neighbor_list, k, on))
{
- on = (struct ospf6_neighbor *) getdata (k);
if (on->state != OSPF6_NEIGHBOR_EXCHANGE &&
on->state != OSPF6_NEIGHBOR_LOADING)
continue;
}
}
- for (i = listhead (o->area_list); i; nextnode (i))
+ for (ALL_LIST_ELEMENTS_RO (o->area_list, i, oa))
{
- oa = (struct ospf6_area *) getdata (i);
- for (j = listhead (oa->if_list); j; nextnode (j))
- {
- oi = (struct ospf6_interface *) getdata (j);
- OSPF6_LSDB_MAXAGE_REMOVER (oi->lsdb);
- }
+ for (ALL_LIST_ELEMENTS_RO (oa->if_list, j, oi))
+ OSPF6_LSDB_MAXAGE_REMOVER (oi->lsdb);
+
OSPF6_LSDB_MAXAGE_REMOVER (oa->lsdb);
}
OSPF6_LSDB_MAXAGE_REMOVER (o->lsdb);
return CMD_SUCCESS;
}
-void
+static void
ospf6_show (struct vty *vty, struct ospf6 *o)
{
struct listnode *n;
/* Areas */
vty_out (vty, " Number of areas in this router is %u%s",
listcount (o->area_list), VNL);
- for (n = listhead (o->area_list); n; nextnode (n))
- {
- oa = (struct ospf6_area *) getdata (n);
- ospf6_area_show (vty, oa);
- }
+
+ for (ALL_LIST_ELEMENTS_RO (o->area_list, n, oa))
+ ospf6_area_show (vty, oa);
}
/* show top level structures */
"Specify IPv6 prefix\n"
"Detailed information\n"
"Summary of route table\n"
- );
+ )
DEFUN (show_ipv6_ospf6_route_match,
show_ipv6_ospf6_route_match_cmd,
return CMD_SUCCESS;
}
+ALIAS (show_ipv6_ospf6_route_match,
+ show_ipv6_ospf6_route_longer_cmd,
+ "show ipv6 ospf6 route X:X::X:X/M longer",
+ SHOW_STR
+ IP6_STR
+ OSPF6_STR
+ ROUTE_STR
+ "Specify IPv6 prefix\n"
+ "Display routes longer than the specified route\n"
+ )
+
+DEFUN (show_ipv6_ospf6_route_match_detail,
+ show_ipv6_ospf6_route_longer_detail_cmd,
+ "show ipv6 ospf6 route X:X::X:X/M longer detail",
+ SHOW_STR
+ IP6_STR
+ OSPF6_STR
+ ROUTE_STR
+ "Specify IPv6 prefix\n"
+ "Display routes longer than the specified route\n"
+ "Detailed information\n"
+ );
+
ALIAS (show_ipv6_ospf6_route,
show_ipv6_ospf6_route_type_cmd,
"show ipv6 ospf6 route (intra-area|inter-area|external-1|external-2)",
"Dispaly Inter-Area routes\n"
"Dispaly Type-1 External routes\n"
"Dispaly Type-2 External routes\n"
- );
+ )
DEFUN (show_ipv6_ospf6_route_type_detail,
show_ipv6_ospf6_route_type_detail_cmd,
}
/* OSPF configuration write function. */
-int
+static int
config_write_ospf6 (struct vty *vty)
{
char router_id[16];
ospf6_redistribute_config_write (vty);
ospf6_area_config_write (vty);
- for (j = listhead (ospf6->area_list); j; nextnode (j))
+ for (ALL_LIST_ELEMENTS_RO (ospf6->area_list, j, oa))
{
- oa = (struct ospf6_area *) getdata (j);
- for (k = listhead (oa->if_list); k; nextnode (k))
- {
- oi = (struct ospf6_interface *) getdata (k);
- vty_out (vty, " interface %s area %s%s",
- oi->interface->name, oa->name, VNL);
- }
+ for (ALL_LIST_ELEMENTS_RO (oa->if_list, k, oi))
+ vty_out (vty, " interface %s area %s%s",
+ oi->interface->name, oa->name, VNL);
}
vty_out (vty, "!%s", VNL);
return 0;
/* Install ospf related commands. */
void
-ospf6_top_init ()
+ospf6_top_init (void)
{
/* Install ospf6 top node. */
install_node (&ospf6_node, config_write_ospf6);
install_element (VIEW_NODE, &show_ipv6_ospf6_route_detail_cmd);
install_element (VIEW_NODE, &show_ipv6_ospf6_route_match_cmd);
install_element (VIEW_NODE, &show_ipv6_ospf6_route_match_detail_cmd);
+ install_element (VIEW_NODE, &show_ipv6_ospf6_route_longer_cmd);
+ install_element (VIEW_NODE, &show_ipv6_ospf6_route_longer_detail_cmd);
install_element (VIEW_NODE, &show_ipv6_ospf6_route_type_cmd);
install_element (VIEW_NODE, &show_ipv6_ospf6_route_type_detail_cmd);
install_element (ENABLE_NODE, &show_ipv6_ospf6_route_cmd);
install_element (ENABLE_NODE, &show_ipv6_ospf6_route_detail_cmd);
install_element (ENABLE_NODE, &show_ipv6_ospf6_route_match_cmd);
install_element (ENABLE_NODE, &show_ipv6_ospf6_route_match_detail_cmd);
+ install_element (ENABLE_NODE, &show_ipv6_ospf6_route_longer_cmd);
+ install_element (ENABLE_NODE, &show_ipv6_ospf6_route_longer_detail_cmd);
install_element (ENABLE_NODE, &show_ipv6_ospf6_route_type_cmd);
install_element (ENABLE_NODE, &show_ipv6_ospf6_route_type_detail_cmd);