summaryrefslogtreecommitdiff
path: root/ospfd/ospf_dump.c
diff options
context:
space:
mode:
Diffstat (limited to 'ospfd/ospf_dump.c')
-rw-r--r--ospfd/ospf_dump.c104
1 files changed, 78 insertions, 26 deletions
diff --git a/ospfd/ospf_dump.c b/ospfd/ospf_dump.c
index e8798e023e..e15c9c42c7 100644
--- a/ospfd/ospf_dump.c
+++ b/ospfd/ospf_dump.c
@@ -41,6 +41,9 @@
#include "ospfd/ospf_dump.h"
#include "ospfd/ospf_packet.h"
#include "ospfd/ospf_network.h"
+#ifndef VTYSH_EXTRACT_PL
+#include "ospfd/ospf_dump_clippy.c"
+#endif
/* Configuration debug option variables. */
unsigned long conf_debug_ospf_packet[5] = {0, 0, 0, 0, 0};
@@ -55,6 +58,7 @@ unsigned long conf_debug_ospf_ext = 0;
unsigned long conf_debug_ospf_sr = 0;
unsigned long conf_debug_ospf_defaultinfo = 0;
unsigned long conf_debug_ospf_ldp_sync = 0;
+unsigned long conf_debug_ospf_gr = 0;
/* Enable debug option variables -- valid only session. */
unsigned long term_debug_ospf_packet[5] = {0, 0, 0, 0, 0};
@@ -69,6 +73,7 @@ unsigned long term_debug_ospf_ext = 0;
unsigned long term_debug_ospf_sr = 0;
unsigned long term_debug_ospf_defaultinfo;
unsigned long term_debug_ospf_ldp_sync;
+unsigned long term_debug_ospf_gr = 0;
const char *ospf_redist_string(unsigned int route_type)
{
@@ -237,20 +242,20 @@ static void ospf_packet_hello_dump(struct stream *s, uint16_t length)
hello = (struct ospf_hello *)stream_pnt(s);
zlog_debug("Hello");
- zlog_debug(" NetworkMask %s", inet_ntoa(hello->network_mask));
+ zlog_debug(" NetworkMask %pI4", &hello->network_mask);
zlog_debug(" HelloInterval %d", ntohs(hello->hello_interval));
zlog_debug(" Options %d (%s)", hello->options,
ospf_options_dump(hello->options));
zlog_debug(" RtrPriority %d", hello->priority);
zlog_debug(" RtrDeadInterval %ld",
(unsigned long)ntohl(hello->dead_interval));
- zlog_debug(" DRouter %s", inet_ntoa(hello->d_router));
- zlog_debug(" BDRouter %s", inet_ntoa(hello->bd_router));
+ zlog_debug(" DRouter %pI4", &hello->d_router);
+ zlog_debug(" BDRouter %pI4", &hello->bd_router);
length -= OSPF_HEADER_SIZE + OSPF_HELLO_MIN_SIZE;
zlog_debug(" # Neighbors %d", length / 4);
for (i = 0; length > 0; i++, length -= sizeof(struct in_addr))
- zlog_debug(" Neighbor %s", inet_ntoa(hello->neighbors[i]));
+ zlog_debug(" Neighbor %pI4", &hello->neighbors[i]);
}
static char *ospf_dd_flags_dump(uint8_t flags, char *buf, size_t size)
@@ -287,9 +292,9 @@ static void ospf_router_lsa_dump(struct stream *s, uint16_t length)
len = ntohs(rl->header.length) - OSPF_LSA_HEADER_SIZE - 4;
for (i = 0; len > 0; i++) {
- zlog_debug(" Link ID %s", inet_ntoa(rl->link[i].link_id));
- zlog_debug(" Link Data %s",
- inet_ntoa(rl->link[i].link_data));
+ zlog_debug(" Link ID %pI4", &rl->link[i].link_id);
+ zlog_debug(" Link Data %pI4",
+ &rl->link[i].link_data);
zlog_debug(" Type %d", (uint8_t)rl->link[i].type);
zlog_debug(" TOS %d", (uint8_t)rl->link[i].tos);
zlog_debug(" metric %d", ntohs(rl->link[i].metric));
@@ -312,11 +317,11 @@ static void ospf_network_lsa_dump(struct stream *s, uint16_t length)
zlog_debug ("Network-LSA size %d",
ntohs (nl->header.length) - OSPF_LSA_HEADER_SIZE);
*/
- zlog_debug(" Network Mask %s", inet_ntoa(nl->mask));
+ zlog_debug(" Network Mask %pI4", &nl->mask);
zlog_debug(" # Attached Routers %d", cnt);
for (i = 0; i < cnt; i++)
- zlog_debug(" Attached Router %s",
- inet_ntoa(nl->routers[i]));
+ zlog_debug(" Attached Router %pI4",
+ &nl->routers[i]);
}
static void ospf_summary_lsa_dump(struct stream *s, uint16_t length)
@@ -328,7 +333,7 @@ static void ospf_summary_lsa_dump(struct stream *s, uint16_t length)
sl = (struct summary_lsa *)stream_pnt(s);
zlog_debug(" Summary-LSA");
- zlog_debug(" Network Mask %s", inet_ntoa(sl->mask));
+ zlog_debug(" Network Mask %pI4", &sl->mask);
size = ntohs(sl->header.length) - OSPF_LSA_HEADER_SIZE - 4;
for (i = 0; size > 0; size -= 4, i++)
@@ -344,15 +349,15 @@ static void ospf_as_external_lsa_dump(struct stream *s, uint16_t length)
al = (struct as_external_lsa *)stream_pnt(s);
zlog_debug(" %s", ospf_lsa_type_msg[al->header.type].str);
- zlog_debug(" Network Mask %s", inet_ntoa(al->mask));
+ zlog_debug(" Network Mask %pI4", &al->mask);
size = ntohs(al->header.length) - OSPF_LSA_HEADER_SIZE - 4;
for (i = 0; size > 0; size -= 12, i++) {
zlog_debug(" bit %s TOS=%d metric %d",
IS_EXTERNAL_METRIC(al->e[i].tos) ? "E" : "-",
al->e[i].tos & 0x7f, GET_METRIC(al->e[i].metric));
- zlog_debug(" Forwarding address %s",
- inet_ntoa(al->e[i].fwd_addr));
+ zlog_debug(" Forwarding address %pI4",
+ &al->e[i].fwd_addr);
zlog_debug(" External Route Tag %" ROUTE_TAG_PRI,
al->e[i].route_tag);
}
@@ -422,8 +427,8 @@ static void ospf_packet_ls_req_dump(struct stream *s, uint16_t length)
adv_router.s_addr = stream_get_ipv4(s);
zlog_debug(" LS type %d", ls_type);
- zlog_debug(" Link State ID %s", inet_ntoa(ls_id));
- zlog_debug(" Advertising Router %s", inet_ntoa(adv_router));
+ zlog_debug(" Link State ID %pI4", &ls_id);
+ zlog_debug(" Advertising Router %pI4", &adv_router);
}
stream_set_getp(s, sp);
@@ -514,8 +519,8 @@ static void ospf_header_dump(struct ospf_header *ospfh)
zlog_debug(" Type %d (%s)", ospfh->type,
lookup_msg(ospf_packet_type_str, ospfh->type, NULL));
zlog_debug(" Packet Len %d", ntohs(ospfh->length));
- zlog_debug(" Router ID %s", inet_ntoa(ospfh->router_id));
- zlog_debug(" Area ID %s", inet_ntoa(ospfh->area_id));
+ zlog_debug(" Router ID %pI4", &ospfh->router_id);
+ zlog_debug(" Area ID %pI4", &ospfh->area_id);
zlog_debug(" Checksum 0x%x", ntohs(ospfh->checksum));
zlog_debug(" AuType %s",
lookup_msg(ospf_auth_type_str, auth_type, NULL));
@@ -996,6 +1001,8 @@ static int debug_ospf_lsa_common(struct vty *vty, int arg_base, int argc,
DEBUG_ON(lsa, LSA_INSTALL);
else if (strmatch(argv[arg_base]->text, "refresh"))
DEBUG_ON(lsa, LSA_REFRESH);
+ else if (strmatch(argv[arg_base]->text, "aggregate"))
+ DEBUG_ON(lsa, EXTNL_LSA_AGGR);
}
return CMD_SUCCESS;
@@ -1013,6 +1020,8 @@ static int debug_ospf_lsa_common(struct vty *vty, int arg_base, int argc,
TERM_DEBUG_ON(lsa, LSA_INSTALL);
else if (strmatch(argv[arg_base]->text, "refresh"))
TERM_DEBUG_ON(lsa, LSA_REFRESH);
+ else if (strmatch(argv[arg_base]->text, "aggregate"))
+ TERM_DEBUG_ON(lsa, EXTNL_LSA_AGGR);
}
return CMD_SUCCESS;
@@ -1020,21 +1029,23 @@ static int debug_ospf_lsa_common(struct vty *vty, int arg_base, int argc,
DEFUN (debug_ospf_lsa,
debug_ospf_lsa_cmd,
- "debug ospf lsa [<generate|flooding|install|refresh>]",
+ "debug ospf lsa [<generate|flooding|install|refresh|aggregate>]",
DEBUG_STR
OSPF_STR
"OSPF Link State Advertisement\n"
"LSA Generation\n"
"LSA Flooding\n"
"LSA Install/Delete\n"
- "LSA Refresh\n")
+ "LSA Refresh\n"
+ "External LSA Aggregation\n")
{
return debug_ospf_lsa_common(vty, 3, argc, argv);
}
DEFUN (debug_ospf_instance_lsa,
debug_ospf_instance_lsa_cmd,
- "debug ospf (1-65535) lsa [<generate|flooding|install|refresh>]",
+ "debug ospf (1-65535) lsa "
+ "[<generate|flooding|install|refresh|aggregate>]",
DEBUG_STR
OSPF_STR
"Instance ID\n"
@@ -1042,7 +1053,8 @@ DEFUN (debug_ospf_instance_lsa,
"LSA Generation\n"
"LSA Flooding\n"
"LSA Install/Delete\n"
- "LSA Refresh\n")
+ "LSA Refresh\n"
+ "External LSA Aggregation\n")
{
int idx_number = 2;
unsigned short instance = 0;
@@ -1070,6 +1082,8 @@ static int no_debug_ospf_lsa_common(struct vty *vty, int arg_base, int argc,
DEBUG_OFF(lsa, LSA_INSTALL);
else if (strmatch(argv[arg_base]->text, "refresh"))
DEBUG_OFF(lsa, LSA_REFRESH);
+ else if (strmatch(argv[arg_base]->text, "aggregate"))
+ DEBUG_OFF(lsa, EXTNL_LSA_AGGR);
}
return CMD_SUCCESS;
@@ -1087,6 +1101,8 @@ static int no_debug_ospf_lsa_common(struct vty *vty, int arg_base, int argc,
TERM_DEBUG_OFF(lsa, LSA_INSTALL);
else if (strmatch(argv[arg_base]->text, "refresh"))
TERM_DEBUG_OFF(lsa, LSA_REFRESH);
+ else if (strmatch(argv[arg_base]->text, "aggregate"))
+ TERM_DEBUG_OFF(lsa, EXTNL_LSA_AGGR);
}
return CMD_SUCCESS;
@@ -1094,7 +1110,7 @@ static int no_debug_ospf_lsa_common(struct vty *vty, int arg_base, int argc,
DEFUN (no_debug_ospf_lsa,
no_debug_ospf_lsa_cmd,
- "no debug ospf lsa [<generate|flooding|install|refresh>]",
+ "no debug ospf lsa [<generate|flooding|install|refresh|aggregate>]",
NO_STR
DEBUG_STR
OSPF_STR
@@ -1102,14 +1118,16 @@ DEFUN (no_debug_ospf_lsa,
"LSA Generation\n"
"LSA Flooding\n"
"LSA Install/Delete\n"
- "LSA Refres\n")
+ "LSA Refres\n"
+ "External LSA Aggregation\n")
{
return no_debug_ospf_lsa_common(vty, 4, argc, argv);
}
DEFUN (no_debug_ospf_instance_lsa,
no_debug_ospf_instance_lsa_cmd,
- "no debug ospf (1-65535) lsa [<generate|flooding|install|refresh>]",
+ "no debug ospf (1-65535) lsa "
+ "[<generate|flooding|install|refresh|aggregate>]",
NO_STR
DEBUG_STR
OSPF_STR
@@ -1118,7 +1136,8 @@ DEFUN (no_debug_ospf_instance_lsa,
"LSA Generation\n"
"LSA Flooding\n"
"LSA Install/Delete\n"
- "LSA Refres\n")
+ "LSA Refres\n"
+ "External LSA Aggregation\n")
{
int idx_number = 3;
unsigned short instance = 0;
@@ -1501,6 +1520,26 @@ DEFUN(no_debug_ospf_ldp_sync,
if (vty->node == CONFIG_NODE)
CONF_DEBUG_OFF(ldp_sync, LDP_SYNC);
TERM_DEBUG_OFF(ldp_sync, LDP_SYNC);
+
+ return CMD_SUCCESS;
+}
+
+DEFPY (debug_ospf_gr,
+ debug_ospf_gr_cmd,
+ "[no$no] debug ospf graceful-restart helper",
+ NO_STR
+ DEBUG_STR OSPF_STR
+ "Gracefull restart\n"
+ "Helper Information\n")
+{
+ if (vty->node == CONFIG_NODE)
+ CONF_DEBUG_ON(gr, GR_HELPER);
+
+ if (!no)
+ TERM_DEBUG_ON(gr, GR_HELPER);
+ else
+ TERM_DEBUG_OFF(gr, GR_HELPER);
+
return CMD_SUCCESS;
}
@@ -1667,6 +1706,10 @@ static int show_debugging_ospf_common(struct vty *vty, struct ospf *ospf)
if (IS_DEBUG_OSPF(ldp_sync, LDP_SYNC) == OSPF_DEBUG_LDP_SYNC)
vty_out(vty, " OSPF ldp-sync debugging is on\n");
+ /* Show debug status for GR helper. */
+ if (IS_DEBUG_OSPF(gr, GR_HELPER) == OSPF_DEBUG_GR_HELPER)
+ vty_out(vty, " OSPF Graceful Restart Helper debugging is on\n");
+
vty_out(vty, "\n");
return CMD_SUCCESS;
@@ -1853,6 +1896,13 @@ static int config_write_debug(struct vty *vty)
vty_out(vty, "debug ospf%s ldp-sync\n", str);
write = 1;
}
+
+ /* debug ospf gr helper */
+ if (IS_CONF_DEBUG_OSPF(gr, GR_HELPER) == OSPF_DEBUG_GR_HELPER) {
+ vty_out(vty, "debug ospf%s graceful-restart helper\n", str);
+ write = 1;
+ }
+
return write;
}
@@ -1882,6 +1932,7 @@ void ospf_debug_init(void)
install_element(ENABLE_NODE, &no_debug_ospf_sr_cmd);
install_element(ENABLE_NODE, &no_debug_ospf_default_info_cmd);
install_element(ENABLE_NODE, &no_debug_ospf_ldp_sync_cmd);
+ install_element(ENABLE_NODE, &debug_ospf_gr_cmd);
install_element(ENABLE_NODE, &show_debugging_ospf_instance_cmd);
install_element(ENABLE_NODE, &debug_ospf_packet_cmd);
@@ -1922,6 +1973,7 @@ void ospf_debug_init(void)
install_element(CONFIG_NODE, &no_debug_ospf_sr_cmd);
install_element(CONFIG_NODE, &no_debug_ospf_default_info_cmd);
install_element(CONFIG_NODE, &no_debug_ospf_ldp_sync_cmd);
+ install_element(CONFIG_NODE, &debug_ospf_gr_cmd);
install_element(CONFIG_NODE, &debug_ospf_instance_nsm_cmd);
install_element(CONFIG_NODE, &debug_ospf_instance_lsa_cmd);