summaryrefslogtreecommitdiff
path: root/pimd/pim_cmd.c
diff options
context:
space:
mode:
Diffstat (limited to 'pimd/pim_cmd.c')
-rw-r--r--pimd/pim_cmd.c326
1 files changed, 189 insertions, 137 deletions
diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c
index a3e5151a78..7e24d924a4 100644
--- a/pimd/pim_cmd.c
+++ b/pimd/pim_cmd.c
@@ -909,7 +909,7 @@ static void igmp_show_interface_join(struct pim_instance *pim, struct vty *vty)
static void pim_show_interfaces_single(struct pim_instance *pim,
struct vty *vty, const char *ifname,
- bool uj)
+ bool mlag, bool uj)
{
struct in_addr ifaddr;
struct interface *ifp;
@@ -952,6 +952,9 @@ static void pim_show_interfaces_single(struct pim_instance *pim,
if (!pim_ifp)
continue;
+ if (mlag == true && pim_ifp->activeactive == false)
+ continue;
+
if (strcmp(ifname, "detail") && strcmp(ifname, ifp->name))
continue;
@@ -1380,7 +1383,7 @@ static void igmp_show_statistics(struct pim_instance *pim, struct vty *vty,
}
static void pim_show_interfaces(struct pim_instance *pim, struct vty *vty,
- bool uj)
+ bool mlag, bool uj)
{
struct interface *ifp;
struct pim_interface *pim_ifp;
@@ -1400,6 +1403,9 @@ static void pim_show_interfaces(struct pim_instance *pim, struct vty *vty,
if (!pim_ifp)
continue;
+ if (mlag == true && pim_ifp->activeactive == false)
+ continue;
+
pim_nbrs = pim_ifp->pim_neighbor_list->count;
pim_ifchannels = pim_if_ifchannel_count(pim_ifp);
fhr = 0;
@@ -3726,8 +3732,6 @@ static void pim_show_bsr(struct pim_instance *pim,
char bsr_str[PREFIX_STRLEN];
json_object *json = NULL;
- vty_out(vty, "PIMv2 Bootstrap information\n");
-
if (pim->global_scope.current_bsr.s_addr == INADDR_ANY) {
strlcpy(bsr_str, "0.0.0.0", sizeof(bsr_str));
pim_time_uptime(uptime, sizeof(uptime),
@@ -3773,6 +3777,7 @@ static void pim_show_bsr(struct pim_instance *pim,
}
else {
+ vty_out(vty, "PIMv2 Bootstrap information\n");
vty_out(vty, "Current preferred BSR address: %s\n", bsr_str);
vty_out(vty,
"Priority Fragment-Tag State UpTime\n");
@@ -4295,6 +4300,113 @@ DEFUN (show_ip_igmp_statistics,
return CMD_SUCCESS;
}
+DEFUN (show_ip_pim_mlag_summary,
+ show_ip_pim_mlag_summary_cmd,
+ "show ip pim mlag summary [json]",
+ SHOW_STR
+ IP_STR
+ PIM_STR
+ "MLAG\n"
+ "status and stats\n"
+ JSON_STR)
+{
+ bool uj = use_json(argc, argv);
+ char role_buf[MLAG_ROLE_STRSIZE];
+ char addr_buf[INET_ADDRSTRLEN];
+
+ if (uj) {
+ json_object *json = NULL;
+ json_object *json_stat = NULL;
+
+ json = json_object_new_object();
+ if (router->mlag_flags & PIM_MLAGF_LOCAL_CONN_UP)
+ json_object_boolean_true_add(json, "mlagConnUp");
+ if (router->mlag_flags & PIM_MLAGF_PEER_CONN_UP)
+ json_object_boolean_true_add(json, "mlagPeerConnUp");
+ if (router->mlag_flags & PIM_MLAGF_PEER_ZEBRA_UP)
+ json_object_boolean_true_add(json, "mlagPeerZebraUp");
+ json_object_string_add(json, "mlagRole",
+ mlag_role2str(router->mlag_role,
+ role_buf, sizeof(role_buf)));
+ inet_ntop(AF_INET, &router->local_vtep_ip,
+ addr_buf, INET_ADDRSTRLEN);
+ json_object_string_add(json, "localVtepIp", addr_buf);
+ inet_ntop(AF_INET, &router->anycast_vtep_ip,
+ addr_buf, INET_ADDRSTRLEN);
+ json_object_string_add(json, "anycastVtepIp", addr_buf);
+ json_object_string_add(json, "peerlinkRif",
+ router->peerlink_rif);
+
+ json_stat = json_object_new_object();
+ json_object_int_add(json_stat, "mlagConnFlaps",
+ router->mlag_stats.mlagd_session_downs);
+ json_object_int_add(json_stat, "mlagPeerConnFlaps",
+ router->mlag_stats.peer_session_downs);
+ json_object_int_add(json_stat, "mlagPeerZebraFlaps",
+ router->mlag_stats.peer_zebra_downs);
+ json_object_int_add(json_stat, "mrouteAddRx",
+ router->mlag_stats.msg.mroute_add_rx);
+ json_object_int_add(json_stat, "mrouteAddTx",
+ router->mlag_stats.msg.mroute_add_tx);
+ json_object_int_add(json_stat, "mrouteDelRx",
+ router->mlag_stats.msg.mroute_del_rx);
+ json_object_int_add(json_stat, "mrouteDelTx",
+ router->mlag_stats.msg.mroute_del_tx);
+ json_object_int_add(json_stat, "mlagStatusUpdates",
+ router->mlag_stats.msg.mlag_status_updates);
+ json_object_int_add(json_stat, "peerZebraStatusUpdates",
+ router->mlag_stats.msg.peer_zebra_status_updates);
+ json_object_int_add(json_stat, "pimStatusUpdates",
+ router->mlag_stats.msg.pim_status_updates);
+ json_object_int_add(json_stat, "vxlanUpdates",
+ router->mlag_stats.msg.vxlan_updates);
+ json_object_object_add(json, "connStats", json_stat);
+
+ vty_out(vty, "%s\n", json_object_to_json_string_ext(
+ json, JSON_C_TO_STRING_PRETTY));
+ json_object_free(json);
+ return CMD_SUCCESS;
+ }
+
+ vty_out(vty, "MLAG daemon connection: %s\n",
+ (router->mlag_flags & PIM_MLAGF_LOCAL_CONN_UP)
+ ? "up" : "down");
+ vty_out(vty, "MLAG peer state: %s\n",
+ (router->mlag_flags & PIM_MLAGF_PEER_CONN_UP)
+ ? "up" : "down");
+ vty_out(vty, "Zebra peer state: %s\n",
+ (router->mlag_flags & PIM_MLAGF_PEER_ZEBRA_UP)
+ ? "up" : "down");
+ vty_out(vty, "MLAG role: %s\n",
+ mlag_role2str(router->mlag_role, role_buf, sizeof(role_buf)));
+ inet_ntop(AF_INET, &router->local_vtep_ip,
+ addr_buf, INET_ADDRSTRLEN);
+ vty_out(vty, "Local VTEP IP: %s\n", addr_buf);
+ inet_ntop(AF_INET, &router->anycast_vtep_ip,
+ addr_buf, INET_ADDRSTRLEN);
+ vty_out(vty, "Anycast VTEP IP: %s\n", addr_buf);
+ vty_out(vty, "Peerlink: %s\n", router->peerlink_rif);
+ vty_out(vty, "Session flaps: mlagd: %d mlag-peer: %d zebra-peer: %d\n",
+ router->mlag_stats.mlagd_session_downs,
+ router->mlag_stats.peer_session_downs,
+ router->mlag_stats.peer_zebra_downs);
+ vty_out(vty, "Message Statistics:\n");
+ vty_out(vty, " mroute adds: rx: %d, tx: %d\n",
+ router->mlag_stats.msg.mroute_add_rx,
+ router->mlag_stats.msg.mroute_add_tx);
+ vty_out(vty, " mroute dels: rx: %d, tx: %d\n",
+ router->mlag_stats.msg.mroute_del_rx,
+ router->mlag_stats.msg.mroute_del_tx);
+ vty_out(vty, " peer zebra status updates: %d\n",
+ router->mlag_stats.msg.peer_zebra_status_updates);
+ vty_out(vty, " PIM status updates: %d\n",
+ router->mlag_stats.msg.pim_status_updates);
+ vty_out(vty, " VxLAN updates: %d\n",
+ router->mlag_stats.msg.vxlan_updates);
+
+ return CMD_SUCCESS;
+}
+
DEFUN (show_ip_pim_assert,
show_ip_pim_assert_cmd,
"show ip pim [vrf NAME] assert",
@@ -4377,10 +4489,11 @@ DEFUN (show_ip_pim_assert_winner_metric,
DEFUN (show_ip_pim_interface,
show_ip_pim_interface_cmd,
- "show ip pim [vrf NAME] interface [detail|WORD] [json]",
+ "show ip pim [mlag] [vrf NAME] interface [detail|WORD] [json]",
SHOW_STR
IP_STR
PIM_STR
+ "MLAG\n"
VRF_CMD_HELP_STR
"PIM interface information\n"
"Detailed output\n"
@@ -4390,36 +4503,47 @@ DEFUN (show_ip_pim_interface,
int idx = 2;
struct vrf *vrf = pim_cmd_lookup_vrf(vty, argv, argc, &idx);
bool uj = use_json(argc, argv);
+ bool mlag = false;
if (!vrf)
return CMD_WARNING;
+ if (argv_find(argv, argc, "mlag", &idx))
+ mlag = true;
+
if (argv_find(argv, argc, "WORD", &idx)
|| argv_find(argv, argc, "detail", &idx))
- pim_show_interfaces_single(vrf->info, vty, argv[idx]->arg, uj);
+ pim_show_interfaces_single(vrf->info, vty, argv[idx]->arg, mlag,
+ uj);
else
- pim_show_interfaces(vrf->info, vty, uj);
+ pim_show_interfaces(vrf->info, vty, mlag, uj);
return CMD_SUCCESS;
}
DEFUN (show_ip_pim_interface_vrf_all,
show_ip_pim_interface_vrf_all_cmd,
- "show ip pim vrf all interface [detail|WORD] [json]",
+ "show ip pim [mlag] vrf all interface [detail|WORD] [json]",
SHOW_STR
IP_STR
PIM_STR
+ "MLAG\n"
VRF_CMD_HELP_STR
"PIM interface information\n"
"Detailed output\n"
"interface name\n"
JSON_STR)
{
- int idx = 6;
+ int idx = 2;
bool uj = use_json(argc, argv);
struct vrf *vrf;
bool first = true;
+ bool mlag = false;
+
+ if (argv_find(argv, argc, "mlag", &idx))
+ mlag = true;
+ idx = 6;
if (uj)
vty_out(vty, "{ ");
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
@@ -4433,9 +4557,9 @@ DEFUN (show_ip_pim_interface_vrf_all,
if (argv_find(argv, argc, "WORD", &idx)
|| argv_find(argv, argc, "detail", &idx))
pim_show_interfaces_single(vrf->info, vty,
- argv[idx]->arg, uj);
+ argv[idx]->arg, mlag, uj);
else
- pim_show_interfaces(vrf->info, vty, uj);
+ pim_show_interfaces(vrf->info, vty, mlag, uj);
}
if (uj)
vty_out(vty, "}\n");
@@ -4625,113 +4749,6 @@ DEFUN (show_ip_pim_local_membership,
return CMD_SUCCESS;
}
-DEFUN (show_ip_pim_mlag_summary,
- show_ip_pim_mlag_summary_cmd,
- "show ip pim mlag summary [json]",
- SHOW_STR
- IP_STR
- PIM_STR
- "MLAG\n"
- "status and stats\n"
- JSON_STR)
-{
- bool uj = use_json(argc, argv);
- char role_buf[MLAG_ROLE_STRSIZE];
- char addr_buf[INET_ADDRSTRLEN];
-
- if (uj) {
- json_object *json = NULL;
- json_object *json_stat = NULL;
-
- json = json_object_new_object();
- if (router->mlag_flags & PIM_MLAGF_LOCAL_CONN_UP)
- json_object_boolean_true_add(json, "mlagConnUp");
- if (router->mlag_flags & PIM_MLAGF_PEER_CONN_UP)
- json_object_boolean_true_add(json, "mlagPeerConnUp");
- if (router->mlag_flags & PIM_MLAGF_PEER_ZEBRA_UP)
- json_object_boolean_true_add(json, "mlagPeerZebraUp");
- json_object_string_add(json, "mlagRole",
- mlag_role2str(router->mlag_role,
- role_buf, sizeof(role_buf)));
- inet_ntop(AF_INET, &router->local_vtep_ip,
- addr_buf, INET_ADDRSTRLEN);
- json_object_string_add(json, "localVtepIp", addr_buf);
- inet_ntop(AF_INET, &router->anycast_vtep_ip,
- addr_buf, INET_ADDRSTRLEN);
- json_object_string_add(json, "anycastVtepIp", addr_buf);
- json_object_string_add(json, "peerlinkRif",
- router->peerlink_rif);
-
- json_stat = json_object_new_object();
- json_object_int_add(json_stat, "mlagConnFlaps",
- router->mlag_stats.mlagd_session_downs);
- json_object_int_add(json_stat, "mlagPeerConnFlaps",
- router->mlag_stats.peer_session_downs);
- json_object_int_add(json_stat, "mlagPeerZebraFlaps",
- router->mlag_stats.peer_zebra_downs);
- json_object_int_add(json_stat, "mrouteAddRx",
- router->mlag_stats.msg.mroute_add_rx);
- json_object_int_add(json_stat, "mrouteAddTx",
- router->mlag_stats.msg.mroute_add_tx);
- json_object_int_add(json_stat, "mrouteDelRx",
- router->mlag_stats.msg.mroute_del_rx);
- json_object_int_add(json_stat, "mrouteDelTx",
- router->mlag_stats.msg.mroute_del_tx);
- json_object_int_add(json_stat, "mlagStatusUpdates",
- router->mlag_stats.msg.mlag_status_updates);
- json_object_int_add(json_stat, "peerZebraStatusUpdates",
- router->mlag_stats.msg.peer_zebra_status_updates);
- json_object_int_add(json_stat, "pimStatusUpdates",
- router->mlag_stats.msg.pim_status_updates);
- json_object_int_add(json_stat, "vxlanUpdates",
- router->mlag_stats.msg.vxlan_updates);
- json_object_object_add(json, "connStats", json_stat);
-
- vty_out(vty, "%s\n", json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
- json_object_free(json);
- return CMD_SUCCESS;
- }
-
- vty_out(vty, "MLAG daemon connection: %s\n",
- (router->mlag_flags & PIM_MLAGF_LOCAL_CONN_UP)
- ? "up" : "down");
- vty_out(vty, "MLAG peer state: %s\n",
- (router->mlag_flags & PIM_MLAGF_PEER_CONN_UP)
- ? "up" : "down");
- vty_out(vty, "Zebra peer state: %s\n",
- (router->mlag_flags & PIM_MLAGF_PEER_ZEBRA_UP)
- ? "up" : "down");
- vty_out(vty, "MLAG role: %s\n",
- mlag_role2str(router->mlag_role, role_buf, sizeof(role_buf)));
- inet_ntop(AF_INET, &router->local_vtep_ip,
- addr_buf, INET_ADDRSTRLEN);
- vty_out(vty, "Local VTEP IP: %s\n", addr_buf);
- inet_ntop(AF_INET, &router->anycast_vtep_ip,
- addr_buf, INET_ADDRSTRLEN);
- vty_out(vty, "Anycast VTEP IP: %s\n", addr_buf);
- vty_out(vty, "Peerlink: %s\n", router->peerlink_rif);
- vty_out(vty, "Session flaps: mlagd: %d mlag-peer: %d zebra-peer: %d\n",
- router->mlag_stats.mlagd_session_downs,
- router->mlag_stats.peer_session_downs,
- router->mlag_stats.peer_zebra_downs);
- vty_out(vty, "Message Statistics:\n");
- vty_out(vty, " mroute adds: rx: %d, tx: %d\n",
- router->mlag_stats.msg.mroute_add_rx,
- router->mlag_stats.msg.mroute_add_tx);
- vty_out(vty, " mroute dels: rx: %d, tx: %d\n",
- router->mlag_stats.msg.mroute_del_rx,
- router->mlag_stats.msg.mroute_del_tx);
- vty_out(vty, " peer zebra status updates: %d\n",
- router->mlag_stats.msg.peer_zebra_status_updates);
- vty_out(vty, " PIM status updates: %d\n",
- router->mlag_stats.msg.pim_status_updates);
- vty_out(vty, " VxLAN updates: %d\n",
- router->mlag_stats.msg.vxlan_updates);
-
- return CMD_SUCCESS;
-}
-
static void pim_show_mlag_up_entry_detail(struct vrf *vrf,
struct vty *vty, struct pim_upstream *up,
char *src_str, char *grp_str, json_object *json)
@@ -5772,12 +5789,18 @@ static void show_mroute(struct pim_instance *pim, struct vty *vty,
int oif_vif_index;
struct interface *ifp_in;
char proto[100];
+ char state_str[PIM_REG_STATE_STR_LEN];
+ char mroute_uptime[10];
if (uj) {
json = json_object_new_object();
} else {
+ vty_out(vty, "IP Multicast Routing Table\n");
+ vty_out(vty, "Flags: S- Sparse, C - Connected, P - Pruned\n");
+ vty_out(vty,
+ " R - RP-bit set, F - Register flag, T - SPT-bit set\n");
vty_out(vty,
- "Source Group Proto Input Output TTL Uptime\n");
+ "\nSource Group Flags Proto Input Output TTL Uptime\n");
}
now = pim_time_monotonic_sec();
@@ -5800,6 +5823,23 @@ static void show_mroute(struct pim_instance *pim, struct vty *vty,
sizeof(grp_str));
pim_inet4_dump("<source?>", c_oil->oil.mfcc_origin, src_str,
sizeof(src_str));
+
+ strlcpy(state_str, "S", sizeof(state_str));
+ /* When a non DR receives a igmp join, it creates a (*,G)
+ * channel_oil without any upstream creation */
+ if (c_oil->up) {
+ if (PIM_UPSTREAM_FLAG_TEST_SRC_IGMP(c_oil->up->flags))
+ strlcat(state_str, "C", sizeof(state_str));
+ if (pim_upstream_is_sg_rpt(c_oil->up))
+ strlcat(state_str, "R", sizeof(state_str));
+ if (PIM_UPSTREAM_FLAG_TEST_FHR(c_oil->up->flags))
+ strlcat(state_str, "F", sizeof(state_str));
+ if (c_oil->up->sptbit == PIM_UPSTREAM_SPTBIT_TRUE)
+ strlcat(state_str, "T", sizeof(state_str));
+ }
+ if (pim_channel_oil_empty(c_oil))
+ strlcat(state_str, "P", sizeof(state_str));
+
ifp_in = pim_if_find_by_vif_index(pim, c_oil->oil.mfcc_parent);
if (ifp_in)
@@ -5807,6 +5847,10 @@ static void show_mroute(struct pim_instance *pim, struct vty *vty,
else
strlcpy(in_ifname, "<iif?>", sizeof(in_ifname));
+
+ pim_time_uptime(mroute_uptime, sizeof(mroute_uptime),
+ now - c_oil->mroute_creation);
+
if (uj) {
/* Find the group, create it if it doesn't exist */
@@ -5819,7 +5863,8 @@ static void show_mroute(struct pim_instance *pim, struct vty *vty,
}
/* Find the source nested under the group, create it if
- * it doesn't exist */
+ * it doesn't exist
+ */
json_object_object_get_ex(json_group, src_str,
&json_source);
@@ -5840,13 +5885,14 @@ static void show_mroute(struct pim_instance *pim, struct vty *vty,
json_object_int_add(json_source, "OilInheritedRescan",
c_oil->oil_inherited_rescan);
json_object_string_add(json_source, "iif", in_ifname);
+ json_object_string_add(json_source, "upTime",
+ mroute_uptime);
json_oil = NULL;
}
for (oif_vif_index = 0; oif_vif_index < MAXVIFS;
++oif_vif_index) {
struct interface *ifp_out;
- char mroute_uptime[10];
int ttl;
ttl = c_oil->oil.mfcc_ttls[oif_vif_index];
@@ -5864,9 +5910,6 @@ static void show_mroute(struct pim_instance *pim, struct vty *vty,
continue;
ifp_out = pim_if_find_by_vif_index(pim, oif_vif_index);
- pim_time_uptime(
- mroute_uptime, sizeof(mroute_uptime),
- now - c_oil->mroute_creation);
found_oif = 1;
if (ifp_out)
@@ -5944,23 +5987,27 @@ static void show_mroute(struct pim_instance *pim, struct vty *vty,
}
vty_out(vty,
- "%-15s %-15s %-6s %-16s %-16s %-3d %8s\n",
- src_str, grp_str, proto, in_ifname,
- out_ifname, ttl, mroute_uptime);
+ "%-15s %-15s %-15s %-6s %-16s %-16s %-3d %8s\n",
+ src_str, grp_str, state_str, proto,
+ in_ifname, out_ifname, ttl,
+ mroute_uptime);
if (first) {
src_str[0] = '\0';
grp_str[0] = '\0';
in_ifname[0] = '\0';
+ state_str[0] = '\0';
+ mroute_uptime[0] = '\0';
first = 0;
}
}
}
if (!uj && !found_oif) {
- vty_out(vty, "%-15s %-15s %-6s %-16s %-16s %-3d %8s\n",
- src_str, grp_str, "none", in_ifname, "none", 0,
- "--:--:--");
+ vty_out(vty,
+ "%-15s %-15s %-15s %-6s %-16s %-16s %-3d %8s\n",
+ src_str, grp_str, state_str, "none", in_ifname,
+ "none", 0, "--:--:--");
}
}
@@ -8035,13 +8082,13 @@ DEFPY_HIDDEN (pim_test_sg_keepalive,
return CMD_SUCCESS;
}
-DEFPY_HIDDEN (interface_ip_pim_activeactive,
- interface_ip_pim_activeactive_cmd,
- "[no$no] ip pim active-active",
- NO_STR
- IP_STR
- PIM_STR
- "Mark interface as Active-Active for MLAG operations, Hidden because not finished yet\n")
+DEFPY (interface_ip_pim_activeactive,
+ interface_ip_pim_activeactive_cmd,
+ "[no$no] ip pim active-active",
+ NO_STR
+ IP_STR
+ PIM_STR
+ "Mark interface as Active-Active for MLAG operations, Hidden because not finished yet\n")
{
VTY_DECLVAR_CONTEXT(interface, ifp);
struct pim_interface *pim_ifp;
@@ -8051,6 +8098,11 @@ DEFPY_HIDDEN (interface_ip_pim_activeactive,
return CMD_WARNING_CONFIG_FAILED;
}
+
+ if (PIM_DEBUG_MLAG)
+ zlog_debug("%sConfiguring PIM active-active on Interface: %s",
+ no ? "Un-":" ", ifp->name);
+
pim_ifp = ifp->info;
if (no)
pim_if_unconfigure_mlag_dualactive(pim_ifp);