]> git.proxmox.com Git - mirror_frr.git/commitdiff
Merge pull request #9438 from ranjanyash54/debug_comm
authorMark Stapp <mjs@voltanet.io>
Tue, 14 Sep 2021 15:38:21 +0000 (11:38 -0400)
committerGitHub <noreply@github.com>
Tue, 14 Sep 2021 15:38:21 +0000 (11:38 -0400)
ospf6d: Add debug commands for lsa all and route all

1  2 
ospf6d/ospf6_lsa.h
ospf6d/ospf6_route.c
ospf6d/ospf6_route.h
ospf6d/subdir.am

diff --combined ospf6d/ospf6_lsa.h
index c271965fe7c686e813609e518c5b965d3a5c2408,02775f654de97eff21b1726b222044cf251dbf06..2316040694a4b1ba4afd9d230cff1f72b4278d7b
@@@ -28,6 -28,9 +28,9 @@@
  #define OSPF6_LSA_DEBUG_ORIGINATE 0x02
  #define OSPF6_LSA_DEBUG_EXAMIN    0x04
  #define OSPF6_LSA_DEBUG_FLOOD     0x08
+ #define OSPF6_LSA_DEBUG_ALL                                                    \
+       (OSPF6_LSA_DEBUG | OSPF6_LSA_DEBUG_ORIGINATE | OSPF6_LSA_DEBUG_EXAMIN  \
+        | OSPF6_LSA_DEBUG_FLOOD)
  #define OSPF6_LSA_DEBUG_AGGR      0x10
  
  /* OSPF LSA Default metric values */
