X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=ospf6d%2Fospf6d.c;h=db61fe087bb0155c1942f598b7d151df419476c4;hb=b3bce3a4fc06f3b7a9b57a4d2266747a3c0f9184;hp=48c34b79751d18e3abfeeb6296a477e5614fba3a;hpb=82cc2e9deef59117760f0bdb5ca8a0bd00d339c8;p=mirror_frr.git diff --git a/ospf6d/ospf6d.c b/ospf6d/ospf6d.c index 48c34b797..db61fe087 100644 --- a/ospf6d/ospf6d.c +++ b/ospf6d/ospf6d.c @@ -24,6 +24,7 @@ #include "linklist.h" #include "vty.h" #include "command.h" +#include "plist.h" #include "ospf6_proto.h" #include "ospf6_network.h" @@ -85,10 +86,24 @@ static int config_write_ospf6_debug(struct vty *vty) config_write_ospf6_debug_asbr(vty); config_write_ospf6_debug_abr(vty); config_write_ospf6_debug_flood(vty); - vty_out(vty, "!\n"); + return 0; } +DEFUN_NOSH (show_debugging_ospf6, + show_debugging_ospf6_cmd, + "show debugging [ospf6]", + SHOW_STR + DEBUG_STR + OSPF6_STR) +{ + vty_out(vty, "OSPF6 debugging status:\n"); + + config_write_ospf6_debug(vty); + + return CMD_SUCCESS; +} + #define AREA_LSDB_TITLE_FORMAT \ "\n Area Scoped Link State Database (Area %s)\n\n" #define IF_LSDB_TITLE_FORMAT \ @@ -111,9 +126,9 @@ static int parse_show_level(int idx_level, int argc, struct cmd_token **argv) return level; } -static u_int16_t parse_type_spec(int idx_lsa, int argc, struct cmd_token **argv) +static uint16_t parse_type_spec(int idx_lsa, int argc, struct cmd_token **argv) { - u_int16_t type = 0; + uint16_t type = 0; if (argc > idx_lsa) { if (strmatch(argv[idx_lsa]->text, "router")) @@ -205,7 +220,7 @@ DEFUN (show_ipv6_ospf6_database_type, struct ospf6 *o = ospf6; struct ospf6_area *oa; struct ospf6_interface *oi; - u_int16_t type = 0; + uint16_t type = 0; OSPF6_CMD_CHECK_RUNNING(); @@ -267,7 +282,7 @@ DEFUN (show_ipv6_ospf6_database_id, struct ospf6 *o = ospf6; struct ospf6_area *oa; struct ospf6_interface *oi; - u_int32_t id = 0; + uint32_t id = 0; OSPF6_CMD_CHECK_RUNNING(); @@ -318,7 +333,7 @@ DEFUN (show_ipv6_ospf6_database_router, struct ospf6 *o = ospf6; struct ospf6_area *oa; struct ospf6_interface *oi; - u_int32_t adv_router = 0; + uint32_t adv_router = 0; OSPF6_CMD_CHECK_RUNNING(); inet_pton(AF_INET, argv[idx_ipv4]->arg, &adv_router); @@ -345,6 +360,49 @@ DEFUN (show_ipv6_ospf6_database_router, return CMD_SUCCESS; } +DEFUN_HIDDEN (show_ipv6_ospf6_database_aggr_router, + show_ipv6_ospf6_database_aggr_router_cmd, + "show ipv6 ospf6 database aggr adv-router A.B.C.D", + SHOW_STR + IPV6_STR + OSPF6_STR + "Display Link state database\n" + "Aggregated Router LSA\n" + "Search by Advertising Router\n" + "Specify Advertising Router as IPv4 address notation\n") +{ + int level = OSPF6_LSDB_SHOW_LEVEL_DETAIL; + uint16_t type = htons(OSPF6_LSTYPE_ROUTER); + int idx_ipv4 = 6; + struct listnode *i; + struct ospf6 *o = ospf6; + struct ospf6_area *oa; + struct ospf6_lsdb *lsdb; + uint32_t adv_router = 0; + + inet_pton(AF_INET, argv[idx_ipv4]->arg, &adv_router); + + for (ALL_LIST_ELEMENTS_RO(o->area_list, i, oa)) { + if (adv_router == o->router_id) + lsdb = oa->lsdb_self; + else + lsdb = oa->lsdb; + if (ospf6_create_single_router_lsa(oa, lsdb, adv_router) + == NULL) { + vty_out(vty, "Adv router is not found in LSDB."); + return CMD_SUCCESS; + } + ospf6_lsdb_show(vty, level, &type, NULL, NULL, + oa->temp_router_lsa_lsdb); + /* Remove the temp cache */ + ospf6_remove_temp_router_lsa(oa); + } + + vty_out(vty, "\n"); + + return CMD_SUCCESS; +} + DEFUN (show_ipv6_ospf6_database_type_id, show_ipv6_ospf6_database_type_id_cmd, "show ipv6 ospf6 database linkstate-id A.B.C.D []", @@ -376,8 +434,8 @@ DEFUN (show_ipv6_ospf6_database_type_id, struct ospf6 *o = ospf6; struct ospf6_area *oa; struct ospf6_interface *oi; - u_int16_t type = 0; - u_int32_t id = 0; + uint16_t type = 0; + uint32_t id = 0; OSPF6_CMD_CHECK_RUNNING(); @@ -450,8 +508,8 @@ DEFUN (show_ipv6_ospf6_database_type_router, struct ospf6 *o = ospf6; struct ospf6_area *oa; struct ospf6_interface *oi; - u_int16_t type = 0; - u_int32_t adv_router = 0; + uint16_t type = 0; + uint32_t adv_router = 0; OSPF6_CMD_CHECK_RUNNING(); @@ -517,8 +575,8 @@ DEFUN (show_ipv6_ospf6_database_id_router, struct ospf6 *o = ospf6; struct ospf6_area *oa; struct ospf6_interface *oi; - u_int32_t id = 0; - u_int32_t adv_router = 0; + uint32_t id = 0; + uint32_t adv_router = 0; OSPF6_CMD_CHECK_RUNNING(); inet_pton(AF_INET, argv[idx_ls_id]->arg, &id); @@ -570,8 +628,8 @@ DEFUN (show_ipv6_ospf6_database_adv_router_linkstate_id, struct ospf6 *o = ospf6; struct ospf6_area *oa; struct ospf6_interface *oi; - u_int32_t id = 0; - u_int32_t adv_router = 0; + uint32_t id = 0; + uint32_t adv_router = 0; OSPF6_CMD_CHECK_RUNNING(); inet_pton(AF_INET, argv[idx_adv_rtr]->arg, &adv_router); @@ -629,9 +687,9 @@ DEFUN (show_ipv6_ospf6_database_type_id_router, struct ospf6 *o = ospf6; struct ospf6_area *oa; struct ospf6_interface *oi; - u_int16_t type = 0; - u_int32_t id = 0; - u_int32_t adv_router = 0; + uint16_t type = 0; + uint32_t id = 0; + uint32_t adv_router = 0; OSPF6_CMD_CHECK_RUNNING(); @@ -707,9 +765,9 @@ DEFUN (show_ipv6_ospf6_database_type_adv_router_linkstate_id, struct ospf6 *o = ospf6; struct ospf6_area *oa; struct ospf6_interface *oi; - u_int16_t type = 0; - u_int32_t id = 0; - u_int32_t adv_router = 0; + uint16_t type = 0; + uint32_t id = 0; + uint32_t adv_router = 0; OSPF6_CMD_CHECK_RUNNING(); @@ -770,7 +828,7 @@ DEFUN (show_ipv6_ospf6_database_self_originated, struct ospf6 *o = ospf6; struct ospf6_area *oa; struct ospf6_interface *oi; - u_int32_t adv_router = 0; + uint32_t adv_router = 0; OSPF6_CMD_CHECK_RUNNING(); level = parse_show_level(idx_level, argc, argv); @@ -826,8 +884,8 @@ DEFUN (show_ipv6_ospf6_database_type_self_originated, struct ospf6 *o = ospf6; struct ospf6_area *oa; struct ospf6_interface *oi; - u_int16_t type = 0; - u_int32_t adv_router = 0; + uint16_t type = 0; + uint32_t adv_router = 0; OSPF6_CMD_CHECK_RUNNING(); @@ -901,9 +959,9 @@ DEFUN (show_ipv6_ospf6_database_type_self_originated_linkstate_id, struct ospf6 *o = ospf6; struct ospf6_area *oa; struct ospf6_interface *oi; - u_int16_t type = 0; - u_int32_t adv_router = 0; - u_int32_t id = 0; + uint16_t type = 0; + uint32_t adv_router = 0; + uint32_t id = 0; OSPF6_CMD_CHECK_RUNNING(); @@ -976,9 +1034,9 @@ DEFUN (show_ipv6_ospf6_database_type_id_self_originated, struct ospf6 *o = ospf6; struct ospf6_area *oa; struct ospf6_interface *oi; - u_int16_t type = 0; - u_int32_t adv_router = 0; - u_int32_t id = 0; + uint16_t type = 0; + uint32_t adv_router = 0; + uint32_t id = 0; OSPF6_CMD_CHECK_RUNNING(); @@ -1032,7 +1090,7 @@ DEFUN (show_ipv6_ospf6_border_routers, "Show detailed output\n") { int idx_ipv4 = 4; - u_int32_t adv_router; + uint32_t adv_router; struct ospf6_route *ro; struct prefix prefix; @@ -1083,7 +1141,7 @@ DEFUN (show_ipv6_ospf6_linkstate, "Specify Router ID as IPv4 address notation\n" "Specify Link state ID as IPv4 address notation\n") { - int idx_ipv4 = 4; + int idx_ipv4 = 5; struct listnode *node; struct ospf6_area *oa; @@ -1125,6 +1183,20 @@ DEFUN (show_ipv6_ospf6_linkstate_detail, return CMD_SUCCESS; } +static void ospf6_plist_add(struct prefix_list *plist) +{ + if (prefix_list_afi(plist) != AFI_IP6) + return; + ospf6_area_plist_update(plist, 1); +} + +static void ospf6_plist_del(struct prefix_list *plist) +{ + if (prefix_list_afi(plist) != AFI_IP6) + return; + ospf6_area_plist_update(plist, 0); +} + /* Install ospf related commands. */ void ospf6_init(void) { @@ -1140,6 +1212,9 @@ void ospf6_init(void) ospf6_asbr_init(); ospf6_abr_init(); + prefix_list_add_hook(ospf6_plist_add); + prefix_list_delete_hook(ospf6_plist_del); + ospf6_bfd_init(); install_node(&debug_node, config_write_ospf6_debug); @@ -1157,6 +1232,8 @@ void ospf6_init(void) install_element_ospf6_clear_interface(); + install_element(VIEW_NODE, &show_debugging_ospf6_cmd); + install_element(VIEW_NODE, &show_ipv6_ospf6_border_routers_cmd); install_element(VIEW_NODE, &show_ipv6_ospf6_linkstate_cmd); @@ -1185,6 +1262,7 @@ void ospf6_init(void) install_element( VIEW_NODE, &show_ipv6_ospf6_database_type_self_originated_linkstate_id_cmd); + install_element(VIEW_NODE, &show_ipv6_ospf6_database_aggr_router_cmd); /* Make ospf protocol socket. */ ospf6_serv_sock();