summaryrefslogtreecommitdiff
path: root/pimd/pim_cmd_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'pimd/pim_cmd_common.c')
-rw-r--r--pimd/pim_cmd_common.c95
1 files changed, 83 insertions, 12 deletions
diff --git a/pimd/pim_cmd_common.c b/pimd/pim_cmd_common.c
index b7bd7375c5..45726b4e56 100644
--- a/pimd/pim_cmd_common.c
+++ b/pimd/pim_cmd_common.c
@@ -32,6 +32,7 @@
#include "ferr.h"
#include "lib/srcdest_table.h"
#include "lib/linklist.h"
+#include "termtable.h"
#include "pimd.h"
#include "pim_instance.h"
@@ -56,6 +57,7 @@
#include "pim_addr.h"
#include "pim_static.h"
#include "pim_util.h"
+#include "pim6_mld.h"
/**
* Get current node VRF name.
@@ -2124,6 +2126,8 @@ void pim_show_interfaces(struct pim_instance *pim, struct vty *vty, bool mlag,
int pim_nbrs = 0;
int pim_ifchannels = 0;
bool uj = true;
+ struct ttable *tt = NULL;
+ char *table = NULL;
json_object *json_row = NULL;
json_object *json_tmp;
@@ -2167,43 +2171,60 @@ void pim_show_interfaces(struct pim_instance *pim, struct vty *vty, bool mlag,
}
if (!uj) {
- vty_out(vty,
- "Interface State Address PIM Nbrs PIM DR FHR IfChannels\n");
+
+ /* Prepare table. */
+ tt = ttable_new(&ttable_styles[TTSTYLE_BLANK]);
+ ttable_add_row(
+ tt,
+ "Interface|State|Address|PIM Nbrs|PIM DR|FHR|IfChannels");
+ tt->style.cell.rpad = 2;
+ tt->style.corner = '+';
+ ttable_restyle(tt);
json_object_object_foreach(json, key, val)
{
- vty_out(vty, "%-16s ", key);
+ const char *state, *address, *pimdr;
+ int neighbors, firsthpr, pimifchnl;
json_object_object_get_ex(val, "state", &json_tmp);
- vty_out(vty, "%5s ", json_object_get_string(json_tmp));
+ state = json_object_get_string(json_tmp);
json_object_object_get_ex(val, "address", &json_tmp);
- vty_out(vty, "%15s ",
- json_object_get_string(json_tmp));
+ address = json_object_get_string(json_tmp);
json_object_object_get_ex(val, "pimNeighbors",
&json_tmp);
- vty_out(vty, "%8d ", json_object_get_int(json_tmp));
+ neighbors = json_object_get_int(json_tmp);
if (json_object_object_get_ex(
val, "pimDesignatedRouterLocal",
&json_tmp)) {
- vty_out(vty, "%15s ", "local");
+ pimdr = "local";
} else {
json_object_object_get_ex(
val, "pimDesignatedRouter", &json_tmp);
- vty_out(vty, "%15s ",
- json_object_get_string(json_tmp));
+ pimdr = json_object_get_string(json_tmp);
}
json_object_object_get_ex(val, "firstHopRouter",
&json_tmp);
- vty_out(vty, "%3d ", json_object_get_int(json_tmp));
+ firsthpr = json_object_get_int(json_tmp);
json_object_object_get_ex(val, "pimIfChannels",
&json_tmp);
- vty_out(vty, "%9d\n", json_object_get_int(json_tmp));
+ pimifchnl = json_object_get_int(json_tmp);
+
+ ttable_add_row(tt, "%s|%s|%s|%d|%s|%d|%d", key, state,
+ address, neighbors, pimdr, firsthpr,
+ pimifchnl);
}
+
+ /* Dump the generated table. */
+ table = ttable_dump(tt, "\n");
+ vty_out(vty, "%s\n", table);
+ XFREE(MTYPE_TMP, table);
+
+ ttable_del(tt);
}
}
@@ -3352,6 +3373,8 @@ void pim_cmd_show_ip_multicast_helper(struct pim_instance *pim, struct vty *vty)
vty_out(vty, "Mroute socket descriptor:");
vty_out(vty, " %d(%s)\n", pim->mroute_socket, vrf->name);
+ vty_out(vty, "PIM Register socket descriptor:");
+ vty_out(vty, " %d(%s)\n", pim->reg_sock, vrf->name);
pim_time_uptime(uptime, sizeof(uptime),
now - pim->mroute_socket_creation);
@@ -3994,6 +4017,12 @@ void clear_mroute(struct pim_instance *pim)
igmp_group_delete(grp);
}
}
+#else
+ struct gm_if *gm_ifp;
+
+ gm_ifp = pim_ifp->mld;
+ if (gm_ifp)
+ gm_group_delete(gm_ifp);
#endif
}
@@ -4023,6 +4052,46 @@ void clear_pim_statistics(struct pim_instance *pim)
}
}
+int clear_pim_interface_traffic(const char *vrf, struct vty *vty)
+{
+ struct interface *ifp = NULL;
+ struct pim_interface *pim_ifp = NULL;
+
+ struct vrf *v = pim_cmd_lookup(vty, vrf);
+
+ if (!v)
+ return CMD_WARNING;
+
+ FOR_ALL_INTERFACES (v, ifp) {
+ pim_ifp = ifp->info;
+
+ if (!pim_ifp)
+ continue;
+
+ pim_ifp->pim_ifstat_hello_recv = 0;
+ pim_ifp->pim_ifstat_hello_sent = 0;
+ pim_ifp->pim_ifstat_join_recv = 0;
+ pim_ifp->pim_ifstat_join_send = 0;
+ pim_ifp->pim_ifstat_prune_recv = 0;
+ pim_ifp->pim_ifstat_prune_send = 0;
+ pim_ifp->pim_ifstat_reg_recv = 0;
+ pim_ifp->pim_ifstat_reg_send = 0;
+ pim_ifp->pim_ifstat_reg_stop_recv = 0;
+ pim_ifp->pim_ifstat_reg_stop_send = 0;
+ pim_ifp->pim_ifstat_assert_recv = 0;
+ pim_ifp->pim_ifstat_assert_send = 0;
+ pim_ifp->pim_ifstat_bsm_rx = 0;
+ pim_ifp->pim_ifstat_bsm_tx = 0;
+#if PIM_IPV == 4
+ pim_ifp->igmp_ifstat_joins_sent = 0;
+ pim_ifp->igmp_ifstat_joins_failed = 0;
+ pim_ifp->igmp_peak_group_count = 0;
+#endif
+ }
+
+ return CMD_SUCCESS;
+}
+
int pim_debug_pim_cmd(void)
{
PIM_DO_DEBUG_PIM_EVENTS;
@@ -4045,6 +4114,8 @@ int pim_no_debug_pim_cmd(void)
PIM_DONT_DEBUG_PIM_PACKETDUMP_SEND;
PIM_DONT_DEBUG_PIM_PACKETDUMP_RECV;
+ PIM_DONT_DEBUG_BSM;
+ PIM_DONT_DEBUG_VXLAN;
return CMD_SUCCESS;
}