@@@ -231,11 -234,10 +234,11 @@@ extern int metric_type(struct ospf6 *os
  extern int metric_value(struct ospf6 *ospf6, int type, uint8_t instance);
  extern int ospf6_lsa_is_differ(struct ospf6_lsa *lsa1, struct ospf6_lsa *lsa2);
  extern int ospf6_lsa_is_changed(struct ospf6_lsa *lsa1, struct ospf6_lsa *lsa2);
 -extern uint16_t ospf6_lsa_age_current(struct ospf6_lsa *);
 -extern void ospf6_lsa_age_update_to_send(struct ospf6_lsa *, uint32_t);
 -extern void ospf6_lsa_premature_aging(struct ospf6_lsa *);
 -extern int ospf6_lsa_compare(struct ospf6_lsa *, struct ospf6_lsa *);
 +extern uint16_t ospf6_lsa_age_current(struct ospf6_lsa *lsa);
 +extern void ospf6_lsa_age_update_to_send(struct ospf6_lsa *lsa,
 +                                       uint32_t transdelay);
 +extern void ospf6_lsa_premature_aging(struct ospf6_lsa *lsa);
 +extern int ospf6_lsa_compare(struct ospf6_lsa *lsa1, struct ospf6_lsa *lsa2);
  
  extern char *ospf6_lsa_printbuf(struct ospf6_lsa *lsa, char *buf, int size);
  extern void ospf6_lsa_header_print_raw(struct ospf6_lsa_header *header);
@@@ -255,16 -257,16 +258,16 @@@ extern struct ospf6_lsa *ospf6_lsa_crea
  extern struct ospf6_lsa *
  ospf6_lsa_create_headeronly(struct ospf6_lsa_header *header);
  extern void ospf6_lsa_delete(struct ospf6_lsa *lsa);
 -extern struct ospf6_lsa *ospf6_lsa_copy(struct ospf6_lsa *);
 +extern struct ospf6_lsa *ospf6_lsa_copy(struct ospf6_lsa *lsa);
  
  extern struct ospf6_lsa *ospf6_lsa_lock(struct ospf6_lsa *lsa);
  extern struct ospf6_lsa *ospf6_lsa_unlock(struct ospf6_lsa *lsa);
  
 -extern int ospf6_lsa_expire(struct thread *);
 -extern int ospf6_lsa_refresh(struct thread *);
 +extern int ospf6_lsa_expire(struct thread *thread);
 +extern int ospf6_lsa_refresh(struct thread *thread);
  
 -extern unsigned short ospf6_lsa_checksum(struct ospf6_lsa_header *);
 -extern int ospf6_lsa_checksum_valid(struct ospf6_lsa_header *);
 +extern unsigned short ospf6_lsa_checksum(struct ospf6_lsa_header *lsah);
 +extern int ospf6_lsa_checksum_valid(struct ospf6_lsa_header *lsah);
  extern int ospf6_lsa_prohibited_duration(uint16_t type, uint32_t id,
                                         uint32_t adv_router, void *scope);
  
diff --combined ospf6d/ospf6_route.c
index 13003b4151802cc50e29130936068260b8140613,8abb8912c8810dcba0f13cebbcd46822f5629c58..5f630828e7b58d7265f237a3b8fd98e394852612
@@@ -37,6 -37,9 +37,9 @@@
  #include "ospf6_interface.h"
  #include "ospf6d.h"
  #include "ospf6_zebra.h"
+ #ifndef VTYSH_EXTRACT_PL
+ #include "ospf6d/ospf6_route_clippy.c"
+ #endif
  
  DEFINE_MTYPE_STATIC(OSPF6D, OSPF6_ROUTE,   "OSPF6 route");
  DEFINE_MTYPE_STATIC(OSPF6D, OSPF6_ROUTE_TABLE, "OSPF6 route table");
@@@ -667,9 -670,6 +670,9 @@@ struct ospf6_route *ospf6_route_add(str
  
        if (route->type == OSPF6_DEST_TYPE_LINKSTATE)
                ospf6_linkstate_prefix2str(&route->prefix, buf, sizeof(buf));
 +      else if (route->type == OSPF6_DEST_TYPE_ROUTER)
 +              inet_ntop(AF_INET, &ADV_ROUTER_IN_PREFIX(&route->prefix), buf,
 +                        sizeof(buf));
        else
                prefix2str(&route->prefix, buf, sizeof(buf));
  
@@@ -902,9 -902,6 +905,9 @@@ void ospf6_route_remove(struct ospf6_ro
  
        if (route->type == OSPF6_DEST_TYPE_LINKSTATE)
                ospf6_linkstate_prefix2str(&route->prefix, buf, sizeof(buf));
 +      else if (route->type == OSPF6_DEST_TYPE_ROUTER)
 +              inet_ntop(AF_INET, &ADV_ROUTER_IN_PREFIX(&route->prefix), buf,
 +                        sizeof(buf));
        else
                prefix2str(&route->prefix, buf, sizeof(buf));
  
@@@ -1837,49 -1834,27 +1840,27 @@@ void ospf6_brouter_show(struct vty *vty
                OSPF6_PATH_TYPE_NAME(route->path.type), area);
  }
  
- DEFUN (debug_ospf6_route,
-        debug_ospf6_route_cmd,
-        "debug ospf6 route <table|intra-area|inter-area|memory>",
-        DEBUG_STR
-        OSPF6_STR
-        "Debug routes\n"
-        "Debug route table calculation\n"
-        "Debug intra-area route calculation\n"
-        "Debug inter-area route calculation\n"
-        "Debug route memory use\n"
-        )
+ DEFPY(debug_ospf6_route,
+       debug_ospf6_route_cmd,
+       "[no$no] debug ospf6 route <all|table|intra-area|inter-area|memory>",
+       NO_STR
+       DEBUG_STR
+       OSPF6_STR
+       "Debug routes\n"
+       "Debug for all types of route calculation\n"
+       "Debug route table calculation\n"
+       "Debug intra-area route calculation\n"
+       "Debug inter-area route calculation\n"
+       "Debug route memory use\n")
  {
-       int idx_type = 3;
+       int idx_type;
        unsigned char level = 0;
  
-       if (!strcmp(argv[idx_type]->text, "table"))
-               level = OSPF6_DEBUG_ROUTE_TABLE;
-       else if (!strcmp(argv[idx_type]->text, "intra-area"))
-               level = OSPF6_DEBUG_ROUTE_INTRA;
-       else if (!strcmp(argv[idx_type]->text, "inter-area"))
-               level = OSPF6_DEBUG_ROUTE_INTER;
-       else if (!strcmp(argv[idx_type]->text, "memory"))
-               level = OSPF6_DEBUG_ROUTE_MEMORY;
-       OSPF6_DEBUG_ROUTE_ON(level);
-       return CMD_SUCCESS;
- }
- DEFUN (no_debug_ospf6_route,
-        no_debug_ospf6_route_cmd,
-        "no debug ospf6 route <table|intra-area|inter-area|memory>",
-        NO_STR
-        DEBUG_STR
-        OSPF6_STR
-        "Debug routes\n"
-        "Debug route table calculation\n"
-        "Debug intra-area route calculation\n"
-        "Debug inter-area route calculation\n"
-        "Debug route memory use\n")
- {
-       int idx_type = 4;
-       unsigned char level = 0;
+       idx_type = ((no) ? 4 : 3);
  
-       if (!strcmp(argv[idx_type]->text, "table"))
+       if (!strcmp(argv[idx_type]->text, "all"))
+               level = OSPF6_DEBUG_ROUTE_ALL;
+       else if (!strcmp(argv[idx_type]->text, "table"))
                level = OSPF6_DEBUG_ROUTE_TABLE;
        else if (!strcmp(argv[idx_type]->text, "intra-area"))
                level = OSPF6_DEBUG_ROUTE_INTRA;
                level = OSPF6_DEBUG_ROUTE_INTER;
        else if (!strcmp(argv[idx_type]->text, "memory"))
                level = OSPF6_DEBUG_ROUTE_MEMORY;
-       OSPF6_DEBUG_ROUTE_OFF(level);
+       if (no)
+               OSPF6_DEBUG_ROUTE_OFF(level);
+       else
+               OSPF6_DEBUG_ROUTE_ON(level);
        return CMD_SUCCESS;
  }
  
  int config_write_ospf6_debug_route(struct vty *vty)
  {
+       if (IS_OSPF6_DEBUG_ROUTE(ALL) == OSPF6_DEBUG_ROUTE_ALL) {
+               vty_out(vty, "debug ospf6 route all\n");
+               return 0;
+       }
        if (IS_OSPF6_DEBUG_ROUTE(TABLE))
                vty_out(vty, "debug ospf6 route table\n");
        if (IS_OSPF6_DEBUG_ROUTE(INTRA))
  void install_element_ospf6_debug_route(void)
  {
        install_element(ENABLE_NODE, &debug_ospf6_route_cmd);
-       install_element(ENABLE_NODE, &no_debug_ospf6_route_cmd);
        install_element(CONFIG_NODE, &debug_ospf6_route_cmd);
-       install_element(CONFIG_NODE, &no_debug_ospf6_route_cmd);
  }
diff --combined ospf6d/ospf6_route.h
index 54baaee638e7edac6cc7d5d5e26c714b9c16f411,206b08631a831dc4aad32227664291cd259b4417..e29439b95e676c282d65f3a46819a028bd51c75b
@@@ -33,7 -33,10 +33,10 @@@ extern unsigned char conf_debug_ospf6_r
  #define OSPF6_DEBUG_ROUTE_TABLE   0x01
  #define OSPF6_DEBUG_ROUTE_INTRA   0x02
  #define OSPF6_DEBUG_ROUTE_INTER   0x04
- #define OSPF6_DEBUG_ROUTE_MEMORY  0x80
+ #define OSPF6_DEBUG_ROUTE_MEMORY  0x08
+ #define OSPF6_DEBUG_ROUTE_ALL                                                  \
+       (OSPF6_DEBUG_ROUTE_TABLE | OSPF6_DEBUG_ROUTE_INTRA                     \
+        | OSPF6_DEBUG_ROUTE_INTER | OSPF6_DEBUG_ROUTE_MEMORY)
  #define OSPF6_DEBUG_ROUTE_ON(level) (conf_debug_ospf6_route |= (level))
  #define OSPF6_DEBUG_ROUTE_OFF(level) (conf_debug_ospf6_route &= ~(level))
  #define IS_OSPF6_DEBUG_ROUTE(e) (conf_debug_ospf6_route & OSPF6_DEBUG_ROUTE_##e)
@@@ -343,7 -346,7 +346,7 @@@ extern int ospf6_route_get_first_nh_ind
        ospf6_add_nexthop(route->nh_list, ifindex, addr)
  
  extern struct ospf6_route *ospf6_route_create(struct ospf6 *ospf6);
 -extern void ospf6_route_delete(struct ospf6_route *);
 +extern void ospf6_route_delete(struct ospf6_route *route);
  extern struct ospf6_route *ospf6_route_copy(struct ospf6_route *route);
  extern int ospf6_route_cmp(struct ospf6_route *ra, struct ospf6_route *rb);
  
@@@ -384,10 -387,8 +387,10 @@@ extern void ospf6_route_show_detail(str
                                    json_object *json, bool use_json);
  
  
 -extern int ospf6_route_table_show(struct vty *, int, int, struct cmd_token **,
 -                                struct ospf6_route_table *, bool use_json);
 +extern int ospf6_route_table_show(struct vty *vty, int argc_start, int argc,
 +                                struct cmd_token **argv,
 +                                struct ospf6_route_table *table,
 +                                bool use_json);
  extern int ospf6_linkstate_table_show(struct vty *vty, int idx_ipv4, int argc,
                                      struct cmd_token **argv,
                                      struct ospf6_route_table *table);
diff --combined ospf6d/subdir.am
index 5a4e4db69beb8a7080a3e4337880280fe25acc44,432b698f8a2c511a8d0ac5d0f1fafd240c8a68e0..910c26b791ef9e6849fb3a67bfd0fecb26455dfc
@@@ -92,10 -92,10 +92,11 @@@ ospf6d_ospf6d_snmp_la_LIBADD = lib/libf
  
  clippy_scan += \
        ospf6d/ospf6_top.c \
 +      ospf6d/ospf6_area.c \
        ospf6d/ospf6_asbr.c \
        ospf6d/ospf6_lsa.c \
        ospf6d/ospf6_gr_helper.c \
+       ospf6d/ospf6_route.c \
        # end
  
  nodist_ospf6d_ospf6d_SOURCES = \