#endif
static struct cmd_node interface_node = {
- INTERFACE_NODE, "%s(config-if)# ", 1 /* vtysh ? yes */
+ .name = "interface",
+ .node = INTERFACE_NODE,
+ .parent_node = CONFIG_NODE,
+ .prompt = "%s(config-if)# ",
+ .config_write = pim_interface_config_write,
};
-static struct cmd_node debug_node = {DEBUG_NODE, "", 1};
+static struct cmd_node debug_node = {
+ .name = "debug",
+ .node = DEBUG_NODE,
+ .prompt = "",
+ .config_write = pim_debug_config_write,
+};
static struct vrf *pim_cmd_lookup_vrf(struct vty *vty, struct cmd_token *argv[],
const int argc, int *idx)
sg.src = src->source_addr;
sg.grp = grp->group_addr;
pim_ifchannel_local_membership_add(ifp,
- &sg);
+ &sg, false /*is_vxlan*/);
}
} /* scan group sources */
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;
if (!pim_ifp)
continue;
+ if (mlag == true && pim_ifp->activeactive == false)
+ continue;
+
if (strcmp(ifname, "detail") && strcmp(ifname, ifp->name))
continue;
}
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;
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;
pim_ifp->pim_ifstat_join_recv);
json_object_int_add(json_row, "joinTx",
pim_ifp->pim_ifstat_join_send);
+ json_object_int_add(json_row, "pruneTx",
+ pim_ifp->pim_ifstat_prune_send);
+ json_object_int_add(json_row, "pruneRx",
+ pim_ifp->pim_ifstat_prune_recv);
json_object_int_add(json_row, "registerRx",
pim_ifp->pim_ifstat_reg_recv);
json_object_int_add(json_row, "registerTx",
pim_ifchannel_ifjoin_name(ch->ifjoin_state, ch->flags));
if (PIM_IF_FLAG_TEST_S_G_RPT(ch->flags))
json_object_int_add(json_row, "SGRpt", 1);
-
+ if (PIM_IF_FLAG_TEST_PROTO_PIM(ch->flags))
+ json_object_int_add(json_row, "protocolPim", 1);
+ if (PIM_IF_FLAG_TEST_PROTO_IGMP(ch->flags))
+ json_object_int_add(json_row, "protocolIgmp", 1);
json_object_object_get_ex(json_iface, ch_grp_str, &json_grp);
if (!json_grp) {
json_grp = json_object_new_object();
continue;
RB_FOREACH (ch, pim_ifchannel_rb, &pim_ifp->ifchannel_rb) {
- if (sg->grp.s_addr != 0
+ if (sg->grp.s_addr != INADDR_ANY
&& sg->grp.s_addr != ch->sg.grp.s_addr)
continue;
- if (sg->src.s_addr != 0
+ if (sg->src.s_addr != INADDR_ANY
&& sg->src.s_addr != ch->sg.src.s_addr)
- continue;
+ continue;
pim_show_join_helper(vty, pim_ifp, ch, json, now, uj);
} /* scan interface channels */
}
char msdp_reg_timer[10];
char state_str[PIM_REG_STATE_STR_LEN];
- if (sg->grp.s_addr != 0 && sg->grp.s_addr != up->sg.grp.s_addr)
+ if (sg->grp.s_addr != INADDR_ANY
+ && sg->grp.s_addr != up->sg.grp.s_addr)
continue;
- if (sg->src.s_addr != 0 && sg->src.s_addr != up->sg.src.s_addr)
+ if (sg->src.s_addr != INADDR_ANY
+ && sg->src.s_addr != up->sg.src.s_addr)
continue;
pim_inet4_dump("<src?>", up->sg.src, src_str, sizeof(src_str));
}
for (ALL_LIST_ELEMENTS_RO(pim->global_scope.bsm_list, bsmnode, bsm)) {
- char grp_str[INET_ADDRSTRLEN];
+ char grp_str[PREFIX_STRLEN];
char rp_str[INET_ADDRSTRLEN];
char bsr_str[INET_ADDRSTRLEN];
struct bsmmsg_grpinfo *group;
if (!bsgrp)
continue;
- char grp_str[INET_ADDRSTRLEN];
+ char grp_str[PREFIX_STRLEN];
prefix2str(&bsgrp->group, grp_str, sizeof(grp_str));
if (uj) {
json = json_object_new_object();
- json_object_int_add(json, "Number of Received BSMs",
- pim->bsm_rcvd);
- json_object_int_add(json, "Number of Forwared BSMs",
- pim->bsm_sent);
- json_object_int_add(json, "Number of Dropped BSMs",
- pim->bsm_dropped);
+ json_object_int_add(json, "bsmRx", pim->bsm_rcvd);
+ json_object_int_add(json, "bsmTx", pim->bsm_sent);
+ json_object_int_add(json, "bsmDropped", pim->bsm_dropped);
} else {
vty_out(vty, "BSM Statistics :\n");
vty_out(vty, "----------------\n");
json_row = json_object_new_object();
json_object_string_add(json_row, "If Name", ifp->name);
+ json_object_int_add(json_row, "bsmDroppedConfig",
+ pim_ifp->pim_ifstat_bsm_cfg_miss);
json_object_int_add(
- json_row,
- "Number of BSMs dropped due to config miss",
- pim_ifp->pim_ifstat_bsm_cfg_miss);
- json_object_int_add(
- json_row, "Number of unicast BSMs dropped",
+ json_row, "bsmDroppedUnicast",
pim_ifp->pim_ifstat_ucast_bsm_cfg_miss);
json_object_int_add(json_row,
- "Number of BSMs dropped due to invalid scope zone",
+ "bsmDroppedInvalidScopeZone",
pim_ifp->pim_ifstat_bsm_invalid_sz);
json_object_object_add(json, ifp->name, json_row);
}
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),
json_object_string_add(json, "bsr", bsr_str);
json_object_int_add(json, "priority",
pim->global_scope.current_bsr_prio);
- json_object_int_add(json, "fragment_tag",
+ json_object_int_add(json, "fragmentTag",
pim->global_scope.bsm_frag_tag);
json_object_string_add(json, "state", bsr_state);
json_object_string_add(json, "upTime", uptime);
- json_object_string_add(json, "last_bsm_seen", last_bsm_seen);
+ json_object_string_add(json, "lastBsmSeen", last_bsm_seen);
}
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");
/* clean up all upstreams*/
while ((up = rb_pim_upstream_first(&pim->upstream_head))) {
- pim_upstream_del(pim, up, __PRETTY_FUNCTION__);
+ pim_upstream_del(pim, up, __func__);
}
}
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",
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"
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) {
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");
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)
+{
+ if (json) {
+ json_object *json_row = NULL;
+ json_object *own_list = NULL;
+ json_object *json_group = NULL;
+
+
+ json_object_object_get_ex(json, grp_str, &json_group);
+ if (!json_group) {
+ json_group = json_object_new_object();
+ json_object_object_add(json, grp_str,
+ json_group);
+ }
+
+ json_row = json_object_new_object();
+ json_object_string_add(json_row, "source", src_str);
+ json_object_string_add(json_row, "group", grp_str);
+
+ own_list = json_object_new_array();
+ if (pim_up_mlag_is_local(up))
+ json_object_array_add(own_list,
+ json_object_new_string("local"));
+ if (up->flags & (PIM_UPSTREAM_FLAG_MASK_MLAG_PEER))
+ json_object_array_add(own_list,
+ json_object_new_string("peer"));
+ if (up->flags & (PIM_UPSTREAM_FLAG_MASK_MLAG_INTERFACE))
+ json_object_array_add(
+ own_list, json_object_new_string("Interface"));
+ json_object_object_add(json_row, "owners", own_list);
+
+ json_object_int_add(json_row, "localCost",
+ pim_up_mlag_local_cost(up));
+ json_object_int_add(json_row, "peerCost",
+ pim_up_mlag_peer_cost(up));
+ if (PIM_UPSTREAM_FLAG_TEST_MLAG_NON_DF(up->flags))
+ json_object_boolean_false_add(json_row, "df");
+ else
+ json_object_boolean_true_add(json_row, "df");
+ json_object_object_add(json_group, src_str, json_row);
+ } else {
+ char own_str[6];
+
+ own_str[0] = '\0';
+ if (pim_up_mlag_is_local(up))
+ strlcat(own_str, "L", sizeof(own_str));
+ if (up->flags & (PIM_UPSTREAM_FLAG_MASK_MLAG_PEER))
+ strlcat(own_str, "P", sizeof(own_str));
+ if (up->flags & (PIM_UPSTREAM_FLAG_MASK_MLAG_INTERFACE))
+ strlcat(own_str, "I", sizeof(own_str));
+ /* XXX - fixup, print paragraph output */
+ vty_out(vty,
+ "%-15s %-15s %-6s %-11u %-10d %2s\n",
+ src_str, grp_str, own_str,
+ pim_up_mlag_local_cost(up),
+ pim_up_mlag_peer_cost(up),
+ PIM_UPSTREAM_FLAG_TEST_MLAG_NON_DF(up->flags)
+ ? "n" : "y");
+ }
+}
+
+static void pim_show_mlag_up_detail(struct vrf *vrf,
+ struct vty *vty, const char *src_or_group,
+ const char *group, bool uj)
+{
+ char src_str[INET_ADDRSTRLEN];
+ char grp_str[INET_ADDRSTRLEN];
+ struct pim_upstream *up;
+ struct pim_instance *pim = vrf->info;
+ json_object *json = NULL;
+
+ if (uj)
+ json = json_object_new_object();
+ else
+ vty_out(vty,
+ "Source Group Owner Local-cost Peer-cost DF\n");
+
+ frr_each (rb_pim_upstream, &pim->upstream_head, up) {
+ if (!(up->flags & PIM_UPSTREAM_FLAG_MASK_MLAG_PEER)
+ && !(up->flags & PIM_UPSTREAM_FLAG_MASK_MLAG_INTERFACE)
+ && !pim_up_mlag_is_local(up))
+ continue;
+
+ pim_inet4_dump("<src?>", up->sg.src, src_str, sizeof(src_str));
+ pim_inet4_dump("<grp?>", up->sg.grp, grp_str, sizeof(grp_str));
+ /* XXX: strcmps are clearly inefficient. we should do uint comps
+ * here instead.
+ */
+ if (group) {
+ if (strcmp(src_str, src_or_group) ||
+ strcmp(grp_str, group))
+ continue;
+ } else {
+ if (strcmp(src_str, src_or_group) &&
+ strcmp(grp_str, src_or_group))
+ continue;
+ }
+ pim_show_mlag_up_entry_detail(vrf, vty, up,
+ src_str, grp_str, json);
+ }
+
+ if (uj) {
+ vty_out(vty, "%s\n", json_object_to_json_string_ext(
+ json, JSON_C_TO_STRING_PRETTY));
+ json_object_free(json);
+ }
+}
+
+static void pim_show_mlag_up_vrf(struct vrf *vrf, struct vty *vty, bool uj)
+{
+ json_object *json = NULL;
+ json_object *json_row;
+ struct pim_upstream *up;
+ char src_str[INET_ADDRSTRLEN];
+ char grp_str[INET_ADDRSTRLEN];
+ struct pim_instance *pim = vrf->info;
+ json_object *json_group = NULL;
+
+ if (uj) {
+ json = json_object_new_object();
+ } else {
+ vty_out(vty,
+ "Source Group Owner Local-cost Peer-cost DF\n");
+ }
+
+ frr_each (rb_pim_upstream, &pim->upstream_head, up) {
+ if (!(up->flags & PIM_UPSTREAM_FLAG_MASK_MLAG_PEER)
+ && !(up->flags & PIM_UPSTREAM_FLAG_MASK_MLAG_INTERFACE)
+ && !pim_up_mlag_is_local(up))
+ continue;
+ pim_inet4_dump("<src?>", up->sg.src, src_str, sizeof(src_str));
+ pim_inet4_dump("<grp?>", up->sg.grp, grp_str, sizeof(grp_str));
+ if (uj) {
+ json_object *own_list = NULL;
+
+ json_object_object_get_ex(json, grp_str, &json_group);
+ if (!json_group) {
+ json_group = json_object_new_object();
+ json_object_object_add(json, grp_str,
+ json_group);
+ }
+
+ json_row = json_object_new_object();
+ json_object_string_add(json_row, "vrf", vrf->name);
+ json_object_string_add(json_row, "source", src_str);
+ json_object_string_add(json_row, "group", grp_str);
+
+ own_list = json_object_new_array();
+ if (pim_up_mlag_is_local(up)) {
+
+ json_object_array_add(own_list,
+ json_object_new_string("local"));
+ }
+ if (up->flags & (PIM_UPSTREAM_FLAG_MASK_MLAG_PEER)) {
+ json_object_array_add(own_list,
+ json_object_new_string("peer"));
+ }
+ json_object_object_add(json_row, "owners", own_list);
+
+ json_object_int_add(json_row, "localCost",
+ pim_up_mlag_local_cost(up));
+ json_object_int_add(json_row, "peerCost",
+ pim_up_mlag_peer_cost(up));
+ if (PIM_UPSTREAM_FLAG_TEST_MLAG_NON_DF(up->flags))
+ json_object_boolean_false_add(json_row, "df");
+ else
+ json_object_boolean_true_add(json_row, "df");
+ json_object_object_add(json_group, src_str, json_row);
+ } else {
+ char own_str[6];
+
+ own_str[0] = '\0';
+ if (pim_up_mlag_is_local(up))
+ strlcat(own_str, "L", sizeof(own_str));
+ if (up->flags & (PIM_UPSTREAM_FLAG_MASK_MLAG_PEER))
+ strlcat(own_str, "P", sizeof(own_str));
+ if (up->flags & (PIM_UPSTREAM_FLAG_MASK_MLAG_INTERFACE))
+ strlcat(own_str, "I", sizeof(own_str));
+ vty_out(vty,
+ "%-15s %-15s %-6s %-11u %-10u %2s\n",
+ src_str, grp_str, own_str,
+ pim_up_mlag_local_cost(up),
+ pim_up_mlag_peer_cost(up),
+ PIM_UPSTREAM_FLAG_TEST_MLAG_NON_DF(up->flags)
+ ? "n" : "y");
+ }
+ }
+ if (uj) {
+ vty_out(vty, "%s\n", json_object_to_json_string_ext(
+ json, JSON_C_TO_STRING_PRETTY));
+ json_object_free(json);
+ }
+}
+
+static void pim_show_mlag_help_string(struct vty *vty, bool uj)
+{
+ if (!uj) {
+ vty_out(vty, "Owner codes:\n");
+ vty_out(vty,
+ "L: EVPN-MLAG Entry, I:PIM-MLAG Entry, "
+ "P: Peer Entry\n");
+ }
+}
+
+
+DEFUN(show_ip_pim_mlag_up, show_ip_pim_mlag_up_cmd,
+ "show ip pim [vrf NAME] mlag upstream [A.B.C.D [A.B.C.D]] [json]",
+ SHOW_STR
+ IP_STR
+ PIM_STR
+ VRF_CMD_HELP_STR
+ "MLAG\n"
+ "upstream\n"
+ "Unicast or Multicast address\n"
+ "Multicast address\n" JSON_STR)
+{
+ const char *src_or_group = NULL;
+ const char *group = NULL;
+ int idx = 2;
+ struct vrf *vrf = pim_cmd_lookup_vrf(vty, argv, argc, &idx);
+ bool uj = use_json(argc, argv);
+
+ if (!vrf || !vrf->info) {
+ vty_out(vty, "%s: VRF or Info missing\n", __func__);
+ return CMD_WARNING;
+ }
+
+ if (uj)
+ argc--;
+
+ if (argv_find(argv, argc, "A.B.C.D", &idx)) {
+ src_or_group = argv[idx]->arg;
+ if (idx + 1 < argc)
+ group = argv[idx + 1]->arg;
+ }
+
+ pim_show_mlag_help_string(vty, uj);
+
+ if (src_or_group)
+ pim_show_mlag_up_detail(vrf, vty, src_or_group, group, uj);
+ else
+ pim_show_mlag_up_vrf(vrf, vty, uj);
+
+ return CMD_SUCCESS;
+}
+
+
+DEFUN(show_ip_pim_mlag_up_vrf_all, show_ip_pim_mlag_up_vrf_all_cmd,
+ "show ip pim vrf all mlag upstream [json]",
+ SHOW_STR IP_STR PIM_STR VRF_CMD_HELP_STR
+ "MLAG\n"
+ "upstream\n" JSON_STR)
+{
+ struct vrf *vrf;
+ bool uj = use_json(argc, argv);
+
+ pim_show_mlag_help_string(vty, uj);
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
+ pim_show_mlag_up_vrf(vrf, vty, uj);
+ }
+
+ return CMD_SUCCESS;
+}
+
DEFUN (show_ip_pim_neighbor,
show_ip_pim_neighbor_cmd,
"show ip pim [vrf NAME] neighbor [detail|WORD] [json]",
pim = vrf->info;
vty_out(vty, "Router MLAG Role: %s\n",
- mlag_role2str(router->role, mlag_role, sizeof(mlag_role)));
+ mlag_role2str(router->mlag_role, mlag_role, sizeof(mlag_role)));
vty_out(vty, "Mroute socket descriptor:");
vty_out(vty, " %d(%s)\n", pim->mroute_socket, vrf->name);
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,
- "Source Group Proto Input Output TTL Uptime\n");
+ " R - RP-bit set, F - Register flag, T - SPT-bit set\n");
+ vty_out(vty,
+ "\nSource Group Flags Proto Input Output TTL Uptime\n");
}
now = pim_time_monotonic_sec();
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)
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 */
}
/* 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);
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];
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)
}
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, "--:--:--");
}
}
switch (pim->spt.switchover) {
case PIM_SPT_IMMEDIATE:
- XFREE(MTYPE_PIM_SPT_PLIST_NAME, pim->spt.plist);
+ XFREE(MTYPE_PIM_PLIST_NAME, pim->spt.plist);
pim_upstream_add_lhr_star_pimreg(pim);
break;
case PIM_SPT_INFINITY:
pim_upstream_remove_lhr_star_pimreg(pim, plist);
- XFREE(MTYPE_PIM_SPT_PLIST_NAME, pim->spt.plist);
+ XFREE(MTYPE_PIM_PLIST_NAME, pim->spt.plist);
if (plist)
pim->spt.plist =
- XSTRDUP(MTYPE_PIM_SPT_PLIST_NAME, plist);
+ XSTRDUP(MTYPE_PIM_PLIST_NAME, plist);
break;
}
return pim_cmd_spt_switchover(pim, PIM_SPT_IMMEDIATE, NULL);
}
+DEFPY (pim_register_accept_list,
+ pim_register_accept_list_cmd,
+ "[no] ip pim register-accept-list WORD$word",
+ NO_STR
+ IP_STR
+ PIM_STR
+ "Only accept registers from a specific source prefix list\n"
+ "Prefix-List name\n")
+{
+ PIM_DECLVAR_CONTEXT(vrf, pim);
+
+ if (no)
+ XFREE(MTYPE_PIM_PLIST_NAME, pim->register_plist);
+ else {
+ XFREE(MTYPE_PIM_PLIST_NAME, pim->register_plist);
+ pim->register_plist = XSTRDUP(MTYPE_PIM_PLIST_NAME, word);
+ }
+ return CMD_SUCCESS;
+}
+
DEFUN (ip_pim_joinprune_time,
ip_pim_joinprune_time_cmd,
"ip pim join-prune-interval (60-600)",
static int pim_cmd_igmp_start(struct vty *vty, struct interface *ifp)
{
struct pim_interface *pim_ifp;
+ struct pim_instance *pim;
uint8_t need_startup = 0;
pim_ifp = ifp->info;
if (!pim_ifp) {
+ pim = pim_get_pim_instance(ifp->vrf_id);
+ /* Limit mcast interfaces to number of vifs available */
+ if (pim->mcast_if_count == MAXVIFS) {
+ vty_out(vty,
+ "Max multicast interfaces(%d) Reached. Could not enable IGMP on interface %s\n",
+ MAXVIFS, ifp->name);
+ return CMD_WARNING_CONFIG_FAILED;
+ }
(void)pim_if_new(ifp, true, false, false, false);
need_startup = 1;
} else {
pim_inet4_dump("<ifaddr?>", igmp->ifaddr, ifaddr_str,
sizeof(ifaddr_str));
zlog_debug("%s: Querier %s on %s reconfig query_interval=%d",
- __PRETTY_FUNCTION__, ifaddr_str, ifp->name,
+ __func__, ifaddr_str, ifp->name,
pim_ifp->igmp_default_query_interval);
}
static void igmp_sock_query_reschedule(struct igmp_sock *igmp)
{
+ if (igmp->mtrace_only)
+ return;
+
if (igmp->t_igmp_query_timer) {
/* other querier present */
zassert(igmp->t_igmp_query_timer);
return CMD_SUCCESS;
}
-static int pim_cmd_interface_add(struct interface *ifp)
+static int pim_cmd_interface_add(struct vty *vty, struct interface *ifp)
{
struct pim_interface *pim_ifp = ifp->info;
+ struct pim_instance *pim;
- if (!pim_ifp)
+ if (!pim_ifp) {
+ pim = pim_get_pim_instance(ifp->vrf_id);
+ /* Limiting mcast interfaces to number of VIFs */
+ if (pim->mcast_if_count == MAXVIFS) {
+ vty_out(vty, "Max multicast interfaces(%d) reached.",
+ MAXVIFS);
+ return 0;
+ }
pim_ifp = pim_if_new(ifp, false, true, false, false);
- else
+ } else
PIM_IF_DO_PIM(pim_ifp->options);
pim_if_addr_add_all(ifp);
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;
- if (!no && !pim_cmd_interface_add(ifp)) {
- vty_out(vty, "Could not enable PIM SM active-active on interface\n");
+ if (!no && !pim_cmd_interface_add(vty, ifp)) {
+ vty_out(vty,
+ "Could not enable PIM SM active-active on interface %s\n",
+ ifp->name);
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);
{
VTY_DECLVAR_CONTEXT(interface, ifp);
- if (!pim_cmd_interface_add(ifp)) {
- vty_out(vty, "Could not enable PIM SM on interface\n");
+ if (!pim_cmd_interface_add(vty, ifp)) {
+ vty_out(vty, "Could not enable PIM SM on interface %s\n",
+ ifp->name);
return CMD_WARNING_CONFIG_FAILED;
}
VTY_DECLVAR_CONTEXT(interface, ifp);
- if (!pim_cmd_interface_add(ifp)) {
- vty_out(vty, "Could not enable PIM SM on interface\n");
+ if (!pim_cmd_interface_add(vty, ifp)) {
+ vty_out(vty, "Could not enable PIM SM on interface %s\n",
+ ifp->name);
return CMD_WARNING_CONFIG_FAILED;
}
struct pim_interface *pim_ifp = ifp->info;
if (!pim_ifp) {
- if (!pim_cmd_interface_add(ifp)) {
- vty_out(vty, "Could not enable PIM SM on interface\n");
+ if (!pim_cmd_interface_add(vty, ifp)) {
+ vty_out(vty,
+ "Could not enable PIM SM on interface %s\n",
+ ifp->name);
return CMD_WARNING_CONFIG_FAILED;
}
}
struct bfd_info *bfd_info = NULL;
if (!pim_ifp) {
- if (!pim_cmd_interface_add(ifp)) {
- vty_out(vty, "Could not enable PIM SM on interface\n");
+ if (!pim_cmd_interface_add(vty, ifp)) {
+ vty_out(vty,
+ "Could not enable PIM SM on interface %s\n",
+ ifp->name);
return CMD_WARNING;
}
}
struct pim_interface *pim_ifp = ifp->info;
if (!pim_ifp) {
- if (!pim_cmd_interface_add(ifp)) {
- vty_out(vty, "Could not enable PIM SM on interface\n");
+ if (!pim_cmd_interface_add(vty, ifp)) {
+ vty_out(vty,
+ "Could not enable PIM SM on interface %s\n",
+ ifp->name);
return CMD_WARNING;
}
}
struct pim_interface *pim_ifp = ifp->info;
if (!pim_ifp) {
- if (!pim_cmd_interface_add(ifp)) {
- vty_out(vty, "Could not enable PIM SM on interface\n");
+ if (!pim_cmd_interface_add(vty, ifp)) {
+ vty_out(vty,
+ "Could not enable PIM SM on interface %s\n",
+ ifp->name);
return CMD_WARNING;
}
}
struct pim_interface *pim_ifp = ifp->info;
if (!pim_ifp) {
- if (!pim_cmd_interface_add(ifp)) {
- vty_out(vty, "Could not enable PIM SM on interface\n");
+ if (!pim_cmd_interface_add(vty, ifp)) {
+ vty_out(vty,
+ "Could not enable PIM SM on interface %s\n",
+ ifp->name);
return CMD_WARNING;
}
}
"mesh group local address\n")
{
PIM_DECLVAR_CONTEXT(vrf, pim);
- if (argc == 7)
- return ip_no_msdp_mesh_group_cmd_worker(pim, vty, argv[6]->arg);
+
+ return ip_no_msdp_mesh_group_source_cmd_worker(pim, vty, argv[4]->arg);
+}
+
+DEFUN (no_ip_msdp_mesh_group,
+ no_ip_msdp_mesh_group_cmd,
+ "no ip msdp mesh-group [WORD]",
+ NO_STR
+ IP_STR
+ CFG_MSDP_STR
+ "Delete MSDP mesh-group\n"
+ "mesh group name")
+{
+ PIM_DECLVAR_CONTEXT(vrf, pim);
+
+ if (argc == 5)
+ return ip_no_msdp_mesh_group_cmd_worker(pim, vty, argv[4]->arg);
else
- return ip_no_msdp_mesh_group_source_cmd_worker(pim, vty,
- argv[4]->arg);
+ return ip_no_msdp_mesh_group_cmd_worker(pim, vty, NULL);
}
static void print_empty_json_obj(struct vty *vty)
}
}
-static void pim_show_vxlan_sg_hash_entry(struct hash_backet *backet, void *arg)
+static void pim_show_vxlan_sg_hash_entry(struct hash_bucket *backet, void *arg)
{
pim_show_vxlan_sg_entry((struct pim_vxlan_sg *)backet->data,
(struct pim_sg_cache_walk_data *)arg);
addr.s_addr = 0;
pim_vxlan_mlag_update(true/*mlag_enable*/,
- false/*peer_state*/, PIM_VXLAN_MLAG_ROLE_SECONDARY,
+ false/*peer_state*/, MLAG_ROLE_NONE,
NULL/*peerlink*/, &addr);
return CMD_SUCCESS;
idx += 2;
if (!strcmp(argv[idx]->arg, "primary")) {
- role = PIM_VXLAN_MLAG_ROLE_PRIMARY;
+ role = MLAG_ROLE_PRIMARY;
} else if (!strcmp(argv[idx]->arg, "secondary")) {
- role = PIM_VXLAN_MLAG_ROLE_SECONDARY;
+ role = MLAG_ROLE_SECONDARY;
} else {
vty_out(vty, "unknown MLAG role %s\n", argv[idx]->arg);
return CMD_WARNING;
void pim_cmd_init(void)
{
- install_node(&interface_node,
- pim_interface_config_write); /* INTERFACE_NODE */
+ install_node(&interface_node); /* INTERFACE_NODE */
if_cmd_init();
- install_node(&debug_node, pim_debug_config_write);
+ install_node(&debug_node);
install_element(ENABLE_NODE, &pim_test_sg_keepalive_cmd);
install_element(CONFIG_NODE,
&no_ip_pim_spt_switchover_infinity_plist_cmd);
install_element(VRF_NODE, &no_ip_pim_spt_switchover_infinity_plist_cmd);
+ install_element(CONFIG_NODE, &pim_register_accept_list_cmd);
+ install_element(VRF_NODE, &pim_register_accept_list_cmd);
install_element(CONFIG_NODE, &ip_pim_joinprune_time_cmd);
install_element(VRF_NODE, &ip_pim_joinprune_time_cmd);
install_element(CONFIG_NODE, &no_ip_pim_joinprune_time_cmd);
install_element(VIEW_NODE, &show_ip_pim_join_vrf_all_cmd);
install_element(VIEW_NODE, &show_ip_pim_jp_agg_cmd);
install_element(VIEW_NODE, &show_ip_pim_local_membership_cmd);
+ install_element(VIEW_NODE, &show_ip_pim_mlag_summary_cmd);
+ install_element(VIEW_NODE, &show_ip_pim_mlag_up_cmd);
+ install_element(VIEW_NODE, &show_ip_pim_mlag_up_vrf_all_cmd);
install_element(VIEW_NODE, &show_ip_pim_neighbor_cmd);
install_element(VIEW_NODE, &show_ip_pim_neighbor_vrf_all_cmd);
install_element(VIEW_NODE, &show_ip_pim_rpf_cmd);
install_element(CONFIG_NODE, &no_debug_ssmpingd_cmd);
install_element(CONFIG_NODE, &debug_pim_zebra_cmd);
install_element(CONFIG_NODE, &no_debug_pim_zebra_cmd);
+ install_element(CONFIG_NODE, &debug_pim_mlag_cmd);
+ install_element(CONFIG_NODE, &no_debug_pim_mlag_cmd);
install_element(CONFIG_NODE, &debug_pim_vxlan_cmd);
install_element(CONFIG_NODE, &no_debug_pim_vxlan_cmd);
install_element(CONFIG_NODE, &debug_msdp_cmd);
install_element(VRF_NODE, &ip_msdp_mesh_group_source_cmd);
install_element(CONFIG_NODE, &no_ip_msdp_mesh_group_source_cmd);
install_element(VRF_NODE, &no_ip_msdp_mesh_group_source_cmd);
+ install_element(CONFIG_NODE, &no_ip_msdp_mesh_group_cmd);
+ install_element(VRF_NODE, &no_ip_msdp_mesh_group_cmd);
install_element(VIEW_NODE, &show_ip_msdp_peer_detail_cmd);
install_element(VIEW_NODE, &show_ip_msdp_peer_detail_vrf_all_cmd);
install_element(VIEW_NODE, &show_ip_msdp_sa_detail_cmd);