summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bgpd/bgp_evpn_mh.c6
-rw-r--r--bgpd/bgp_fsm.c70
-rw-r--r--bgpd/bgp_label.c6
-rw-r--r--bgpd/bgp_packet.c104
-rw-r--r--bgpd/bgp_route.c45
-rw-r--r--bgpd/bgp_routemap.c8
-rw-r--r--bgpd/bgp_script.c9
-rw-r--r--bgpd/bgp_vty.c4
-rw-r--r--bgpd/bgpd.c107
-rw-r--r--bgpd/bgpd.h12
-rw-r--r--bgpd/rfapi/rfapi.c4
-rw-r--r--configure.ac3
-rw-r--r--doc/developer/building-docker.rst21
-rw-r--r--doc/developer/draft-zebra-00.ms8
-rw-r--r--doc/developer/logging.rst59
-rw-r--r--doc/user/bgp.rst13
-rw-r--r--doc/user/zebra.rst4
-rw-r--r--docker/centos-8/Dockerfile8
-rw-r--r--docker/ubi-8/Dockerfile83
-rwxr-xr-xdocker/ubi-8/build.sh46
-rwxr-xr-xdocker/ubi-8/docker-start4
-rw-r--r--eigrpd/eigrp_routemap.c4
-rw-r--r--isisd/isis_bfd.c2
-rw-r--r--isisd/isis_nb_config.c2
-rw-r--r--isisd/isis_te.c4
-rw-r--r--isisd/isisd.c2
-rw-r--r--lib/frrscript.c6
-rw-r--r--lib/link_state.c19
-rw-r--r--lib/link_state.h2
-rw-r--r--lib/routemap.h1
-rw-r--r--lib/routemap_cli.c5
-rw-r--r--lib/thread.c2
-rw-r--r--lib/zlog.h2
-rw-r--r--m4/.gitignore1
-rw-r--r--ospf6d/ospf6_asbr.c1
-rw-r--r--ospf6d/ospf6_top.h2
-rw-r--r--ospfclient/ospf_apiclient.c6
-rw-r--r--ospfd/ospf_apiserver.c14
-rw-r--r--ospfd/ospf_apiserver.h10
-rw-r--r--ospfd/ospf_ext.c10
-rw-r--r--ospfd/ospf_opaque.c18
-rw-r--r--ospfd/ospf_opaque.h2
-rw-r--r--ospfd/ospf_ri.c12
-rw-r--r--ospfd/ospf_sr.c2
-rw-r--r--ospfd/ospf_te.c16
-rw-r--r--ospfd/ospf_vty.c15
-rw-r--r--ospfd/ospfd.h2
-rw-r--r--pathd/path_pcep_controller.h2
-rw-r--r--pathd/path_ted.c6
-rw-r--r--pbrd/pbr_zebra.c2
-rw-r--r--pceplib/pcep_msg_objects.h2
-rw-r--r--pimd/pim6_cmd.c852
-rw-r--r--pimd/pim_cmd.c2770
-rw-r--r--pimd/pim_cmd.h9
-rw-r--r--pimd/pim_cmd_common.c2096
-rw-r--r--pimd/pim_cmd_common.h43
-rw-r--r--pimd/pim_iface.c20
-rw-r--r--pimd/pim_iface.h28
-rw-r--r--pimd/pim_ifchannel.c4
-rw-r--r--pimd/pim_igmp.c90
-rw-r--r--pimd/pim_igmpv3.c4
-rw-r--r--pimd/pim_mroute.c22
-rw-r--r--pimd/pim_nb_config.c25
-rw-r--r--pimd/pim_nht.c55
-rw-r--r--pimd/pim_pim.c12
-rw-r--r--pimd/pim_rp.c13
-rw-r--r--pimd/pim_rp.h3
-rw-r--r--pimd/pim_upstream.c2
-rw-r--r--pimd/pim_vty.c4
-rw-r--r--pimd/pim_vxlan.c12
-rw-r--r--pimd/pim_zebra.c7
-rw-r--r--pimd/pim_zlookup.c6
-rw-r--r--ripd/rip_interface.c14
-rw-r--r--ripd/rip_routemap.c4
-rw-r--r--ripngd/ripng_interface.c14
-rw-r--r--ripngd/ripng_routemap.c4
-rw-r--r--staticd/static_zebra.c2
-rw-r--r--tests/lib/test_frrlua.c6
-rw-r--r--tests/lib/test_grpc.py4
-rw-r--r--tests/topotests/bgp_as_allow_in/test_bgp_as_allow_in.py2
-rw-r--r--tests/topotests/bgp_basic_functionality_topo1/test_bgp_basic_functionality.py2
-rw-r--r--tests/topotests/bgp_communities_topo1/test_bgp_communities.py2
-rw-r--r--tests/topotests/bgp_communities_topo1/test_bgp_communities_topo2.py2
-rw-r--r--tests/topotests/bgp_community_change_update/test_bgp_community_change_update.py2
-rw-r--r--tests/topotests/bgp_ecmp_topo2/test_ebgp_ecmp_topo2.py6
-rw-r--r--tests/topotests/bgp_ecmp_topo2/test_ibgp_ecmp_topo2.py6
-rwxr-xr-xtests/topotests/bgp_evpn_overlay_index_gateway/test_bgp_evpn_overlay_index_gateway.py2
-rw-r--r--tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1-1.py6
-rw-r--r--tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1-2.py6
-rw-r--r--tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1-3.py6
-rw-r--r--tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1-4.py8
-rw-r--r--tests/topotests/bgp_gr_functionality_topo2/test_bgp_gr_functionality_topo2-1.py2
-rw-r--r--tests/topotests/bgp_gr_functionality_topo2/test_bgp_gr_functionality_topo2-2.py2
-rw-r--r--tests/topotests/bgp_gr_functionality_topo2/test_bgp_gr_functionality_topo2-3.py2
-rw-r--r--tests/topotests/bgp_gr_functionality_topo2/test_bgp_gr_functionality_topo2-4.py2
-rw-r--r--tests/topotests/bgp_gr_functionality_topo3/bgp_gr_functionality_topo3.py2
-rw-r--r--tests/topotests/bgp_gshut_topo1/test_ebgp_gshut_topo1.py2
-rw-r--r--tests/topotests/bgp_gshut_topo1/test_ibgp_gshut_topo1.py2
-rw-r--r--tests/topotests/bgp_ipv4_over_ipv6/test_rfc5549_ebgp_ibgp_nbr.py6
-rw-r--r--tests/topotests/bgp_ipv4_over_ipv6/test_rfc5549_ebgp_nbr.py6
-rw-r--r--tests/topotests/bgp_ipv4_over_ipv6/test_rfc5549_ebgp_unnumbered_nbr.py6
-rw-r--r--tests/topotests/bgp_ipv4_over_ipv6/test_rfc5549_ibgp_nbr.py6
-rw-r--r--tests/topotests/bgp_ipv4_over_ipv6/test_rfc5549_ibgp_unnumbered_nbr.py6
-rw-r--r--tests/topotests/bgp_large_community/test_bgp_large_community_topo_1.py2
-rw-r--r--tests/topotests/bgp_large_community/test_bgp_large_community_topo_2.py2
-rw-r--r--tests/topotests/bgp_multi_vrf_topo1/test_bgp_multi_vrf_topo1.py2
-rw-r--r--tests/topotests/bgp_multi_vrf_topo2/test_bgp_multi_vrf_topo2.py2
-rw-r--r--tests/topotests/bgp_path_attributes_topo1/test_bgp_path_attributes.py2
-rw-r--r--tests/topotests/bgp_prefix_list_topo1/test_prefix_lists.py2
-rw-r--r--tests/topotests/bgp_recursive_route_ebgp_multi_hop/test_bgp_recursive_route_ebgp_multi_hop.py2
-rw-r--r--tests/topotests/bgp_route_aggregation/test_bgp_aggregation.py2
-rw-r--r--tests/topotests/bgp_route_map/test_route_map_topo1.py2
-rw-r--r--tests/topotests/bgp_route_map/test_route_map_topo2.py2
-rw-r--r--tests/topotests/bgp_tcp_mss/test_bgp_vrf_tcp_mss.py2
-rw-r--r--tests/topotests/bgp_vrf_dynamic_route_leak/test_bgp_vrf_dynamic_route_leak_topo1.py2
-rw-r--r--tests/topotests/bgp_vrf_dynamic_route_leak/test_bgp_vrf_dynamic_route_leak_topo2.py2
-rw-r--r--tests/topotests/bgp_vrf_dynamic_route_leak_topo3/test_bgp_vrf_dynamic_route_leak_topo3.py2
-rw-r--r--tests/topotests/bgp_vrf_dynamic_route_leak_topo4/test_bgp_vrf_dynamic_route_leak_topo4.py2
-rw-r--r--tests/topotests/bgp_vrf_lite_best_path_test/test_bgp_vrf_lite_best_path_topo1.py2
-rw-r--r--tests/topotests/bgp_vrf_lite_best_path_test/test_bgp_vrf_lite_best_path_topo2.py2
-rw-r--r--tests/topotests/evpn_type5_test_topo1/test_evpn_type5_chaos_topo1.py2
-rw-r--r--tests/topotests/evpn_type5_test_topo1/test_evpn_type5_topo1.py2
-rwxr-xr-xtests/topotests/example_topojson_test/test_topo_json_multiple_links/test_example_topojson_multiple_links.py2
-rwxr-xr-xtests/topotests/example_topojson_test/test_topo_json_single_link/test_example_topojson.py2
-rwxr-xr-xtests/topotests/example_topojson_test/test_topo_json_single_link_loopback/test_example_topojson.py2
-rw-r--r--tests/topotests/lib/common_config.py6
-rw-r--r--tests/topotests/lib/pim.py28
-rw-r--r--tests/topotests/multicast_pim_bsm_topo1/test_mcast_pim_bsmp_01.py4
-rw-r--r--tests/topotests/multicast_pim_bsm_topo2/test_mcast_pim_bsmp_02.py10
-rwxr-xr-xtests/topotests/multicast_pim_sm_topo1/test_multicast_pim_sm_topo1.py2
-rwxr-xr-xtests/topotests/multicast_pim_sm_topo2/test_multicast_pim_sm_topo2.py2
-rwxr-xr-xtests/topotests/multicast_pim_sm_topo3/test_multicast_pim_sm_topo3.py2
-rwxr-xr-xtests/topotests/multicast_pim_sm_topo3/test_multicast_pim_sm_topo4.py2
-rwxr-xr-xtests/topotests/multicast_pim_static_rp_topo1/test_multicast_pim_static_rp.py2
-rw-r--r--tests/topotests/ospf_basic_functionality/test_ospf_asbr_summary_topo1.py2
-rw-r--r--tests/topotests/ospf_basic_functionality/test_ospf_asbr_summary_type7_lsa.py2
-rw-r--r--tests/topotests/ospf_basic_functionality/test_ospf_authentication.py2
-rw-r--r--tests/topotests/ospf_basic_functionality/test_ospf_chaos.py2
-rw-r--r--tests/topotests/ospf_basic_functionality/test_ospf_ecmp.py2
-rw-r--r--tests/topotests/ospf_basic_functionality/test_ospf_ecmp_lan.py2
-rw-r--r--tests/topotests/ospf_basic_functionality/test_ospf_lan.py2
-rw-r--r--tests/topotests/ospf_basic_functionality/test_ospf_nssa.py2
-rw-r--r--tests/topotests/ospf_basic_functionality/test_ospf_p2mp.py2
-rw-r--r--tests/topotests/ospf_basic_functionality/test_ospf_routemaps.py2
-rw-r--r--tests/topotests/ospf_basic_functionality/test_ospf_rte_calc.py2
-rw-r--r--tests/topotests/ospf_basic_functionality/test_ospf_single_area.py2
-rw-r--r--tests/topotests/ospf_gr_helper/test_ospf_gr_helper.py2
-rw-r--r--tests/topotests/ospfv3_basic_functionality/test_ospfv3_asbr_summary_topo1.py2
-rw-r--r--tests/topotests/ospfv3_basic_functionality/test_ospfv3_authentication.py2
-rw-r--r--tests/topotests/ospfv3_basic_functionality/test_ospfv3_ecmp.py6
-rw-r--r--tests/topotests/ospfv3_basic_functionality/test_ospfv3_ecmp_lan.py6
-rw-r--r--tests/topotests/ospfv3_basic_functionality/test_ospfv3_nssa.py2
-rw-r--r--tests/topotests/ospfv3_basic_functionality/test_ospfv3_nssa2.py2
-rw-r--r--tests/topotests/ospfv3_basic_functionality/test_ospfv3_routemaps.py2
-rw-r--r--tests/topotests/ospfv3_basic_functionality/test_ospfv3_rte_calc.py6
-rw-r--r--tests/topotests/ospfv3_basic_functionality/test_ospfv3_single_area.py2
-rw-r--r--tests/topotests/static_routing_with_ebgp/test_static_routes_topo1_ebgp.py2
-rw-r--r--tests/topotests/static_routing_with_ebgp/test_static_routes_topo2_ebgp.py2
-rw-r--r--tests/topotests/static_routing_with_ebgp/test_static_routes_topo3_ebgp.py2
-rw-r--r--tests/topotests/static_routing_with_ebgp/test_static_routes_topo4_ebgp.py2
-rw-r--r--tests/topotests/static_routing_with_ibgp/test_static_routes_topo1_ibgp.py2
-rw-r--r--tests/topotests/static_routing_with_ibgp/test_static_routes_topo2_ibgp.py2
-rw-r--r--tests/topotests/static_routing_with_ibgp/test_static_routes_topo3_ibgp.py2
-rw-r--r--tests/topotests/static_routing_with_ibgp/test_static_routes_topo4_ibgp.py2
-rw-r--r--tools/frrcommon.sh.in6
-rw-r--r--vtysh/vtysh.c2
-rw-r--r--yang/frr-bgp-bmp.yang6
-rw-r--r--yang/frr-bgp-common-structure.yang4
-rw-r--r--yang/frr-bgp-common.yang2
-rw-r--r--zebra/rtadv.c8
-rw-r--r--zebra/zebra_evpn_mac.c2
-rw-r--r--zebra/zebra_srv6_vty.c6
-rw-r--r--zebra/zebra_vxlan.c7
-rw-r--r--zebra/zserv.c4
174 files changed, 4202 insertions, 3036 deletions
diff --git a/bgpd/bgp_evpn_mh.c b/bgpd/bgp_evpn_mh.c
index ed3716f601..d73186979d 100644
--- a/bgpd/bgp_evpn_mh.c
+++ b/bgpd/bgp_evpn_mh.c
@@ -1273,9 +1273,9 @@ void bgp_evpn_mh_config_ead_export_rt(struct bgp *bgp,
}
}
- if (node_to_del)
- list_delete_node(bgp_mh_info->ead_es_export_rtl,
- node_to_del);
+ assert(node_to_del);
+ list_delete_node(bgp_mh_info->ead_es_export_rtl,
+ node_to_del);
}
} else {
listnode_add_sort(bgp_mh_info->ead_es_export_rtl, ecomcfg);
diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c
index 43908fcb78..26aac6e6f7 100644
--- a/bgpd/bgp_fsm.c
+++ b/bgpd/bgp_fsm.c
@@ -677,8 +677,7 @@ static void bgp_llgr_stale_timer_expire(struct thread *thread)
* stale routes from the neighbor that it is retaining.
*/
if (bgp_debug_neighbor_events(peer))
- zlog_debug("%s(%s) Long-lived stale timer (%s) expired",
- peer->host, bgp_peer_hostname(peer),
+ zlog_debug("%pBP Long-lived stale timer (%s) expired", peer,
get_afi_safi_str(afi, safi, false));
UNSET_FLAG(peer->af_sflags[afi][safi], PEER_STATUS_LLGR_WAIT);
@@ -720,10 +719,8 @@ static void bgp_set_llgr_stale(struct peer *peer, afi_t afi, safi_t safi)
if (bgp_debug_neighbor_events(peer))
zlog_debug(
- "%s(%s) Long-lived set stale community (LLGR_STALE) for: %pFX",
- peer->host,
- bgp_peer_hostname(peer),
- &dest->p);
+ "%pBP Long-lived set stale community (LLGR_STALE) for: %pFX",
+ peer, &dest->p);
attr = *pi->attr;
bgp_attr_add_llgr_community(&attr);
@@ -750,10 +747,8 @@ static void bgp_set_llgr_stale(struct peer *peer, afi_t afi, safi_t safi)
if (bgp_debug_neighbor_events(peer))
zlog_debug(
- "%s(%s) Long-lived set stale community (LLGR_STALE) for: %pFX",
- peer->host,
- bgp_peer_hostname(peer),
- &dest->p);
+ "%pBP Long-lived set stale community (LLGR_STALE) for: %pFX",
+ peer, &dest->p);
attr = *pi->attr;
bgp_attr_add_llgr_community(&attr);
@@ -777,10 +772,9 @@ static void bgp_graceful_restart_timer_expire(struct thread *thread)
peer = THREAD_ARG(thread);
if (bgp_debug_neighbor_events(peer)) {
- zlog_debug("%s(%s) graceful restart timer expired", peer->host,
- bgp_peer_hostname(peer));
- zlog_debug("%s(%s) graceful restart stalepath timer stopped",
- peer->host, bgp_peer_hostname(peer));
+ zlog_debug("%pBP graceful restart timer expired", peer);
+ zlog_debug("%pBP graceful restart stalepath timer stopped",
+ peer);
}
FOREACH_AFI_SAFI (afi, safi) {
@@ -806,8 +800,8 @@ static void bgp_graceful_restart_timer_expire(struct thread *thread)
if (bgp_debug_neighbor_events(peer))
zlog_debug(
- "%s(%s) Long-lived stale timer (%s) started for %d sec",
- peer->host, bgp_peer_hostname(peer),
+ "%pBP Long-lived stale timer (%s) started for %d sec",
+ peer,
get_afi_safi_str(afi, safi, false),
peer->llgr[afi][safi].stale_time);
@@ -842,8 +836,8 @@ static void bgp_graceful_stale_timer_expire(struct thread *thread)
peer = THREAD_ARG(thread);
if (bgp_debug_neighbor_events(peer))
- zlog_debug("%s(%s) graceful restart stalepath timer expired",
- peer->host, bgp_peer_hostname(peer));
+ zlog_debug("%pBP graceful restart stalepath timer expired",
+ peer);
/* NSF delete stale route */
FOREACH_AFI_SAFI_NSF (afi, safi)
@@ -1395,8 +1389,8 @@ int bgp_stop(struct peer *peer)
struct vrf *vrf = vrf_lookup_by_id(peer->bgp->vrf_id);
zlog_info(
- "%%ADJCHANGE: neighbor %s(%s) in vrf %s Down %s",
- peer->host, bgp_peer_hostname(peer),
+ "%%ADJCHANGE: neighbor %pBP in vrf %s Down %s",
+ peer,
vrf ? ((vrf->vrf_id != VRF_DEFAULT)
? vrf->name
: VRF_DEFAULT_NAME)
@@ -1409,19 +1403,17 @@ int bgp_stop(struct peer *peer)
BGP_TIMER_OFF(peer->t_gr_stale);
if (bgp_debug_neighbor_events(peer))
zlog_debug(
- "%s(%s) graceful restart stalepath timer stopped",
- peer->host, bgp_peer_hostname(peer));
+ "%pBP graceful restart stalepath timer stopped",
+ peer);
}
if (CHECK_FLAG(peer->sflags, PEER_STATUS_NSF_WAIT)) {
if (bgp_debug_neighbor_events(peer)) {
zlog_debug(
- "%s(%s) graceful restart timer started for %d sec",
- peer->host, bgp_peer_hostname(peer),
- peer->v_gr_restart);
+ "%pBP graceful restart timer started for %d sec",
+ peer, peer->v_gr_restart);
zlog_debug(
- "%s(%s) graceful restart stalepath timer started for %d sec",
- peer->host, bgp_peer_hostname(peer),
- peer->bgp->stalepath_time);
+ "%pBP graceful restart stalepath timer started for %d sec",
+ peer, peer->bgp->stalepath_time);
}
BGP_TIMER_ON(peer->t_gr_restart,
bgp_graceful_restart_timer_expire,
@@ -1442,8 +1434,8 @@ int bgp_stop(struct peer *peer)
if (bgp_debug_neighbor_events(peer))
zlog_debug(
- "%s(%s) route-refresh restart stalepath timer stopped",
- peer->host, bgp_peer_hostname(peer));
+ "%pBP route-refresh restart stalepath timer stopped",
+ peer);
}
/* If peer reset before receiving EOR, decrement EOR count and
@@ -2099,8 +2091,7 @@ static int bgp_establish(struct peer *peer)
/* bgp log-neighbor-changes of neighbor Up */
if (CHECK_FLAG(peer->bgp->flags, BGP_FLAG_LOG_NEIGHBOR_CHANGES)) {
struct vrf *vrf = vrf_lookup_by_id(peer->bgp->vrf_id);
- zlog_info("%%ADJCHANGE: neighbor %s(%s) in vrf %s Up",
- peer->host, bgp_peer_hostname(peer),
+ zlog_info("%%ADJCHANGE: neighbor %pBP in vrf %s Up", peer,
vrf ? ((vrf->vrf_id != VRF_DEFAULT)
? vrf->name
: VRF_DEFAULT_NAME)
@@ -2113,9 +2104,9 @@ static int bgp_establish(struct peer *peer)
UNSET_FLAG(peer->sflags, PEER_STATUS_NSF_WAIT);
if (bgp_debug_neighbor_events(peer)) {
if (BGP_PEER_RESTARTING_MODE(peer))
- zlog_debug("peer %s BGP_RESTARTING_MODE", peer->host);
+ zlog_debug("%pBP BGP_RESTARTING_MODE", peer);
else if (BGP_PEER_HELPER_MODE(peer))
- zlog_debug("peer %s BGP_HELPER_MODE", peer->host);
+ zlog_debug("%pBP BGP_HELPER_MODE", peer);
}
FOREACH_AFI_SAFI_NSF (afi, safi) {
@@ -2189,16 +2180,15 @@ static int bgp_establish(struct peer *peer)
BGP_TIMER_OFF(peer->t_gr_stale);
if (bgp_debug_neighbor_events(peer))
zlog_debug(
- "%s(%s) graceful restart stalepath timer stopped",
- peer->host, bgp_peer_hostname(peer));
+ "%pBP graceful restart stalepath timer stopped",
+ peer);
}
}
if (peer->t_gr_restart) {
BGP_TIMER_OFF(peer->t_gr_restart);
if (bgp_debug_neighbor_events(peer))
- zlog_debug("%s(%s) graceful restart timer stopped",
- peer->host, bgp_peer_hostname(peer));
+ zlog_debug("%pBP graceful restart timer stopped", peer);
}
/* Reset uptime, turn on keepalives, send current table. */
@@ -2215,8 +2205,8 @@ static int bgp_establish(struct peer *peer)
BGP_TIMER_OFF(peer->t_llgr_stale[afi][safi]);
if (bgp_debug_neighbor_events(peer))
zlog_debug(
- "%s Long-lived stale timer stopped for afi/safi: %d/%d",
- peer->host, afi, safi);
+ "%pBP Long-lived stale timer stopped for afi/safi: %d/%d",
+ peer, afi, safi);
}
if (CHECK_FLAG(peer->af_cap[afi][safi],
diff --git a/bgpd/bgp_label.c b/bgpd/bgp_label.c
index 4a20f2c090..f53deb63b3 100644
--- a/bgpd/bgp_label.c
+++ b/bgpd/bgp_label.c
@@ -313,14 +313,14 @@ static int bgp_nlri_get_labels(struct peer *peer, uint8_t *pnt, uint8_t plen,
/* If we RX multiple labels we will end up keeping only the last
* one. We do not yet support a label stack greater than 1. */
if (label_depth > 1)
- zlog_info("%s rcvd UPDATE with label stack %d deep", peer->host,
+ zlog_info("%pBP rcvd UPDATE with label stack %d deep", peer,
label_depth);
if (!(bgp_is_withdraw_label(label) || label_bos(label)))
flog_warn(
EC_BGP_INVALID_LABEL_STACK,
- "%s rcvd UPDATE with invalid label stack - no bottom of stack",
- peer->host);
+ "%pBP rcvd UPDATE with invalid label stack - no bottom of stack",
+ peer);
return llen;
}
diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c
index 424659136e..8b8fcf58c0 100644
--- a/bgpd/bgp_packet.c
+++ b/bgpd/bgp_packet.c
@@ -483,10 +483,8 @@ void bgp_generate_updgrp_packets(struct thread *thread)
if (bgp_debug_neighbor_events(
peer))
zlog_debug(
- "%s(%s) sending route-refresh (EoRR) for %s/%s",
- peer->host,
- bgp_peer_hostname(
- peer),
+ "%pBP sending route-refresh (EoRR) for %s/%s",
+ peer,
afi2str(afi),
safi2str(safi));
}
@@ -915,10 +913,8 @@ void bgp_route_refresh_send(struct peer *peer, afi_t afi, safi_t safi,
stream_putc(s, ORF_COMMON_PART_REMOVE_ALL);
if (bgp_debug_neighbor_events(peer))
zlog_debug(
- "%s(%s) sending REFRESH_REQ to remove ORF(%d) (%s) for afi/safi: %s/%s",
- peer->host,
- bgp_peer_hostname(peer),
- orf_type,
+ "%pBP sending REFRESH_REQ to remove ORF(%d) (%s) for afi/safi: %s/%s",
+ peer, orf_type,
(when_to_refresh ==
REFRESH_DEFER
? "defer"
@@ -935,10 +931,8 @@ void bgp_route_refresh_send(struct peer *peer, afi_t afi, safi_t safi,
ORF_COMMON_PART_DENY);
if (bgp_debug_neighbor_events(peer))
zlog_debug(
- "%s(%s) sending REFRESH_REQ with pfxlist ORF(%d) (%s) for afi/safi: %s/%s",
- peer->host,
- bgp_peer_hostname(peer),
- orf_type,
+ "%pBP sending REFRESH_REQ with pfxlist ORF(%d) (%s) for afi/safi: %s/%s",
+ peer, orf_type,
(when_to_refresh ==
REFRESH_DEFER
? "defer"
@@ -958,9 +952,9 @@ void bgp_route_refresh_send(struct peer *peer, afi_t afi, safi_t safi,
if (bgp_debug_neighbor_events(peer)) {
if (!orf_refresh)
zlog_debug(
- "%s(%s) sending REFRESH_REQ for afi/safi: %s/%s",
- peer->host, bgp_peer_hostname(peer),
- iana_afi2str(pkt_afi), iana_safi2str(pkt_safi));
+ "%pBP sending REFRESH_REQ for afi/safi: %s/%s",
+ peer, iana_afi2str(pkt_afi),
+ iana_safi2str(pkt_safi));
}
/* Add packet to the peer. */
@@ -1004,8 +998,8 @@ void bgp_capability_send(struct peer *peer, afi_t afi, safi_t safi,
if (bgp_debug_neighbor_events(peer))
zlog_debug(
- "%s(%s) sending CAPABILITY has %s MP_EXT CAP for afi/safi: %s/%s",
- peer->host, bgp_peer_hostname(peer),
+ "%pBP sending CAPABILITY has %s MP_EXT CAP for afi/safi: %s/%s",
+ peer,
action == CAPABILITY_ACTION_SET ? "Advertising"
: "Removing",
iana_afi2str(pkt_afi), iana_safi2str(pkt_safi));
@@ -1561,8 +1555,8 @@ static void bgp_refresh_stalepath_timer_expire(struct thread *thread)
if (bgp_debug_neighbor_events(peer))
zlog_debug(
- "%s(%s) route-refresh (BoRR) timer expired for afi/safi: %d/%d",
- peer->host, bgp_peer_hostname(peer), afi, safi);
+ "%pBP route-refresh (BoRR) timer expired for afi/safi: %d/%d",
+ peer, afi, safi);
bgp_timer_set(peer);
}
@@ -1714,12 +1708,11 @@ static int bgp_update_receive(struct peer *peer, bgp_size_t size)
if (attr_parse_ret == BGP_ATTR_PARSE_WITHDRAW)
flog_err(
EC_BGP_UPDATE_RCV,
- "%s rcvd UPDATE with errors in attr(s)!! Withdrawing route.",
- peer->host);
+ "%pBP rcvd UPDATE with errors in attr(s)!! Withdrawing route.",
+ peer);
if (ret && bgp_debug_update(peer, NULL, NULL, 1)) {
- zlog_debug("%s(%s) rcvd UPDATE w/ attr: %s", peer->host,
- bgp_peer_hostname(peer),
+ zlog_debug("%pBP rcvd UPDATE w/ attr: %s", peer,
peer->rcvd_attr_str);
peer->rcvd_attr_printed = 1;
}
@@ -1749,9 +1742,8 @@ static int bgp_update_receive(struct peer *peer, bgp_size_t size)
}
if (BGP_DEBUG(update, UPDATE_IN))
- zlog_debug("%s(%s) rcvd UPDATE wlen %d attrlen %d alen %d",
- peer->host, bgp_peer_hostname(peer), withdraw_len,
- attribute_len, update_len);
+ zlog_debug("%pBP rcvd UPDATE wlen %d attrlen %d alen %d", peer,
+ withdraw_len, attribute_len, update_len);
/* Parse any given NLRIs */
for (int i = NLRI_UPDATE; i < NLRI_TYPE_MAX; i++) {
@@ -2104,8 +2096,8 @@ static int bgp_route_refresh_receive(struct peer *peer, bgp_size_t size)
if (bgp_debug_neighbor_events(peer)) {
zlog_debug(
- "%s rcvd Prefixlist ORF(%d) length %d",
- peer->host, orf_type, orf_len);
+ "%pBP rcvd Prefixlist ORF(%d) length %d",
+ peer, orf_type, orf_len);
}
/* we're going to read at least 1 byte of common
@@ -2137,8 +2129,8 @@ static int bgp_route_refresh_receive(struct peer *peer, bgp_size_t size)
if (bgp_debug_neighbor_events(
peer))
zlog_debug(
- "%s rcvd Remove-All pfxlist ORF request",
- peer->host);
+ "%pBP rcvd Remove-All pfxlist ORF request",
+ peer);
prefix_bgp_orf_remove_all(afi,
name);
break;
@@ -2189,8 +2181,8 @@ static int bgp_route_refresh_receive(struct peer *peer, bgp_size_t size)
char buf[INET6_BUFSIZ];
zlog_debug(
- "%s rcvd %s %s seq %u %s/%d ge %d le %d%s",
- peer->host,
+ "%pBP rcvd %s %s seq %u %s/%d ge %d le %d%s",
+ peer,
(common & ORF_COMMON_PART_REMOVE
? "Remove"
: "Add"),
@@ -2220,8 +2212,8 @@ static int bgp_route_refresh_receive(struct peer *peer, bgp_size_t size)
if (!ok || (ok && ret != CMD_SUCCESS)) {
zlog_info(
- "%s Received misformatted prefixlist ORF. Remove All pfxlist",
- peer->host);
+ "%pBP Received misformatted prefixlist ORF. Remove All pfxlist",
+ peer);
prefix_bgp_orf_remove_all(afi,
name);
break;
@@ -2234,7 +2226,7 @@ static int bgp_route_refresh_receive(struct peer *peer, bgp_size_t size)
stream_forward_getp(s, orf_len);
}
if (bgp_debug_neighbor_events(peer))
- zlog_debug("%s rcvd Refresh %s ORF request", peer->host,
+ zlog_debug("%pBP rcvd Refresh %s ORF request", peer,
when_to_refresh == REFRESH_DEFER
? "Defer"
: "Immediate");
@@ -2285,18 +2277,16 @@ static int bgp_route_refresh_receive(struct peer *peer, bgp_size_t size)
PEER_STATUS_EOR_RECEIVED)) {
if (bgp_debug_neighbor_events(peer))
zlog_debug(
- "%s(%s) rcvd route-refresh (BoRR) for %s/%s before EoR",
- peer->host, bgp_peer_hostname(peer),
- afi2str(afi), safi2str(safi));
+ "%pBP rcvd route-refresh (BoRR) for %s/%s before EoR",
+ peer, afi2str(afi), safi2str(safi));
return BGP_PACKET_NOOP;
}
if (peer->t_refresh_stalepath) {
if (bgp_debug_neighbor_events(peer))
zlog_debug(
- "%s(%s) rcvd route-refresh (BoRR) for %s/%s, whereas BoRR already received",
- peer->host, bgp_peer_hostname(peer),
- afi2str(afi), safi2str(safi));
+ "%pBP rcvd route-refresh (BoRR) for %s/%s, whereas BoRR already received",
+ peer, afi2str(afi), safi2str(safi));
return BGP_PACKET_NOOP;
}
@@ -2324,16 +2314,14 @@ static int bgp_route_refresh_receive(struct peer *peer, bgp_size_t size)
if (bgp_debug_neighbor_events(peer))
zlog_debug(
- "%s(%s) rcvd route-refresh (BoRR) for %s/%s, triggering timer for %u seconds",
- peer->host, bgp_peer_hostname(peer),
- afi2str(afi), safi2str(safi),
+ "%pBP rcvd route-refresh (BoRR) for %s/%s, triggering timer for %u seconds",
+ peer, afi2str(afi), safi2str(safi),
peer->bgp->stalepath_time);
} else if (subtype == BGP_ROUTE_REFRESH_EORR) {
if (!peer->t_refresh_stalepath) {
zlog_err(
- "%s(%s) rcvd route-refresh (EoRR) for %s/%s, whereas no BoRR received",
- peer->host, bgp_peer_hostname(peer),
- afi2str(afi), safi2str(safi));
+ "%pBP rcvd route-refresh (EoRR) for %s/%s, whereas no BoRR received",
+ peer, afi2str(afi), safi2str(safi));
return BGP_PACKET_NOOP;
}
@@ -2345,18 +2333,16 @@ static int bgp_route_refresh_receive(struct peer *peer, bgp_size_t size)
if (bgp_debug_neighbor_events(peer))
zlog_debug(
- "%s(%s) rcvd route-refresh (EoRR) for %s/%s, stopping BoRR timer",
- peer->host, bgp_peer_hostname(peer),
- afi2str(afi), safi2str(safi));
+ "%pBP rcvd route-refresh (EoRR) for %s/%s, stopping BoRR timer",
+ peer, afi2str(afi), safi2str(safi));
if (peer->nsf[afi][safi])
bgp_clear_stale_route(peer, afi, safi);
} else {
if (bgp_debug_neighbor_events(peer))
zlog_debug(
- "%s(%s) rcvd route-refresh (REQUEST) for %s/%s",
- peer->host, bgp_peer_hostname(peer),
- afi2str(afi), safi2str(safi));
+ "%pBP rcvd route-refresh (REQUEST) for %s/%s",
+ peer, afi2str(afi), safi2str(safi));
/* In response to a "normal route refresh request" from the
* peer, the speaker MUST send a BoRR message.
@@ -2371,10 +2357,9 @@ static int bgp_route_refresh_receive(struct peer *peer, bgp_size_t size)
PEER_STATUS_EOR_SEND)) {
if (bgp_debug_neighbor_events(peer))
zlog_debug(
- "%s(%s) rcvd route-refresh (REQUEST) for %s/%s before EoR",
- peer->host,
- bgp_peer_hostname(peer),
- afi2str(afi), safi2str(safi));
+ "%pBP rcvd route-refresh (REQUEST) for %s/%s before EoR",
+ peer, afi2str(afi),
+ safi2str(safi));
return BGP_PACKET_NOOP;
}
@@ -2383,9 +2368,8 @@ static int bgp_route_refresh_receive(struct peer *peer, bgp_size_t size)
if (bgp_debug_neighbor_events(peer))
zlog_debug(
- "%s(%s) sending route-refresh (BoRR) for %s/%s",
- peer->host, bgp_peer_hostname(peer),
- afi2str(afi), safi2str(safi));
+ "%pBP sending route-refresh (BoRR) for %s/%s",
+ peer, afi2str(afi), safi2str(safi));
/* Set flag Ready-To-Send to know when we can send EoRR
* message.
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 01120ef44a..72eba2c3be 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -2207,6 +2207,7 @@ bool subgroup_announce_check(struct bgp_dest *dest, struct bgp_path_info *pi,
ret = route_map_apply(ROUTE_MAP_OUT(filter), p,
&rmap_path);
+ bgp_attr_flush(&dummy_attr);
peer->rmap_type = 0;
if (ret == RMAP_DENYMATCH) {
@@ -2216,7 +2217,6 @@ bool subgroup_announce_check(struct bgp_dest *dest, struct bgp_path_info *pi,
peer->host, p,
ROUTE_MAP_OUT_NAME(filter));
- bgp_attr_flush(&dummy_attr);
return false;
}
}
@@ -3433,9 +3433,9 @@ bool bgp_maximum_prefix_overflow(struct peer *peer, afi_t afi, safi_t safi,
return false;
zlog_info(
- "%%MAXPFXEXCEED: No. of %s prefix received from %s(%s) %u exceed, limit %u",
- get_afi_safi_str(afi, safi, false), peer->host,
- bgp_peer_hostname(peer), pcount, peer->pmax[afi][safi]);
+ "%%MAXPFXEXCEED: No. of %s prefix received from %pBP %u exceed, limit %u",
+ get_afi_safi_str(afi, safi, false), peer, pcount,
+ peer->pmax[afi][safi]);
SET_FLAG(peer->af_sflags[afi][safi], PEER_STATUS_PREFIX_LIMIT);
if (CHECK_FLAG(peer->af_flags[afi][safi],
@@ -3473,9 +3473,8 @@ bool bgp_maximum_prefix_overflow(struct peer *peer, afi_t afi, safi_t safi,
if (bgp_debug_neighbor_events(peer))
zlog_debug(
- "%s(%s) Maximum-prefix restart timer started for %d secs",
- peer->host, bgp_peer_hostname(peer),
- peer->v_pmax_restart);
+ "%pBP Maximum-prefix restart timer started for %d secs",
+ peer, peer->v_pmax_restart);
BGP_TIMER_ON(peer->t_pmax_restart,
bgp_maximum_prefix_restart_timer,
@@ -3495,8 +3494,8 @@ bool bgp_maximum_prefix_overflow(struct peer *peer, afi_t afi, safi_t safi,
return false;
zlog_info(
- "%%MAXPFX: No. of %s prefix received from %s reaches %u, max %u",
- get_afi_safi_str(afi, safi, false), peer->host, pcount,
+ "%%MAXPFX: No. of %s prefix received from %pBP reaches %u, max %u",
+ get_afi_safi_str(afi, safi, false), peer, pcount,
peer->pmax[afi][safi]);
SET_FLAG(peer->af_sflags[afi][safi],
PEER_STATUS_PREFIX_THRESHOLD);
@@ -4009,7 +4008,7 @@ int bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id,
num_labels, addpath_id ? 1 : 0,
addpath_id, evpn, pfx_buf,
sizeof(pfx_buf));
- zlog_debug("%s rcvd %s", peer->host,
+ zlog_debug("%pBP rcvd %s", peer,
pfx_buf);
}
@@ -4024,8 +4023,8 @@ int bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id,
if (bgp_debug_update(peer, p, NULL, 1)) {
if (!peer->rcvd_attr_printed) {
zlog_debug(
- "%s rcvd UPDATE w/ attr: %s",
- peer->host,
+ "%pBP rcvd UPDATE w/ attr: %s",
+ peer,
peer->rcvd_attr_str);
peer->rcvd_attr_printed = 1;
}
@@ -4036,8 +4035,8 @@ int bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id,
addpath_id, evpn, pfx_buf,
sizeof(pfx_buf));
zlog_debug(
- "%s rcvd %s...duplicate ignored",
- peer->host, pfx_buf);
+ "%pBP rcvd %s...duplicate ignored",
+ peer, pfx_buf);
}
/* graceful restart STALE flag unset. */
@@ -4063,8 +4062,8 @@ int bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id,
addpath_id ? 1 : 0, addpath_id, evpn,
pfx_buf, sizeof(pfx_buf));
zlog_debug(
- "%s rcvd %s, flapped quicker than processing",
- peer->host, pfx_buf);
+ "%pBP rcvd %s, flapped quicker than processing",
+ peer, pfx_buf);
}
bgp_path_info_restore(dest, pi);
@@ -4084,7 +4083,7 @@ int bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id,
num_labels, addpath_id ? 1 : 0,
addpath_id, evpn, pfx_buf,
sizeof(pfx_buf));
- zlog_debug("%s rcvd %s", peer->host, pfx_buf);
+ zlog_debug("%pBP rcvd %s", peer, pfx_buf);
}
/* graceful restart STALE flag unset. */
@@ -4381,7 +4380,7 @@ int bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id,
/* Received Logging. */
if (bgp_debug_update(peer, p, NULL, 1)) {
if (!peer->rcvd_attr_printed) {
- zlog_debug("%s rcvd UPDATE w/ attr: %s", peer->host,
+ zlog_debug("%pBP rcvd UPDATE w/ attr: %s", peer,
peer->rcvd_attr_str);
peer->rcvd_attr_printed = 1;
}
@@ -4389,7 +4388,7 @@ int bgp_update(struct peer *peer, const struct prefix *p, uint32_t addpath_id,
bgp_debug_rdpfxpath2str(afi, safi, prd, p, label, num_labels,
addpath_id ? 1 : 0, addpath_id, evpn,
pfx_buf, sizeof(pfx_buf));
- zlog_debug("%s rcvd %s", peer->host, pfx_buf);
+ zlog_debug("%pBP rcvd %s", peer, pfx_buf);
}
/* Make new BGP info. */
@@ -4533,7 +4532,7 @@ filtered:
if (bgp_debug_update(peer, p, NULL, 1)) {
if (!peer->rcvd_attr_printed) {
- zlog_debug("%s rcvd UPDATE w/ attr: %s", peer->host,
+ zlog_debug("%pBP rcvd UPDATE w/ attr: %s", peer,
peer->rcvd_attr_str);
peer->rcvd_attr_printed = 1;
}
@@ -4541,8 +4540,8 @@ filtered:
bgp_debug_rdpfxpath2str(afi, safi, prd, p, label, num_labels,
addpath_id ? 1 : 0, addpath_id, evpn,
pfx_buf, sizeof(pfx_buf));
- zlog_debug("%s rcvd UPDATE about %s -- DENIED due to: %s",
- peer->host, pfx_buf, reason);
+ zlog_debug("%pBP rcvd UPDATE about %s -- DENIED due to: %s",
+ peer, pfx_buf, reason);
}
if (pi) {
@@ -4646,7 +4645,7 @@ int bgp_withdraw(struct peer *peer, const struct prefix *p, uint32_t addpath_id,
bgp_debug_rdpfxpath2str(afi, safi, prd, p, label, num_labels,
addpath_id ? 1 : 0, addpath_id, NULL,
pfx_buf, sizeof(pfx_buf));
- zlog_debug("%s rcvd UPDATE about %s -- withdrawn", peer->host,
+ zlog_debug("%pBP rcvd UPDATE about %s -- withdrawn", peer,
pfx_buf);
}
diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c
index 6fcc083e33..1d87641a2d 100644
--- a/bgpd/bgp_routemap.c
+++ b/bgpd/bgp_routemap.c
@@ -1841,7 +1841,7 @@ struct route_map_rule_cmd route_set_srte_color_cmd = {
"sr-te color", route_set_srte_color, route_set_srte_color_compile,
route_set_srte_color_free};
-/* Set nexthop to object. ojbect must be pointer to struct attr. */
+/* Set nexthop to object. object must be pointer to struct attr. */
struct rmap_ip_nexthop_set {
struct in_addr *address;
int peer_address;
@@ -3306,7 +3306,7 @@ static const struct route_map_rule_cmd
/* `set ipv6 nexthop global IP_ADDRESS' */
-/* Set nexthop to object. ojbect must be pointer to struct attr. */
+/* Set nexthop to object. object must be pointer to struct attr. */
static enum route_map_cmd_result_t
route_set_ipv6_nexthop_global(void *rule, const struct prefix *p, void *object)
{
@@ -3418,7 +3418,7 @@ static const struct route_map_rule_cmd
/* `set ipv6 nexthop local IP_ADDRESS' */
-/* Set nexthop to object. ojbect must be pointer to struct attr. */
+/* Set nexthop to object. object must be pointer to struct attr. */
static enum route_map_cmd_result_t
route_set_ipv6_nexthop_local(void *rule, const struct prefix *p, void *object)
{
@@ -3478,7 +3478,7 @@ static const struct route_map_rule_cmd
/* `set ipv6 nexthop peer-address' */
-/* Set nexthop to object. ojbect must be pointer to struct attr. */
+/* Set nexthop to object. object must be pointer to struct attr. */
static enum route_map_cmd_result_t
route_set_ipv6_nexthop_peer(void *rule, const struct prefix *pfx, void *object)
{
diff --git a/bgpd/bgp_script.c b/bgpd/bgp_script.c
index 9446a25a05..bf3e612bfd 100644
--- a/bgpd/bgp_script.c
+++ b/bgpd/bgp_script.c
@@ -156,18 +156,19 @@ void lua_pushattr(lua_State *L, const struct attr *attr)
void lua_decode_attr(lua_State *L, int idx, struct attr *attr)
{
- lua_getfield(L, -1, "metric");
+ lua_getfield(L, idx, "metric");
attr->med = lua_tointeger(L, -1);
lua_pop(L, 1);
- lua_getfield(L, -1, "ifindex");
+ lua_getfield(L, idx, "ifindex");
attr->nh_ifindex = lua_tointeger(L, -1);
lua_pop(L, 1);
- lua_getfield(L, -1, "aspath");
+ lua_getfield(L, idx, "aspath");
attr->aspath = aspath_str2aspath(lua_tostring(L, -1));
lua_pop(L, 1);
- lua_getfield(L, -1, "localpref");
+ lua_getfield(L, idx, "localpref");
attr->local_pref = lua_tointeger(L, -1);
lua_pop(L, 1);
+ lua_pop(L, 1);
}
void *lua_toattr(lua_State *L, int idx)
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index 3600e2f0ec..54237604bf 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -13042,7 +13042,7 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, bool use_json,
json_object_object_add(json_cap, "hostName",
json_hname);
- /* Gracefull Restart */
+ /* Graceful Restart */
if (CHECK_FLAG(p->cap, PEER_CAP_RESTART_RCV) ||
CHECK_FLAG(p->cap, PEER_CAP_RESTART_ADV)) {
if (CHECK_FLAG(p->cap, PEER_CAP_RESTART_ADV) &&
@@ -13452,7 +13452,7 @@ static void bgp_show_peer(struct vty *vty, struct peer *p, bool use_json,
vty_out(vty, "none");
vty_out(vty, "\n");
}
- } /* Gracefull Restart */
+ } /* Graceful Restart */
}
}
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c
index 22c09a38ac..6f06ad5a40 100644
--- a/bgpd/bgpd.c
+++ b/bgpd/bgpd.c
@@ -2349,15 +2349,14 @@ void peer_nsf_stop(struct peer *peer)
if (peer->t_gr_restart) {
BGP_TIMER_OFF(peer->t_gr_restart);
if (bgp_debug_neighbor_events(peer))
- zlog_debug("%s(%s) graceful restart timer stopped",
- peer->host, bgp_peer_hostname(peer));
+ zlog_debug("%pBP graceful restart timer stopped", peer);
}
if (peer->t_gr_stale) {
BGP_TIMER_OFF(peer->t_gr_stale);
if (bgp_debug_neighbor_events(peer))
zlog_debug(
- "%s(%s) graceful restart stalepath timer stopped",
- peer->host, bgp_peer_hostname(peer));
+ "%pBP graceful restart stalepath timer stopped",
+ peer);
}
bgp_clear_route_all(peer);
}
@@ -4296,9 +4295,8 @@ static void peer_flag_modify_action(struct peer *peer, uint32_t flag)
BGP_TIMER_OFF(peer->t_pmax_restart);
if (bgp_debug_neighbor_events(peer))
zlog_debug(
- "%s(%s) Maximum-prefix restart timer canceled",
- peer->host,
- bgp_peer_hostname(peer));
+ "%pBP Maximum-prefix restart timer canceled",
+ peer);
}
if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->status)) {
@@ -4491,7 +4489,7 @@ static int peer_flag_modify(struct peer *peer, uint32_t flag, int set)
}
/*
- * Update peer-group members, unless they are explicitely overriding
+ * Update peer-group members, unless they are explicitly overriding
* peer-group configuration.
*/
for (ALL_LIST_ELEMENTS(peer->group->peer, node, nnode, member)) {
@@ -4659,7 +4657,7 @@ static int peer_af_flag_modify(struct peer *peer, afi_t afi, safi_t safi,
set != invert);
} else {
/*
- * Update peer-group members, unless they are explicitely
+ * Update peer-group members, unless they are explicitly
* overriding peer-group configuration.
*/
for (ALL_LIST_ELEMENTS(peer->group->peer, node, nnode,
@@ -4921,7 +4919,7 @@ int peer_update_source_if_set(struct peer *peer, const char *ifname)
/*
* Set flag and configuration on all peer-group members, unless they are
- * explicitely overriding peer-group configuration.
+ * explicitly overriding peer-group configuration.
*/
for (ALL_LIST_ELEMENTS(peer->group->peer, node, nnode, member)) {
/* Skip peers with overridden configuration. */
@@ -4992,7 +4990,7 @@ int peer_update_source_addr_set(struct peer *peer, const union sockunion *su)
/*
* Set flag and configuration on all peer-group members, unless they are
- * explicitely overriding peer-group configuration.
+ * explicitly overriding peer-group configuration.
*/
for (ALL_LIST_ELEMENTS(peer->group->peer, node, nnode, member)) {
/* Skip peers with overridden configuration. */
@@ -5069,7 +5067,7 @@ int peer_update_source_unset(struct peer *peer)
/*
* Set flag and configuration on all peer-group members, unless they are
- * explicitely overriding peer-group configuration.
+ * explicitly overriding peer-group configuration.
*/
for (ALL_LIST_ELEMENTS(peer->group->peer, node, nnode, member)) {
/* Skip peers with overridden configuration. */
@@ -5149,7 +5147,7 @@ int peer_default_originate_set(struct peer *peer, afi_t afi, safi_t safi,
/*
* Set flag and configuration on all peer-group members, unless they are
- * explicitely overriding peer-group configuration.
+ * explicitly overriding peer-group configuration.
*/
for (ALL_LIST_ELEMENTS(peer->group->peer, node, nnode, member)) {
/* Skip peers with overridden configuration. */
@@ -5225,7 +5223,7 @@ int peer_default_originate_unset(struct peer *peer, afi_t afi, safi_t safi)
/*
* Remove flag and configuration from all peer-group members, unless
- * they are explicitely overriding peer-group configuration.
+ * they are explicitly overriding peer-group configuration.
*/
for (ALL_LIST_ELEMENTS(peer->group->peer, node, nnode, member)) {
/* Skip peers with overridden configuration. */
@@ -5330,7 +5328,7 @@ int peer_weight_set(struct peer *peer, afi_t afi, safi_t safi, uint16_t weight)
/*
* Set flag and configuration on all peer-group members, unless they are
- * explicitely overriding peer-group configuration.
+ * explicitly overriding peer-group configuration.
*/
for (ALL_LIST_ELEMENTS(peer->group->peer, node, nnode, member)) {
/* Skip peers with overridden configuration. */
@@ -5377,7 +5375,7 @@ int peer_weight_unset(struct peer *peer, afi_t afi, safi_t safi)
/*
* Remove flag and configuration from all peer-group members, unless
- * they are explicitely overriding peer-group configuration.
+ * they are explicitly overriding peer-group configuration.
*/
for (ALL_LIST_ELEMENTS(peer->group->peer, node, nnode, member)) {
/* Skip peers with overridden configuration. */
@@ -5423,7 +5421,7 @@ int peer_timers_set(struct peer *peer, uint32_t keepalive, uint32_t holdtime)
/*
* Set flag and configuration on all peer-group members, unless they are
- * explicitely overriding peer-group configuration.
+ * explicitly overriding peer-group configuration.
*/
for (ALL_LIST_ELEMENTS(peer->group->peer, node, nnode, member)) {
/* Skip peers with overridden configuration. */
@@ -5462,7 +5460,7 @@ int peer_timers_unset(struct peer *peer)
/*
* Remove flag and configuration from all peer-group members, unless
- * they are explicitely overriding peer-group configuration.
+ * they are explicitly overriding peer-group configuration.
*/
for (ALL_LIST_ELEMENTS(peer->group->peer, node, nnode, member)) {
/* Skip peers with overridden configuration. */
@@ -5502,7 +5500,7 @@ int peer_timers_connect_set(struct peer *peer, uint32_t connect)
}
/*
* Set flag and configuration on all peer-group members, unless they are
- * explicitely overriding peer-group configuration.
+ * explicitly overriding peer-group configuration.
*/
for (ALL_LIST_ELEMENTS(peer->group->peer, node, nnode, member)) {
/* Skip peers with overridden configuration. */
@@ -5556,7 +5554,7 @@ int peer_timers_connect_unset(struct peer *peer)
}
/*
* Remove flag and configuration from all peer-group members, unless
- * they are explicitely overriding peer-group configuration.
+ * they are explicitly overriding peer-group configuration.
*/
for (ALL_LIST_ELEMENTS(peer->group->peer, node, nnode, member)) {
/* Skip peers with overridden configuration. */
@@ -5604,7 +5602,7 @@ int peer_advertise_interval_set(struct peer *peer, uint32_t routeadv)
/*
* Set flag and configuration on all peer-group members, unless they are
- * explicitely overriding peer-group configuration.
+ * explicitly overriding peer-group configuration.
*/
for (ALL_LIST_ELEMENTS(peer->group->peer, node, nnode, member)) {
/* Skip peers with overridden configuration. */
@@ -5661,7 +5659,7 @@ int peer_advertise_interval_unset(struct peer *peer)
/*
* Remove flag and configuration from all peer-group members, unless
- * they are explicitely overriding peer-group configuration.
+ * they are explicitly overriding peer-group configuration.
*/
for (ALL_LIST_ELEMENTS(peer->group->peer, node, nnode, member)) {
/* Skip peers with overridden configuration. */
@@ -5702,7 +5700,7 @@ int peer_timers_delayopen_set(struct peer *peer, uint32_t delayopen)
return 0;
/* Set flag and configuration on all peer-group members, unless they are
- * explicitely overriding peer-group configuration.
+ * explicitly overriding peer-group configuration.
*/
for (ALL_LIST_ELEMENTS_RO(peer->group->peer, node, member)) {
/* Skip peers with overridden configuration. */
@@ -5749,7 +5747,7 @@ int peer_timers_delayopen_unset(struct peer *peer)
return 0;
/* Remove flag and configuration from all peer-group members, unless
- * they are explicitely overriding peer-group configuration.
+ * they are explicitly overriding peer-group configuration.
*/
for (ALL_LIST_ELEMENTS_RO(peer->group->peer, node, member)) {
/* Skip peers with overridden configuration. */
@@ -5819,7 +5817,7 @@ int peer_allowas_in_set(struct peer *peer, afi_t afi, safi_t safi,
/*
* Set flag and configuration on all peer-group members, unless
- * they are explicitely overriding peer-group configuration.
+ * they are explicitly overriding peer-group configuration.
*/
for (ALL_LIST_ELEMENTS(peer->group->peer, node, nnode, member)) {
/* Skip peers with overridden configuration. */
@@ -5885,7 +5883,7 @@ int peer_allowas_in_unset(struct peer *peer, afi_t afi, safi_t safi)
/*
* Remove flags and configuration from all peer-group members, unless
- * they are explicitely overriding peer-group configuration.
+ * they are explicitly overriding peer-group configuration.
*/
for (ALL_LIST_ELEMENTS(peer->group->peer, node, nnode, member)) {
/* Skip peers with overridden configuration. */
@@ -5954,7 +5952,7 @@ int peer_local_as_set(struct peer *peer, as_t as, bool no_prepend,
/*
* Set flag and configuration on all peer-group members, unless they are
- * explicitely overriding peer-group configuration.
+ * explicitly overriding peer-group configuration.
*/
for (ALL_LIST_ELEMENTS(peer->group->peer, node, nnode, member)) {
/* Skip peers with overridden configuration. */
@@ -6030,7 +6028,7 @@ int peer_local_as_unset(struct peer *peer)
/*
* Remove flag and configuration from all peer-group members, unless
- * they are explicitely overriding peer-group configuration.
+ * they are explicitly overriding peer-group configuration.
*/
for (ALL_LIST_ELEMENTS(peer->group->peer, node, nnode, member)) {
/* Skip peers with overridden configuration. */
@@ -6094,7 +6092,7 @@ int peer_password_set(struct peer *peer, const char *password)
/*
* Set flag and configuration on all peer-group members, unless they are
- * explicitely overriding peer-group configuration.
+ * explicitly overriding peer-group configuration.
*/
for (ALL_LIST_ELEMENTS(peer->group->peer, node, nnode, member)) {
/* Skip peers with overridden configuration. */
@@ -6172,7 +6170,7 @@ int peer_password_unset(struct peer *peer)
/*
* Remove flag and configuration from all peer-group members, unless
- * they are explicitely overriding peer-group configuration.
+ * they are explicitly overriding peer-group configuration.
*/
for (ALL_LIST_ELEMENTS(peer->group->peer, node, nnode, member)) {
/* Skip peers with overridden configuration. */
@@ -6242,7 +6240,7 @@ int peer_distribute_set(struct peer *peer, afi_t afi, safi_t safi, int direct,
/*
* Set configuration on all peer-group members, un less they are
- * explicitely overriding peer-group configuration.
+ * explicitly overriding peer-group configuration.
*/
for (ALL_LIST_ELEMENTS(peer->group->peer, node, nnode, member)) {
/* Skip peers with overridden configuration. */
@@ -6309,7 +6307,7 @@ int peer_distribute_unset(struct peer *peer, afi_t afi, safi_t safi, int direct)
/*
* Remove configuration on all peer-group members, unless they are
- * explicitely overriding peer-group configuration.
+ * explicitly overriding peer-group configuration.
*/
for (ALL_LIST_ELEMENTS(peer->group->peer, node, nnode, member)) {
/* Skip peers with overridden configuration. */
@@ -6427,7 +6425,7 @@ int peer_prefix_list_set(struct peer *peer, afi_t afi, safi_t safi, int direct,
/*
* Set configuration on all peer-group members, unless they are
- * explicitely overriding peer-group configuration.
+ * explicitly overriding peer-group configuration.
*/
for (ALL_LIST_ELEMENTS(peer->group->peer, node, nnode, member)) {
/* Skip peers with overridden configuration. */
@@ -6495,7 +6493,7 @@ int peer_prefix_list_unset(struct peer *peer, afi_t afi, safi_t safi,
/*
* Remove configuration on all peer-group members, unless they are
- * explicitely overriding peer-group configuration.
+ * explicitly overriding peer-group configuration.
*/
for (ALL_LIST_ELEMENTS(peer->group->peer, node, nnode, member)) {
/* Skip peers with overridden configuration. */
@@ -6611,7 +6609,7 @@ int peer_aslist_set(struct peer *peer, afi_t afi, safi_t safi, int direct,
/*
* Set configuration on all peer-group members, unless they are
- * explicitely overriding peer-group configuration.
+ * explicitly overriding peer-group configuration.
*/
for (ALL_LIST_ELEMENTS(peer->group->peer, node, nnode, member)) {
/* Skip peers with overridden configuration. */
@@ -6678,7 +6676,7 @@ int peer_aslist_unset(struct peer *peer, afi_t afi, safi_t safi, int direct)
/*
* Remove configuration on all peer-group members, unless they are
- * explicitely overriding peer-group configuration.
+ * explicitly overriding peer-group configuration.
*/
for (ALL_LIST_ELEMENTS(peer->group->peer, node, nnode, member)) {
/* Skip peers with overridden configuration. */
@@ -6808,7 +6806,7 @@ int peer_route_map_set(struct peer *peer, afi_t afi, safi_t safi, int direct,
/*
* Set configuration on all peer-group members, unless they are
- * explicitely overriding peer-group configuration.
+ * explicitly overriding peer-group configuration.
*/
for (ALL_LIST_ELEMENTS(peer->group->peer, node, nnode, member)) {
/* Skip peers with overridden configuration. */
@@ -6874,7 +6872,7 @@ int peer_route_map_unset(struct peer *peer, afi_t afi, safi_t safi, int direct)
/*
* Remove configuration on all peer-group members, unless they are
- * explicitely overriding peer-group configuration.
+ * explicitly overriding peer-group configuration.
*/
for (ALL_LIST_ELEMENTS(peer->group->peer, node, nnode, member)) {
/* Skip peers with overridden configuration. */
@@ -6928,7 +6926,7 @@ int peer_unsuppress_map_set(struct peer *peer, afi_t afi, safi_t safi,
/*
* Set configuration on all peer-group members, unless they are
- * explicitely overriding peer-group configuration.
+ * explicitly overriding peer-group configuration.
*/
for (ALL_LIST_ELEMENTS(peer->group->peer, node, nnode, member)) {
/* Skip peers with overridden configuration. */
@@ -6990,7 +6988,7 @@ int peer_unsuppress_map_unset(struct peer *peer, afi_t afi, safi_t safi)
/*
* Remove configuration on all peer-group members, unless they are
- * explicitely overriding peer-group configuration.
+ * explicitly overriding peer-group configuration.
*/
for (ALL_LIST_ELEMENTS(peer->group->peer, node, nnode, member)) {
/* Skip peers with overridden configuration. */
@@ -7094,7 +7092,7 @@ int peer_advertise_map_set(struct peer *peer, afi_t afi, safi_t safi,
/*
* Set configuration on all peer-group members, unless they are
- * explicitely overriding peer-group configuration.
+ * explicitly overriding peer-group configuration.
*/
for (ALL_LIST_ELEMENTS(peer->group->peer, node, nnode, member)) {
/* Skip peers with overridden configuration. */
@@ -7155,7 +7153,7 @@ int peer_advertise_map_unset(struct peer *peer, afi_t afi, safi_t safi,
/*
* Remove configuration on all peer-group members, unless they are
- * explicitely overriding peer-group configuration.
+ * explicitly overriding peer-group configuration.
*/
for (ALL_LIST_ELEMENTS(peer->group->peer, node, nnode, member)) {
/* Skip peers with overridden configuration. */
@@ -7189,8 +7187,8 @@ static bool peer_maximum_prefix_clear_overflow(struct peer *peer)
BGP_TIMER_OFF(peer->t_pmax_restart);
if (bgp_debug_neighbor_events(peer))
zlog_debug(
- "%s(%s) Maximum-prefix restart timer cancelled",
- peer->host, bgp_peer_hostname(peer));
+ "%pBP Maximum-prefix restart timer cancelled",
+ peer);
}
BGP_EVENT_ADD(peer, BGP_Start);
return true;
@@ -7233,7 +7231,7 @@ int peer_maximum_prefix_set(struct peer *peer, afi_t afi, safi_t safi,
/*
* Set flags and configuration on all peer-group members, unless they
- * are explicitely overriding peer-group configuration.
+ * are explicitly overriding peer-group configuration.
*/
for (ALL_LIST_ELEMENTS(peer->group->peer, node, nnode, member)) {
/* Skip peers with overridden configuration. */
@@ -7294,7 +7292,7 @@ int peer_maximum_prefix_unset(struct peer *peer, afi_t afi, safi_t safi)
/*
* Remove flags and configuration from all peer-group members, unless
- * they are explicitely overriding peer-group configuration.
+ * they are explicitly overriding peer-group configuration.
*/
if (CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) {
struct peer *member;
@@ -7356,7 +7354,7 @@ int peer_maximum_prefix_out_set(struct peer *peer, afi_t afi, safi_t safi,
/*
* Set flag and configuration on all peer-group members, unless they
- * are explicitely overriding peer-group configuration.
+ * are explicitly overriding peer-group configuration.
*/
for (ALL_LIST_ELEMENTS(peer->group->peer, node, nnode, member)) {
/* Skip peers with overridden configuration. */
@@ -7398,7 +7396,7 @@ int peer_maximum_prefix_out_unset(struct peer *peer, afi_t afi, safi_t safi)
/*
* Remove flag and configuration from all peer-group members, unless
- * they are explicitely overriding peer-group configuration.
+ * they are explicitly overriding peer-group configuration.
*/
for (ALL_LIST_ELEMENTS_RO(peer->group->peer, node, member)) {
/* Skip peers with overridden configuration. */
@@ -8138,3 +8136,16 @@ void bgp_gr_apply_running_config(void)
gr_router_detected = false;
}
}
+
+printfrr_ext_autoreg_p("BP", printfrr_bp);
+static ssize_t printfrr_bp(struct fbuf *buf, struct printfrr_eargs *ea,
+ const void *ptr)
+{
+ const struct peer *peer = ptr;
+
+ if (!peer)
+ return bputs(buf, "(null)");
+
+ return bprintfrr(buf, "%s(%s)", peer->host,
+ peer->hostname ? peer->hostname : "Unknown");
+}
diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h
index 766b0199f4..360bcc39c4 100644
--- a/bgpd/bgpd.h
+++ b/bgpd/bgpd.h
@@ -2473,11 +2473,6 @@ static inline bool bgp_in_graceful_shutdown(struct bgp *bgp)
!!CHECK_FLAG(bm->flags, BM_FLAG_GRACEFUL_SHUTDOWN));
}
-static inline const char *bgp_peer_hostname(struct peer *peer)
-{
- return peer->hostname ? peer->hostname : "Unknown";
-}
-
/* For benefit of rfapi */
extern struct peer *peer_new(struct bgp *bgp);
@@ -2508,4 +2503,11 @@ void peer_tcp_mss_unset(struct peer *peer);
extern void bgp_recalculate_afi_safi_bestpaths(struct bgp *bgp, afi_t afi,
safi_t safi);
+
+#ifdef _FRR_ATTRIBUTE_PRINTFRR
+/* clang-format off */
+#pragma FRR printfrr_ext "%pBP" (struct peer *)
+/* clang-format on */
+#endif
+
#endif /* _QUAGGA_BGPD_H */
diff --git a/bgpd/rfapi/rfapi.c b/bgpd/rfapi/rfapi.c
index 1c8497843e..c96c321d76 100644
--- a/bgpd/rfapi/rfapi.c
+++ b/bgpd/rfapi/rfapi.c
@@ -3980,7 +3980,7 @@ rfapi_rfp_get_group_config_name_l2(struct rfapi_cfg *rfc, const char *name,
* rfp_start_val value returned by rfp_start
* type group type
* name group name
- * criteria RFAPI caller provided serach criteria
+ * criteria RFAPI caller provided search criteria
* search_cb optional rfp_group_config_search_cb_t
*
* output:
@@ -4037,7 +4037,7 @@ void *rfapi_rfp_get_group_config_ptr_name(
* rfp_start_val value returned by rfp_start
* type group type
* logical_net_id group logical network identifier
- * criteria RFAPI caller provided serach criteria
+ * criteria RFAPI caller provided search criteria
* search_cb optional rfp_group_config_search_cb_t
*
* output:
diff --git a/configure.ac b/configure.ac
index 170d16ca6a..c636fade70 100644
--- a/configure.ac
+++ b/configure.ac
@@ -325,6 +325,9 @@ else
fi
fi
+dnl just stick -g into LDFLAGS, if we don't have it in CFLAGS it won't do much
+LDFLAGS="$LDFLAGS -g"
+
AM_CONDITIONAL([DEV_BUILD], [test "$enable_dev_build" = "yes"])
dnl always want these CFLAGS
diff --git a/doc/developer/building-docker.rst b/doc/developer/building-docker.rst
index 35b51cd9c0..4cf356049e 100644
--- a/doc/developer/building-docker.rst
+++ b/doc/developer/building-docker.rst
@@ -109,6 +109,27 @@ No script, multi-arch (ex. amd64, arm64)::
+Building ubi 8 Image
+-----------------------
+
+Script::
+
+ ./docker/ubi-8/build.sh
+
+Script with params, an example could be this (all that info will go to docker label) ::
+
+ ./docker/ubi-8/build.sh frr:ubi-8-my-test "$(git rev-parse --short=10 HEAD)" my_release my_name my_vendor
+
+No script::
+
+ docker build -f docker/ubi-8/Dockerfile .
+
+No script, multi-arch (ex. amd64, arm64)::
+
+ docker buildx build --platform linux/amd64,linux/arm64 -f docker/ubi-8/Dockerfile -t frr-ubi-8:latest .
+
+
+
Building Ubuntu 18.04 Image
---------------------------
diff --git a/doc/developer/draft-zebra-00.ms b/doc/developer/draft-zebra-00.ms
index 25994727a0..b5d6924613 100644
--- a/doc/developer/draft-zebra-00.ms
+++ b/doc/developer/draft-zebra-00.ms
@@ -179,13 +179,13 @@ Interface information message format.
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Index (1) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-| Inteface flag (4) |
+| Interface flag (4) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-| Inteface metric (4) |
+| Interface metric (4) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-| Inteface MTU (4) |
+| Interface MTU (4) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-| Inteface Address count (4) |
+| Interface Address count (4) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
.DE
.sp
diff --git a/doc/developer/logging.rst b/doc/developer/logging.rst
index 7046361204..16d555461d 100644
--- a/doc/developer/logging.rst
+++ b/doc/developer/logging.rst
@@ -171,7 +171,7 @@ Networking data types
:frrfmtout:`(*,1.2.3.4)`
- This is *(S,G)* output for use in pimd. (Note prefix_sg is not a prefix
+ This is *(S,G)* output for use in zebra. (Note prefix_sg is not a prefix
"subclass" like the other prefix_* structs.)
.. frrfmt:: %pSU (union sockunion *)
@@ -205,12 +205,6 @@ Networking data types
``%pNHci``: :frrfmtout:`eth0` — compact interface only
-.. frrfmt:: %pBD (struct bgp_dest *)
-
- :frrfmtout:`fe80::1234/64`
-
- (only available in bgpd.)
-
.. frrfmt:: %dPF (int)
:frrfmtout:`AF_INET`
@@ -361,6 +355,57 @@ FRR library helper formats
(The output is aligned to some degree.)
+FRR daemon specific formats
+^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+The following formats are only available in specific daemons, as the code
+implementing them is part of the daemon, not the library.
+
+zebra
+"""""
+
+.. frrfmt:: %pZN (struct route_node *)
+
+ Print information for a RIB node, including zebra-specific data.
+
+ :frrfmtout:`::/0 src fe80::/64 (MRIB)` (``%pZN``)
+
+ :frrfmtout:`1234` (``%pZNt`` - table number)
+
+bgpd
+""""
+
+.. frrfmt:: %pBD (struct bgp_dest *)
+
+ Print prefix for a BGP destination.
+
+ :frrfmtout:`fe80::1234/64`
+
+.. frrfmt:: %pBP (struct peer *)
+
+ :frrfmtout:`192.168.1.1(leaf1.frrouting.org)`
+
+ Print BGP peer's IP and hostname together.
+
+pimd/pim6d
+""""""""""
+
+.. frrfmt:: %pPA (pim_addr *)
+
+ Format IP address according to IP version (pimd vs. pim6d) being compiled.
+
+ :frrfmtout:`fe80::1234` / :frrfmtout:`10.0.0.1`
+
+ :frrfmtout:`*` (``%pPAs`` - replace 0.0.0.0/:: with star)
+
+.. frrfmt:: %pSG (pim_sgaddr *)
+
+ Format S,G pair according to IP version (pimd vs. pim6d) being compiled.
+ Braces are included.
+
+ :frrfmtout:`(*,224.0.0.0)`
+
+
General utility formats
^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/doc/user/bgp.rst b/doc/user/bgp.rst
index b9733cd522..e7adad91b7 100644
--- a/doc/user/bgp.rst
+++ b/doc/user/bgp.rst
@@ -2947,16 +2947,18 @@ This group of server links is referred to as an Ethernet Segment.
Ethernet Segments
"""""""""""""""""
An Ethernet Segment can be configured by specifying a system-MAC and a
-local discriminator against the bond interface on the PE (via zebra) -
+local discriminator or a complete ESINAME against the bond interface on the
+PE (via zebra) -
-.. clicmd:: evpn mh es-id (1-16777215)
+.. clicmd:: evpn mh es-id <(1-16777215)|ESINAME>
.. clicmd:: evpn mh es-sys-mac X:X:X:X:X:X
The sys-mac and local discriminator are used for generating a 10-byte,
-Type-3 Ethernet Segment ID.
+Type-3 Ethernet Segment ID. ESINAME is a 10-byte, Type-0 Ethernet Segment ID -
+"00:AA:BB:CC:DD:EE:FF:GG:HH:II".
-Type-1 (EAS-per-ES and EAD-per-EVI) routes are used to advertise the locally
+Type-1 (EAD-per-ES and EAD-per-EVI) routes are used to advertise the locally
attached ESs and to learn off remote ESs in the network. Local Type-2/MAC-IP
routes are also advertised with a destination ESI allowing for MAC-IP syncing
between Ethernet Segment peers.
@@ -3056,8 +3058,7 @@ route maybe fragmented.
The number of EVIs per-EAD route can be configured via the following
BGP command -
-.. index:: [no] ead-es-frag evi-limit(1-1000)
-.. clicmd:: [no] ead-es-frag evi-limit(1-1000)
+.. clicmd:: [no] ead-es-frag evi-limit (1-1000)
Sample Configuration
^^^^^^^^^^^^^^^^^^^^^
diff --git a/doc/user/zebra.rst b/doc/user/zebra.rst
index 0244f7c583..cd220a4141 100644
--- a/doc/user/zebra.rst
+++ b/doc/user/zebra.rst
@@ -712,7 +712,7 @@ and this section also helps that case.
Create a new locator. If the name of an existing locator is specified,
move to specified locator's configuration node to change the settings it.
-.. clicmd:: prefix X:X::X:X/M [function-bits-length 32]
+.. clicmd:: prefix X:X::X:X/M [func-bits 32]
Set the ipv6 prefix block of the locator. SRv6 locator is defined by
RFC8986. The actual routing protocol specifies the locator and allocates a
@@ -732,7 +732,7 @@ and this section also helps that case.
will be ``2001:db8:1:1:1::``)
The function bits range is 16bits by default. If operator want to change
- function bits range, they can configure with ``function-bits-length``
+ function bits range, they can configure with ``func-bits``
option.
::
diff --git a/docker/centos-8/Dockerfile b/docker/centos-8/Dockerfile
index 71378c2451..df095edcde 100644
--- a/docker/centos-8/Dockerfile
+++ b/docker/centos-8/Dockerfile
@@ -1,7 +1,11 @@
# This stage builds an rpm from the source
FROM centos:centos8 as centos-8-builder
+RUN sed -i -e "s|mirrorlist=|#mirrorlist=|g" /etc/yum.repos.d/CentOS-*
+RUN sed -i -e "s|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g" /etc/yum.repos.d/CentOS-*
+
RUN dnf install --enablerepo=powertools -y rpm-build git autoconf pcre-devel \
+ systemd-devel \
automake libtool make readline-devel texinfo net-snmp-devel pkgconfig \
groff pkgconfig json-c-devel pam-devel bison flex python3-pytest \
c-ares-devel python3-devel python3-sphinx libcap-devel platform-python-devel \
@@ -32,6 +36,10 @@ RUN echo '%_smp_mflags %( echo "-j$(/usr/bin/getconf _NPROCESSORS_ONLN)"; )' >>
# This stage installs frr from the rpm
FROM centos:centos8
+
+RUN sed -i -e "s|mirrorlist=|#mirrorlist=|g" /etc/yum.repos.d/CentOS-* \
+ && sed -i -e "s|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g" /etc/yum.repos.d/CentOS-*
+
RUN mkdir -p /pkgs/rpm \
&& yum install -y https://ci1.netdef.org/artifact/LIBYANG-LIBYANGV2/shared/build-2/CentOS-8-x86_64-Packages/libyang2-2.0.0.10.g2eb910e4-1.el8.x86_64.rpm \
https://ci1.netdef.org/artifact/RPKI-RTRLIB/shared/build-110/CentOS-7-x86_64-Packages/librtr-0.7.0-1.el7.centos.x86_64.rpm
diff --git a/docker/ubi-8/Dockerfile b/docker/ubi-8/Dockerfile
new file mode 100644
index 0000000000..7b2db66ede
--- /dev/null
+++ b/docker/ubi-8/Dockerfile
@@ -0,0 +1,83 @@
+# This stage builds an rpm from the source
+FROM registry.access.redhat.com/ubi8/ubi:8.5 as ubi-8-builder
+
+RUN dnf -y update-minimal --security --sec-severity=Important --sec-severity=Critical
+
+RUN rpm --import https://www.centos.org/keys/RPM-GPG-KEY-CentOS-Official \
+ && dnf config-manager --disableplugin subscription-manager --add-repo http://mirror.centos.org/centos/8-stream/BaseOS/x86_64/os \
+ && dnf config-manager --disableplugin subscription-manager --add-repo http://mirror.centos.org/centos/8-stream/AppStream/x86_64/os \
+ && dnf config-manager --disableplugin subscription-manager --add-repo http://mirror.centos.org/centos/8-stream/PowerTools/x86_64/os
+
+RUN dnf install -qy https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm \
+ && dnf install --enablerepo=* -qy rpm-build git autoconf pcre-devel \
+ systemd-devel automake libtool make readline-devel texinfo \
+ net-snmp-devel pkgconfig groff pkgconfig json-c-devel pam-devel \
+ bison flex python3-pytest c-ares-devel python3-devel python3-sphinx \
+ libcap-devel platform-python-devel \
+ https://ci1.netdef.org/artifact/LIBYANG-LIBYANGV2/shared/build-2/CentOS-8-x86_64-Packages/libyang2-2.0.0.10.g2eb910e4-1.el8.x86_64.rpm \
+ https://ci1.netdef.org/artifact/LIBYANG-LIBYANGV2/shared/build-2/CentOS-8-x86_64-Packages/libyang2-devel-2.0.0.10.g2eb910e4-1.el8.x86_64.rpm \
+ https://ci1.netdef.org/artifact/RPKI-RTRLIB/shared/build-110/CentOS-7-x86_64-Packages/librtr-0.7.0-1.el7.centos.x86_64.rpm \
+ https://ci1.netdef.org/artifact/RPKI-RTRLIB/shared/build-110/CentOS-7-x86_64-Packages/librtr-devel-0.7.0-1.el7.centos.x86_64.rpm
+
+
+COPY . /src
+
+ARG PKGVER
+
+RUN echo '%_smp_mflags %( echo "-j$(/usr/bin/getconf _NPROCESSORS_ONLN)"; )' >> /root/.rpmmacros \
+ && cd /src \
+ && ./bootstrap.sh \
+ && ./configure \
+ --enable-rpki \
+ --enable-snmp=agentx \
+ --enable-numeric-version \
+ --with-pkg-extra-version="_palmetto_git$PKGVER" \
+ && make dist \
+ && cd / \
+ && mkdir -p /rpmbuild/{SOURCES,SPECS} \
+ && cp /src/frr*.tar.gz /rpmbuild/SOURCES \
+ && cp /src/redhat/frr.spec /rpmbuild/SPECS \
+ && rpmbuild \
+ --define "_topdir /rpmbuild" \
+ -ba /rpmbuild/SPECS/frr.spec
+
+# This stage installs frr from the rpm
+FROM registry.access.redhat.com/ubi8/ubi:8.5
+RUN dnf -y update-minimal --security --sec-severity=Important --sec-severity=Critical
+ARG FRR_IMAGE_TAG
+ARG FRR_RELEASE
+ARG FRR_NAME
+ARG FRR_VENDOR
+LABEL name=$FRR_NAME \
+ vendor=$FRR_VENDOR \
+ version=$FRR_IMAGE_TAG \
+ release=$FRR_RELEASE
+
+RUN rpm --import https://www.centos.org/keys/RPM-GPG-KEY-CentOS-Official \
+ && dnf config-manager --disableplugin subscription-manager --add-repo http://mirror.centos.org/centos/8-stream/BaseOS/x86_64/os \
+ && dnf config-manager --disableplugin subscription-manager --add-repo http://mirror.centos.org/centos/8-stream/AppStream/x86_64/os
+
+RUN dnf install -qy https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm \
+ && mkdir -p /pkgs/rpm \
+ && dnf install --enablerepo=* -qy https://ci1.netdef.org/artifact/LIBYANG-LIBYANGV2/shared/build-2/CentOS-8-x86_64-Packages/libyang2-2.0.0.10.g2eb910e4-1.el8.x86_64.rpm \
+ https://ci1.netdef.org/artifact/RPKI-RTRLIB/shared/build-110/CentOS-7-x86_64-Packages/librtr-0.7.0-1.el7.centos.x86_64.rpm
+
+COPY --from=ubi-8-builder /rpmbuild/RPMS/ /pkgs/rpm/
+
+RUN dnf install -qy /pkgs/rpm/*/*.rpm \
+ && rm -rf /pkgs \
+# Own the config / PID files
+ && mkdir -p /var/run/frr \
+ && chown -R frr:frr /etc/frr /var/run/frr
+
+# Add tini because no CentOS8 package
+ENV TINI_VERSION v0.19.0
+ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /sbin/tini
+RUN chmod +x /sbin/tini
+
+# Simple init manager for reaping processes and forwarding signals
+ENTRYPOINT ["/sbin/tini", "--"]
+
+# Default CMD starts watchfrr
+COPY docker/ubi-8/docker-start /usr/lib/frr/docker-start
+CMD ["/usr/lib/frr/docker-start"]
diff --git a/docker/ubi-8/build.sh b/docker/ubi-8/build.sh
new file mode 100755
index 0000000000..0216636893
--- /dev/null
+++ b/docker/ubi-8/build.sh
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+set -e
+
+##
+# Package version needs to be decimal
+##
+DISTRO=ubi-8
+
+GITREV="$2"
+if [ -z "$GITREV" ];then
+ GITREV="$(git rev-parse --short=10 HEAD)"
+fi
+
+FRR_IMAGE_TAG="$1"
+if [ -z $FRR_IMAGE_TAG ];then
+ FRR_IMAGE_TAG="frr:ubi-8-$GITREV"
+fi
+PKGVER="$(printf '%u\n' 0x$GITREV)"
+
+FRR_RELEASE="$3"
+if [ -z $FRR_RELEASE ];then
+ FRR_RELEASE=$(git describe --tags --abbrev=0)
+fi
+
+FRR_NAME=$4
+if [ -z $FRR_NAME ];then
+ FRR_NAME=frr
+fi
+
+FRR_VENDOR=$5
+if [ -z $FRR_VENDOR ];then
+ FRR_VENDOR=frr
+fi
+
+docker build \
+ --cache-from="frr:$DISTRO-builder-$GITREV" \
+ --file=docker/$DISTRO/Dockerfile \
+ --build-arg="PKGVER=$PKGVER" \
+ --build-arg="FRR_IMAGE_TAG=$FRR_IMAGE_TAG" \
+ --build-arg="FRR_RELEASE=$FRR_RELEASE" \
+ --build-arg="FRR_NAME=$FRR_NAME" \
+ --build-arg="FRR_VENDOR=$FRR_VENDOR" \
+ --tag="$FRR_IMAGE_TAG" \
+ .
+
diff --git a/docker/ubi-8/docker-start b/docker/ubi-8/docker-start
new file mode 100755
index 0000000000..d954142ab9
--- /dev/null
+++ b/docker/ubi-8/docker-start
@@ -0,0 +1,4 @@
+#!/bin/bash
+
+source /usr/lib/frr/frrcommon.sh
+/usr/lib/frr/watchfrr $(daemon_list)
diff --git a/eigrpd/eigrp_routemap.c b/eigrpd/eigrp_routemap.c
index d9b500a8fd..218cea7fa3 100644
--- a/eigrpd/eigrp_routemap.c
+++ b/eigrpd/eigrp_routemap.c
@@ -690,7 +690,7 @@ static const struct route_map_rule_cmd route_set_metric_cmd = {
/* `set ip next-hop IP_ADDRESS' */
-/* Set nexthop to object. ojbect must be pointer to struct attr. */
+/* Set nexthop to object. object must be pointer to struct attr. */
static enum route_map_cmd_result_t
route_set_ip_nexthop(void *rule, struct prefix *prefix,
route_map_object_t type, void *object)
@@ -748,7 +748,7 @@ static const struct route_map_rule_cmd route_set_ip_nexthop_cmd = {
/* `set tag TAG' */
-/* Set tag to object. ojbect must be pointer to struct attr. */
+/* Set tag to object. object must be pointer to struct attr. */
static enum route_map_cmd_result_t
route_set_tag(void *rule, struct prefix *prefix,
route_map_object_t type, void *object)
diff --git a/isisd/isis_bfd.c b/isisd/isis_bfd.c
index 1f50fb9342..5311a384e7 100644
--- a/isisd/isis_bfd.c
+++ b/isisd/isis_bfd.c
@@ -168,6 +168,8 @@ void isis_bfd_circuit_cmd(struct isis_circuit *circuit)
struct listnode *node;
struct isis_adjacency *adj;
+ if (!adjdb)
+ continue;
for (ALL_LIST_ELEMENTS_RO(adjdb, node, adj))
bfd_adj_cmd(adj);
}
diff --git a/isisd/isis_nb_config.c b/isisd/isis_nb_config.c
index 019c26687b..de7797813a 100644
--- a/isisd/isis_nb_config.c
+++ b/isisd/isis_nb_config.c
@@ -1868,7 +1868,7 @@ int isis_instance_mpls_te_destroy(struct nb_cb_destroy_args *args)
return NB_OK;
/* Remove Link State Database */
- ls_ted_del_all(area->mta->ted);
+ ls_ted_del_all(&area->mta->ted);
/* Flush LSP if circuit engage */
for (ALL_LIST_ELEMENTS_RO(area->circuit_list, node, circuit)) {
diff --git a/isisd/isis_te.c b/isisd/isis_te.c
index 95fbca17a8..1a1e0dc294 100644
--- a/isisd/isis_te.c
+++ b/isisd/isis_te.c
@@ -65,7 +65,7 @@
#include "isisd/isis_zebra.h"
/*------------------------------------------------------------------------*
- * Followings are control functions for MPLS-TE parameters management.
+ * Following are control functions for MPLS-TE parameters management.
*------------------------------------------------------------------------*/
/* Main initialization / update function of the MPLS TE Circuit context */
@@ -1231,7 +1231,7 @@ void isis_te_init_ted(struct isis_area *area)
isis_te_parse_lsp(area->mta, lsp);
}
-/* Followings are vty command functions */
+/* Following are vty command functions */
#ifndef FABRICD
static void show_router_id(struct vty *vty, struct isis_area *area)
diff --git a/isisd/isisd.c b/isisd/isisd.c
index 369b83396a..47fe62d27c 100644
--- a/isisd/isisd.c
+++ b/isisd/isisd.c
@@ -1628,7 +1628,7 @@ void print_debug(struct vty *vty, int flags, int onoff)
vty_out(vty, "IS-IS Update related packet debugging is %s\n",
onoffs);
if (flags & DEBUG_RTE_EVENTS)
- vty_out(vty, "IS-IS Route related debuggin is %s\n", onoffs);
+ vty_out(vty, "IS-IS Route related debugging is %s\n", onoffs);
if (flags & DEBUG_EVENTS)
vty_out(vty, "IS-IS Event debugging is %s\n", onoffs);
if (flags & DEBUG_PACKET_DUMP)
diff --git a/lib/frrscript.c b/lib/frrscript.c
index 4fee79991a..8add44c19e 100644
--- a/lib/frrscript.c
+++ b/lib/frrscript.c
@@ -373,7 +373,7 @@ int frrscript_load(struct frrscript *fs, const char *function_name,
}
if (luaL_dofile(L, script_name) != 0) {
- zlog_err("frrscript: failed loading script '%s.lua': error: %s",
+ zlog_err("frrscript: failed loading script '%s': error: %s",
script_name, lua_tostring(L, -1));
goto fail;
}
@@ -381,7 +381,7 @@ int frrscript_load(struct frrscript *fs, const char *function_name,
/* To check the Lua function, we get it from the global table */
lua_getglobal(L, function_name);
if (lua_isfunction(L, lua_gettop(L)) == 0) {
- zlog_err("frrscript: loaded script '%s.lua' but %s not found",
+ zlog_err("frrscript: loaded script '%s' but %s not found",
script_name, function_name);
goto fail;
}
@@ -391,7 +391,7 @@ int frrscript_load(struct frrscript *fs, const char *function_name,
if (load_cb && (*load_cb)(fs) != 0) {
zlog_err(
- "frrscript: '%s.lua': %s: loaded but callback returned non-zero exit code",
+ "frrscript: '%s': %s: loaded but callback returned non-zero exit code",
script_name, function_name);
goto fail;
}
diff --git a/lib/link_state.c b/lib/link_state.c
index e4ccd0fb65..639a1d37d8 100644
--- a/lib/link_state.c
+++ b/lib/link_state.c
@@ -997,25 +997,26 @@ void ls_ted_del(struct ls_ted *ted)
XFREE(MTYPE_LS_DB, ted);
}
-void ls_ted_del_all(struct ls_ted *ted)
+void ls_ted_del_all(struct ls_ted **ted)
{
struct ls_vertex *vertex;
struct ls_edge *edge;
struct ls_subnet *subnet;
- if (ted == NULL)
+ if (*ted == NULL)
return;
/* First remove Vertices, Edges and Subnets and associated Link State */
- frr_each_safe (vertices, &ted->vertices, vertex)
- ls_vertex_del_all(ted, vertex);
- frr_each_safe (edges, &ted->edges, edge)
- ls_edge_del_all(ted, edge);
- frr_each_safe (subnets, &ted->subnets, subnet)
- ls_subnet_del_all(ted, subnet);
+ frr_each_safe (vertices, &(*ted)->vertices, vertex)
+ ls_vertex_del_all(*ted, vertex);
+ frr_each_safe (edges, &(*ted)->edges, edge)
+ ls_edge_del_all(*ted, edge);
+ frr_each_safe (subnets, &(*ted)->subnets, subnet)
+ ls_subnet_del_all(*ted, subnet);
/* then remove TED itself */
- ls_ted_del(ted);
+ ls_ted_del(*ted);
+ *ted = NULL;
}
void ls_ted_clean(struct ls_ted *ted)
diff --git a/lib/link_state.h b/lib/link_state.h
index 761e8b6a27..f46a2068a1 100644
--- a/lib/link_state.h
+++ b/lib/link_state.h
@@ -746,7 +746,7 @@ extern void ls_ted_del(struct ls_ted *ted);
*
* @param ted Link State Data Base
*/
-extern void ls_ted_del_all(struct ls_ted *ted);
+extern void ls_ted_del_all(struct ls_ted **ted);
/**
* Clean Link State Data Base by removing all Vertices, Edges and SubNets marked
diff --git a/lib/routemap.h b/lib/routemap.h
index 6c4916898a..3ef60222bf 100644
--- a/lib/routemap.h
+++ b/lib/routemap.h
@@ -276,6 +276,7 @@ DECLARE_QOBJ_TYPE(route_map);
#define IS_MATCH_LOCAL_PREF(C) \
(strmatch(C, "frr-bgp-route-map:match-local-preference"))
#define IS_MATCH_ALIAS(C) (strmatch(C, "frr-bgp-route-map:match-alias"))
+#define IS_MATCH_SCRIPT(C) (strmatch(C, "frr-bgp-route-map:match-script"))
#define IS_MATCH_ORIGIN(C) \
(strmatch(C, "frr-bgp-route-map:match-origin"))
#define IS_MATCH_RPKI(C) (strmatch(C, "frr-bgp-route-map:rpki"))
diff --git a/lib/routemap_cli.c b/lib/routemap_cli.c
index 2685bd2d79..5597064d20 100644
--- a/lib/routemap_cli.c
+++ b/lib/routemap_cli.c
@@ -635,6 +635,11 @@ void route_map_condition_show(struct vty *vty, const struct lyd_node *dnode,
yang_dnode_get_string(
dnode,
"./rmap-match-condition/frr-bgp-route-map:alias"));
+ } else if (IS_MATCH_SCRIPT(condition)) {
+ vty_out(vty, " match script %s\n",
+ yang_dnode_get_string(
+ dnode,
+ "./rmap-match-condition/frr-bgp-route-map:script"));
} else if (IS_MATCH_ORIGIN(condition)) {
vty_out(vty, " match origin %s\n",
yang_dnode_get_string(
diff --git a/lib/thread.c b/lib/thread.c
index 90074b3d89..44183257bb 100644
--- a/lib/thread.c
+++ b/lib/thread.c
@@ -751,7 +751,7 @@ void thread_master_free(struct thread_master *m)
XFREE(MTYPE_THREAD_MASTER, m);
}
-/* Return remain time in miliseconds. */
+/* Return remain time in milliseconds. */
unsigned long thread_timer_remain_msec(struct thread *thread)
{
int64_t remain;
diff --git a/lib/zlog.h b/lib/zlog.h
index a530c589a8..dcc0bf14e9 100644
--- a/lib/zlog.h
+++ b/lib/zlog.h
@@ -68,7 +68,7 @@ struct xrefdata_logmsg {
* initialization and/or before config load. There is no need to call e.g.
* fprintf(stderr, ...) just because it's "too early" at startup. Depending
* on context, it may still be the right thing to use fprintf though -- try to
- * determine wether something is a log message or something else.
+ * determine whether something is a log message or something else.
*/
extern void vzlogx(const struct xref_logmsg *xref, int prio,
diff --git a/m4/.gitignore b/m4/.gitignore
index 01a2a593d0..63f9fa78ed 100644
--- a/m4/.gitignore
+++ b/m4/.gitignore
@@ -3,6 +3,7 @@
!ax_compare_version.m4
!ax_cxx_compile_stdcxx.m4
+!ax_lua.m4
!ax_prog_perl_modules.m4
!ax_pthread.m4
!ax_python.m4
diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c
index 40afd716c7..63444f8e57 100644
--- a/ospf6d/ospf6_asbr.c
+++ b/ospf6d/ospf6_asbr.c
@@ -1440,6 +1440,7 @@ void ospf6_asbr_redistribute_add(int type, ifindex_t ifindex,
/* apply route-map */
if (ROUTEMAP(red)) {
troute.route_option = &tinfo;
+ troute.ospf6 = ospf6;
tinfo.ifindex = ifindex;
tinfo.tag = tag;
diff --git a/ospf6d/ospf6_top.h b/ospf6d/ospf6_top.h
index f06a3254ac..9dddd465fe 100644
--- a/ospf6d/ospf6_top.h
+++ b/ospf6d/ospf6_top.h
@@ -70,7 +70,7 @@ struct ospf6_gr_info {
};
struct ospf6_gr_helper {
- /* Gracefull restart Helper supported configs*/
+ /* Graceful restart Helper supported configs*/
/* Supported grace interval*/
uint32_t supported_grace_time;
diff --git a/ospfclient/ospf_apiclient.c b/ospfclient/ospf_apiclient.c
index 29f1c0807d..1908604bd9 100644
--- a/ospfclient/ospf_apiclient.c
+++ b/ospfclient/ospf_apiclient.c
@@ -91,7 +91,7 @@ static unsigned short ospf_apiclient_getport(void)
}
/* -----------------------------------------------------------
- * Followings are functions for connection management
+ * Following are functions for connection management
* -----------------------------------------------------------
*/
@@ -300,7 +300,7 @@ int ospf_apiclient_close(struct ospf_apiclient *oclient)
}
/* -----------------------------------------------------------
- * Followings are functions to send a request to OSPFd
+ * Following are functions to send a request to OSPFd
* -----------------------------------------------------------
*/
@@ -498,7 +498,7 @@ int ospf_apiclient_lsa_delete(struct ospf_apiclient *oclient,
}
/* -----------------------------------------------------------
- * Followings are handlers for messages from OSPF daemon
+ * Following are handlers for messages from OSPF daemon
* -----------------------------------------------------------
*/
diff --git a/ospfd/ospf_apiserver.c b/ospfd/ospf_apiserver.c
index a624f4ce1e..97bd125aee 100644
--- a/ospfd/ospf_apiserver.c
+++ b/ospfd/ospf_apiserver.c
@@ -221,7 +221,7 @@ static struct ospf_apiserver *lookup_apiserver_by_lsa(struct ospf_lsa *lsa)
}
/* -----------------------------------------------------------
- * Followings are functions to manage client connections.
+ * Following are functions to manage client connections.
* -----------------------------------------------------------
*/
static int ospf_apiserver_new_lsa_hook(struct ospf_lsa *lsa)
@@ -1174,7 +1174,7 @@ int ospf_apiserver_handle_register_event(struct ospf_apiserver *apiserv,
/* -----------------------------------------------------------
- * Followings are functions for LSDB synchronization.
+ * Following are functions for LSDB synchronization.
* -----------------------------------------------------------
*/
@@ -1345,7 +1345,7 @@ int ospf_apiserver_handle_sync_lsdb(struct ospf_apiserver *apiserv,
/* -----------------------------------------------------------
- * Followings are functions to originate or update LSA
+ * Following are functions to originate or update LSA
* from an application.
* -----------------------------------------------------------
*/
@@ -1787,7 +1787,7 @@ out:
/* -----------------------------------------------------------
- * Followings are functions to delete LSAs
+ * Following are functions to delete LSAs
* -----------------------------------------------------------
*/
@@ -1952,7 +1952,7 @@ void ospf_apiserver_flush_opaque_lsa(struct ospf_apiserver *apiserv,
/* -----------------------------------------------------------
- * Followings are callback functions to handle opaque types
+ * Following are callback functions to handle opaque types
* -----------------------------------------------------------
*/
@@ -2102,7 +2102,7 @@ void ospf_apiserver_show_info(struct vty *vty, struct json_object *json,
}
/* -----------------------------------------------------------
- * Followings are functions to notify clients about events
+ * Following are functions to notify clients about events
* -----------------------------------------------------------
*/
@@ -2417,7 +2417,7 @@ static void apiserver_clients_lsa_change_notify(uint8_t msgtype,
/* -------------------------------------------------------------
- * Followings are hooks invoked when LSAs are updated or deleted
+ * Following are hooks invoked when LSAs are updated or deleted
* -------------------------------------------------------------
*/
diff --git a/ospfd/ospf_apiserver.h b/ospfd/ospf_apiserver.h
index 3d57737080..b4d8bb2f52 100644
--- a/ospfd/ospf_apiserver.h
+++ b/ospfd/ospf_apiserver.h
@@ -79,7 +79,7 @@ enum ospf_apiserver_event {
};
/* -----------------------------------------------------------
- * Followings are functions to manage client connections.
+ * Following are functions to manage client connections.
* -----------------------------------------------------------
*/
@@ -99,7 +99,7 @@ extern int ospf_apiserver_send_reply(struct ospf_apiserver *apiserv,
uint32_t seqnr, uint8_t rc);
/* -----------------------------------------------------------
- * Followings are message handler functions
+ * Following are message handler functions
* -----------------------------------------------------------
*/
@@ -147,7 +147,7 @@ extern int ospf_apiserver_handle_sync_lsdb(struct ospf_apiserver *apiserv,
/* -----------------------------------------------------------
- * Followings are functions for LSA origination/deletion
+ * Following are functions for LSA origination/deletion
* -----------------------------------------------------------
*/
@@ -169,7 +169,7 @@ extern void ospf_apiserver_flood_opaque_lsa(struct ospf_lsa *lsa);
/* -----------------------------------------------------------
- * Followings are callback functions to handle opaque types
+ * Following are callback functions to handle opaque types
* -----------------------------------------------------------
*/
@@ -191,7 +191,7 @@ extern void ospf_apiserver_flush_opaque_lsa(struct ospf_apiserver *apiserv,
uint8_t opaque_type);
/* -----------------------------------------------------------
- * Followings are hooks when LSAs are updated or deleted
+ * Following are hooks when LSAs are updated or deleted
* -----------------------------------------------------------
*/
diff --git a/ospfd/ospf_ext.c b/ospfd/ospf_ext.c
index 0e5a7e29c0..69847088e4 100644
--- a/ospfd/ospf_ext.c
+++ b/ospfd/ospf_ext.c
@@ -74,7 +74,7 @@ static struct ospf_ext_lp OspfEXT;
/*
* -----------------------------------------------------------------------
- * Followings are initialize/terminate functions for Extended Prefix/Link
+ * Following are initialize/terminate functions for Extended Prefix/Link
* Opaque LSA handling.
* -----------------------------------------------------------------------
*/
@@ -216,7 +216,7 @@ void ospf_ext_finish(void)
/*
* ---------------------------------------------------------------------
- * Followings are control functions for Extended Prefix/Link Opaque LSA
+ * Following are control functions for Extended Prefix/Link Opaque LSA
* parameters management.
* ---------------------------------------------------------------------
*/
@@ -681,7 +681,7 @@ void ospf_ext_update_sr(bool enable)
/*
* -----------------------------------------------------------------------
- * Followings are callback functions against generic Opaque-LSAs handling
+ * Following are callback functions against generic Opaque-LSAs handling
* -----------------------------------------------------------------------
*/
@@ -985,7 +985,7 @@ static int ospf_ext_pref_lsa_update(struct ospf_lsa *lsa)
/*
* -------------------------------------------------------
- * Followings are OSPF protocol processing functions for
+ * Following are OSPF protocol processing functions for
* Extended Prefix/Link Opaque LSA
* -------------------------------------------------------
*/
@@ -1713,7 +1713,7 @@ static void ospf_ext_lsa_schedule(struct ext_itf *exti, enum lsa_opcode op)
/*
* ------------------------------------
- * Followings are vty show functions.
+ * Following are vty show functions.
* ------------------------------------
*/
diff --git a/ospfd/ospf_opaque.c b/ospfd/ospf_opaque.c
index b781c9edc1..947454c0df 100644
--- a/ospfd/ospf_opaque.c
+++ b/ospfd/ospf_opaque.c
@@ -61,7 +61,7 @@ DEFINE_MTYPE_STATIC(OSPFD, OPAQUE_INFO_PER_TYPE, "OSPF opaque per-type info");
DEFINE_MTYPE_STATIC(OSPFD, OPAQUE_INFO_PER_ID, "OSPF opaque per-ID info");
/*------------------------------------------------------------------------*
- * Followings are initialize/terminate functions for Opaque-LSAs handling.
+ * Following are initialize/terminate functions for Opaque-LSAs handling.
*------------------------------------------------------------------------*/
#ifdef SUPPORT_OSPF_API
@@ -258,7 +258,7 @@ static const char *ospf_opaque_type_name(uint8_t opaque_type)
}
/*------------------------------------------------------------------------*
- * Followings are management functions to store user specified callbacks.
+ * Following are management functions to store user specified callbacks.
*------------------------------------------------------------------------*/
struct opaque_info_per_type; /* Forward declaration. */
@@ -467,7 +467,7 @@ ospf_opaque_functab_lookup(struct ospf_lsa *lsa)
}
/*------------------------------------------------------------------------*
- * Followings are management functions for self-originated LSA entries.
+ * Following are management functions for self-originated LSA entries.
*------------------------------------------------------------------------*/
/*
@@ -759,7 +759,7 @@ out:
}
/*------------------------------------------------------------------------*
- * Followings are (vty) configuration functions for Opaque-LSAs handling.
+ * Following are (vty) configuration functions for Opaque-LSAs handling.
*------------------------------------------------------------------------*/
DEFUN (capability_opaque,
@@ -830,7 +830,7 @@ static void ospf_opaque_register_vty(void)
}
/*------------------------------------------------------------------------*
- * Followings are collection of user-registered function callers.
+ * Following are collection of user-registered function callers.
*------------------------------------------------------------------------*/
static int opaque_lsa_new_if_callback(struct list *funclist,
@@ -978,7 +978,7 @@ out:
}
/*------------------------------------------------------------------------*
- * Followings are glue functions to call Opaque-LSA specific processing.
+ * Following are glue functions to call Opaque-LSA specific processing.
*------------------------------------------------------------------------*/
int ospf_opaque_new_if(struct interface *ifp)
@@ -1283,7 +1283,7 @@ out:
}
/*------------------------------------------------------------------------*
- * Followings are Opaque-LSA origination/refresh management functions.
+ * Following are Opaque-LSA origination/refresh management functions.
*------------------------------------------------------------------------*/
static void ospf_opaque_type9_lsa_originate(struct thread *t);
@@ -1647,7 +1647,7 @@ struct ospf_lsa *ospf_opaque_lsa_refresh(struct ospf_lsa *lsa)
}
/*------------------------------------------------------------------------*
- * Followings are re-origination/refresh/flush operations of Opaque-LSAs,
+ * Following are re-origination/refresh/flush operations of Opaque-LSAs,
* triggered by external interventions (vty session, signaling, etc).
*------------------------------------------------------------------------*/
@@ -2162,7 +2162,7 @@ void ospf_opaque_self_originated_lsa_received(struct ospf_neighbor *nbr,
}
/*------------------------------------------------------------------------*
- * Followings are util functions; probably be used by Opaque-LSAs only...
+ * Following are util functions; probably be used by Opaque-LSAs only...
*------------------------------------------------------------------------*/
struct ospf *oi_to_top(struct ospf_interface *oi)
diff --git a/ospfd/ospf_opaque.h b/ospfd/ospf_opaque.h
index b26bc1e10c..59d4288bf2 100644
--- a/ospfd/ospf_opaque.h
+++ b/ospfd/ospf_opaque.h
@@ -64,7 +64,7 @@
#define OPAQUE_TYPE_EXTENDED_LINK_LSA 8
#define OPAQUE_TYPE_MAX 8
-/* Followings types are proposed in internet-draft documents. */
+/* Following types are proposed in internet-draft documents. */
#define OPAQUE_TYPE_8021_QOSPF 129
#define OPAQUE_TYPE_SECONDARY_NEIGHBOR_DISCOVERY 224
#define OPAQUE_TYPE_FLOODGATE 225
diff --git a/ospfd/ospf_ri.c b/ospfd/ospf_ri.c
index 0efa6ca4d5..3efdb53102 100644
--- a/ospfd/ospf_ri.c
+++ b/ospfd/ospf_ri.c
@@ -66,7 +66,7 @@
static struct ospf_router_info OspfRI;
/*------------------------------------------------------------------------------*
- * Followings are initialize/terminate functions for Router Information
+ * Following are initialize/terminate functions for Router Information
*handling.
*------------------------------------------------------------------------------*/
@@ -232,7 +232,7 @@ static struct ospf_ri_area_info *lookup_by_area(struct ospf_area *area)
}
/*------------------------------------------------------------------------*
- * Followings are control functions for ROUTER INFORMATION parameters
+ * Following are control functions for ROUTER INFORMATION parameters
*management.
*------------------------------------------------------------------------*/
@@ -668,7 +668,7 @@ void ospf_router_info_update_sr(bool enable, struct sr_node *srn)
}
/*------------------------------------------------------------------------*
- * Followings are callback functions against generic Opaque-LSAs handling.
+ * Following are callback functions against generic Opaque-LSAs handling.
*------------------------------------------------------------------------*/
static void ospf_router_info_ism_change(struct ospf_interface *oi,
int old_state)
@@ -693,7 +693,7 @@ static void ospf_router_info_ism_change(struct ospf_interface *oi,
}
/*------------------------------------------------------------------------*
- * Followings are OSPF protocol processing functions for ROUTER INFORMATION
+ * Following are OSPF protocol processing functions for ROUTER INFORMATION
*------------------------------------------------------------------------*/
static void build_tlv_header(struct stream *s, struct tlv_header *tlvh)
@@ -1223,7 +1223,7 @@ static int ospf_router_info_lsa_update(struct ospf_lsa *lsa)
}
/*------------------------------------------------------------------------*
- * Followings are vty session control functions.
+ * Following are vty session control functions.
*------------------------------------------------------------------------*/
#define check_tlv_size(size, msg) \
@@ -1660,7 +1660,7 @@ static void ospf_router_info_config_write_router(struct vty *vty)
}
/*------------------------------------------------------------------------*
- * Followings are vty command functions.
+ * Following are vty command functions.
*------------------------------------------------------------------------*/
/* Simple wrapper schedule RI LSA action in function of the scope */
static void ospf_router_info_schedule(enum lsa_opcode opcode)
diff --git a/ospfd/ospf_sr.c b/ospfd/ospf_sr.c
index b5dbc4a5a9..c861685f4e 100644
--- a/ospfd/ospf_sr.c
+++ b/ospfd/ospf_sr.c
@@ -2023,7 +2023,7 @@ void ospf_sr_update_task(struct ospf *ospf)
/*
* --------------------------------------
- * Followings are vty command functions.
+ * Following are vty command functions.
* --------------------------------------
*/
diff --git a/ospfd/ospf_te.c b/ospfd/ospf_te.c
index 999bc49d91..ddc62982bd 100644
--- a/ospfd/ospf_te.c
+++ b/ospfd/ospf_te.c
@@ -79,7 +79,7 @@ static const char *const mode2text[] = {"Off", "AS", "Area"};
/*------------------------------------------------------------------------*
- * Followings are initialize/terminate functions for MPLS-TE handling.
+ * Following are initialize/terminate functions for MPLS-TE handling.
*------------------------------------------------------------------------*/
static int ospf_mpls_te_new_if(struct interface *ifp);
@@ -197,7 +197,7 @@ void ospf_mpls_te_finish(void)
}
/*------------------------------------------------------------------------*
- * Followings are control functions for MPLS-TE parameters management.
+ * Following are control functions for MPLS-TE parameters management.
*------------------------------------------------------------------------*/
static void del_mpls_te_link(void *val)
{
@@ -814,7 +814,7 @@ static int is_mandated_params_set(struct mpls_te_link *lp)
}
/*------------------------------------------------------------------------*
- * Followings are callback functions against generic Opaque-LSAs handling.
+ * Following are callback functions against generic Opaque-LSAs handling.
*------------------------------------------------------------------------*/
static int ospf_mpls_te_new_if(struct interface *ifp)
@@ -1079,7 +1079,7 @@ static void ospf_mpls_te_nsm_change(struct ospf_neighbor *nbr, int old_state)
}
/*------------------------------------------------------------------------*
- * Followings are OSPF protocol processing functions for MPLS-TE LSA.
+ * Following are OSPF protocol processing functions for MPLS-TE LSA.
*------------------------------------------------------------------------*/
static void build_tlv_header(struct stream *s, struct tlv_header *tlvh)
@@ -1624,7 +1624,7 @@ void ospf_mpls_te_lsa_schedule(struct mpls_te_link *lp, enum lsa_opcode opcode)
/**
* ------------------------------------------------------
- * Followings are Link State Data Base control functions.
+ * Following are Link State Data Base control functions.
* ------------------------------------------------------
*/
@@ -3153,7 +3153,7 @@ static void ospf_te_init_ted(struct ls_ted *ted, struct ospf *ospf)
}
/*------------------------------------------------------------------------*
- * Followings are vty session control functions.
+ * Following are vty session control functions.
*------------------------------------------------------------------------*/
#define check_tlv_size(size, msg) \
do { \
@@ -3846,7 +3846,7 @@ static void ospf_mpls_te_config_write_router(struct vty *vty)
}
/*------------------------------------------------------------------------*
- * Followings are vty command functions.
+ * Following are vty command functions.
*------------------------------------------------------------------------*/
DEFUN (ospf_mpls_te_on,
@@ -3908,7 +3908,7 @@ DEFUN (no_ospf_mpls_te,
ote_debug("MPLS-TE: ON -> OFF");
/* Remove TED */
- ls_ted_del_all(OspfMplsTE.ted);
+ ls_ted_del_all(&OspfMplsTE.ted);
OspfMplsTE.enabled = false;
/* Flush all TE Opaque LSAs */
diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c
index a753340476..3bd4a9bb68 100644
--- a/ospfd/ospf_vty.c
+++ b/ospfd/ospf_vty.c
@@ -4394,7 +4394,8 @@ static void show_ip_ospf_neighbor_sub(struct vty *vty,
json_neighbor = json_object_new_object();
- ospf_nbr_ism_state_message(nbr, msgbuf, 16);
+ ospf_nbr_ism_state_message(nbr, msgbuf,
+ sizeof(msgbuf));
#if CONFDATE > 20230321
CPP_NOTICE("Remove show_ip_ospf_neighbor_sub() JSON keys: priority, state, deadTimeMsecs, address, retransmitCounter, requestCounter, dbSummaryCounter")
#endif
@@ -4490,7 +4491,8 @@ CPP_NOTICE("Remove show_ip_ospf_neighbor_sub() JSON keys: priority, state, deadT
json_object_array_add(json_neigh_array,
json_neighbor);
} else {
- ospf_nbr_ism_state_message(nbr, msgbuf, 16);
+ ospf_nbr_ism_state_message(nbr, msgbuf,
+ sizeof(msgbuf));
if (nbr->state == NSM_Attempt
&& nbr->router_id.s_addr == INADDR_ANY)
@@ -5116,6 +5118,7 @@ static void show_ip_ospf_neighbor_detail_sub(struct vty *vty,
char timebuf[OSPF_TIME_DUMP_SIZE];
json_object *json_neigh = NULL, *json_neigh_array = NULL;
char neigh_str[INET_ADDRSTRLEN] = {0};
+ char neigh_state[16] = {0};
if (use_json) {
if (prev_nbr &&
@@ -5168,15 +5171,13 @@ static void show_ip_ospf_neighbor_detail_sub(struct vty *vty,
ospf_area_desc_string(oi->area), oi->ifp->name);
/* Show neighbor priority and state. */
+ ospf_nbr_ism_state_message(nbr, neigh_state, sizeof(neigh_state));
if (use_json) {
json_object_int_add(json_neigh, "nbrPriority", nbr->priority);
- json_object_string_add(
- json_neigh, "nbrState",
- lookup_msg(ospf_nsm_state_msg, nbr->state, NULL));
+ json_object_string_add(json_neigh, "nbrState", neigh_state);
} else
vty_out(vty, " Neighbor priority is %d, State is %s,",
- nbr->priority,
- lookup_msg(ospf_nsm_state_msg, nbr->state, NULL));
+ nbr->priority, neigh_state);
/* Show state changes. */
if (use_json)
diff --git a/ospfd/ospfd.h b/ospfd/ospfd.h
index 4f1b1493a6..268e4d6f8d 100644
--- a/ospfd/ospfd.h
+++ b/ospfd/ospfd.h
@@ -337,7 +337,7 @@ struct ospf {
struct list *external[ZEBRA_ROUTE_MAX + 1];
#define EXTERNAL_INFO(E) (E->external_info)
- /* Gracefull restart Helper supported configs*/
+ /* Graceful restart Helper supported configs*/
/* Supported grace interval*/
uint32_t supported_grace_time;
diff --git a/pathd/path_pcep_controller.h b/pathd/path_pcep_controller.h
index de113feee9..bc7ed4910a 100644
--- a/pathd/path_pcep_controller.h
+++ b/pathd/path_pcep_controller.h
@@ -132,7 +132,7 @@ struct pcep_pcc_info *pcep_ctrl_get_pcc_info(struct frr_pthread *fpt,
/* Asynchronously send a report. The caller is giving away the path structure,
* it shouldn't be allocated on the stack. If `pcc_id` is `0` the report is
- * sent by all PCCs. The parameter is_stable is used to hint wether the status
+ * sent by all PCCs. The parameter is_stable is used to hint whether the status
* will soon change, this is used to ensure all report updates are sent even
* when missing status update events */
int pcep_ctrl_send_report(struct frr_pthread *fpt, int pcc_id,
diff --git a/pathd/path_ted.c b/pathd/path_ted.c
index 3440b93399..7477444104 100644
--- a/pathd/path_ted.c
+++ b/pathd/path_ted.c
@@ -66,7 +66,7 @@ uint32_t path_ted_teardown(void)
PATH_TED_DEBUG("%s : TED [%p]", __func__, ted_state_g.ted);
path_ted_unregister_vty();
path_ted_stop_importing_igp();
- ls_ted_del_all(ted_state_g.ted);
+ ls_ted_del_all(&ted_state_g.ted);
path_ted_timer_sync_cancel();
path_ted_timer_refresh_cancel();
return 0;
@@ -353,7 +353,7 @@ DEFPY (debug_path_ted,
}
/*
- * Followings are vty command functions.
+ * Following are vty command functions.
*/
/* clang-format off */
DEFUN (path_ted_on,
@@ -391,7 +391,7 @@ DEFUN (no_path_ted,
}
/* Remove TED */
- ls_ted_del_all(ted_state_g.ted);
+ ls_ted_del_all(&ted_state_g.ted);
ted_state_g.enabled = false;
PATH_TED_DEBUG("%s: PATHD-TED: ON -> OFF", __func__);
ted_state_g.import = IMPORT_UNKNOWN;
diff --git a/pbrd/pbr_zebra.c b/pbrd/pbr_zebra.c
index da4e3e1bc0..4506dc1af1 100644
--- a/pbrd/pbr_zebra.c
+++ b/pbrd/pbr_zebra.c
@@ -64,7 +64,7 @@ void pbr_if_del(struct interface *ifp)
XFREE(MTYPE_PBR_INTERFACE, ifp->info);
}
-/* Inteface addition message from zebra. */
+/* Interface addition message from zebra. */
int pbr_ifp_create(struct interface *ifp)
{
DEBUGD(&pbr_dbg_zebra, "%s: %s", __func__, ifp->name);
diff --git a/pceplib/pcep_msg_objects.h b/pceplib/pcep_msg_objects.h
index 270db4aa8d..6d7d3be7e6 100644
--- a/pceplib/pcep_msg_objects.h
+++ b/pceplib/pcep_msg_objects.h
@@ -542,7 +542,7 @@ struct pcep_ro_subobj_asn {
uint16_t asn; /* Autonomous system number */
};
-/* The SR ERO and SR RRO subojbects are the same, except
+/* The SR ERO and SR RRO subobjects are the same, except
* the SR-RRO does not have the L flag in the Type field.
* Defined in draft-ietf-pce-segment-routing-16 */
enum pcep_sr_subobj_nai {
diff --git a/pimd/pim6_cmd.c b/pimd/pim6_cmd.c
index 7b3e04fdc0..6e12b7fd39 100644
--- a/pimd/pim6_cmd.c
+++ b/pimd/pim6_cmd.c
@@ -33,11 +33,14 @@
#include "pimd.h"
#include "pim6_cmd.h"
+#include "pim_cmd_common.h"
#include "pim_vty.h"
#include "lib/northbound_cli.h"
#include "pim_errors.h"
#include "pim_nb.h"
-#include "pim_cmd_common.h"
+#include "pim_addr.h"
+#include "pim_nht.h"
+
#ifndef VTYSH_EXTRACT_PL
#include "pimd/pim6_cmd_clippy.c"
@@ -622,6 +625,830 @@ DEFPY (interface_no_ipv6_mld_query_interval,
"frr-routing:ipv6");
}
+DEFPY (show_ipv6_pim_rp,
+ show_ipv6_pim_rp_cmd,
+ "show ipv6 pim [vrf NAME] rp-info [X:X::X:X/M$group] [json$json]",
+ SHOW_STR
+ IPV6_STR
+ PIM_STR
+ VRF_CMD_HELP_STR
+ "PIM RP information\n"
+ "Multicast Group range\n"
+ JSON_STR)
+{
+ struct pim_instance *pim;
+ struct vrf *v;
+ json_object *json_parent = NULL;
+ struct prefix *range = NULL;
+
+ v = vrf_lookup_by_name(vrf ? vrf : VRF_DEFAULT_NAME);
+
+ if (!v)
+ return CMD_WARNING;
+
+ pim = pim_get_pim_instance(v->vrf_id);
+
+ if (!pim) {
+ vty_out(vty, "%% Unable to find pim instance\n");
+ return CMD_WARNING;
+ }
+
+ if (group_str) {
+ range = prefix_new();
+ prefix_copy(range, group);
+ apply_mask(range);
+ }
+
+ if (json)
+ json_parent = json_object_new_object();
+
+ pim_rp_show_information(pim, range, vty, json_parent);
+
+ if (json)
+ vty_json(vty, json_parent);
+
+ prefix_free(&range);
+
+ return CMD_SUCCESS;
+}
+
+DEFPY (show_ipv6_pim_rp_vrf_all,
+ show_ipv6_pim_rp_vrf_all_cmd,
+ "show ipv6 pim vrf all rp-info [X:X::X:X/M$group] [json$json]",
+ SHOW_STR
+ IPV6_STR
+ PIM_STR
+ VRF_CMD_HELP_STR
+ "PIM RP information\n"
+ "Multicast Group range\n"
+ JSON_STR)
+{
+ struct vrf *vrf;
+ json_object *json_parent = NULL;
+ json_object *json_vrf = NULL;
+ struct prefix *range = NULL;
+
+ if (group_str) {
+ range = prefix_new();
+ prefix_copy(range, group);
+ apply_mask(range);
+ }
+
+ if (json)
+ json_parent = json_object_new_object();
+
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
+ if (!json)
+ vty_out(vty, "VRF: %s\n", vrf->name);
+ else
+ json_vrf = json_object_new_object();
+ pim_rp_show_information(vrf->info, range, vty, json_vrf);
+ if (json)
+ json_object_object_add(json_parent, vrf->name,
+ json_vrf);
+ }
+ if (json)
+ vty_json(vty, json_parent);
+
+ prefix_free(&range);
+
+ return CMD_SUCCESS;
+}
+
+DEFPY (show_ipv6_pim_rpf,
+ show_ipv6_pim_rpf_cmd,
+ "show ipv6 pim [vrf NAME] rpf [json$json]",
+ SHOW_STR
+ IPV6_STR
+ PIM_STR
+ VRF_CMD_HELP_STR
+ "PIM cached source rpf information\n"
+ JSON_STR)
+{
+ struct pim_instance *pim;
+ struct vrf *v;
+ json_object *json_parent = NULL;
+
+ v = vrf_lookup_by_name(vrf ? vrf : VRF_DEFAULT_NAME);
+
+ if (!v)
+ return CMD_WARNING;
+
+ pim = pim_get_pim_instance(v->vrf_id);
+
+ if (!pim) {
+ vty_out(vty, "%% Unable to find pim instance\n");
+ return CMD_WARNING;
+ }
+
+ if (json)
+ json_parent = json_object_new_object();
+
+ pim_show_rpf(pim, vty, json_parent);
+
+ if (json)
+ vty_json(vty, json_parent);
+
+ return CMD_SUCCESS;
+}
+
+DEFPY (show_ipv6_pim_rpf_vrf_all,
+ show_ipv6_pim_rpf_vrf_all_cmd,
+ "show ipv6 pim vrf all rpf [json$json]",
+ SHOW_STR
+ IPV6_STR
+ PIM_STR
+ VRF_CMD_HELP_STR
+ "PIM cached source rpf information\n"
+ JSON_STR)
+{
+ struct vrf *vrf;
+ json_object *json_parent = NULL;
+ json_object *json_vrf = NULL;
+
+ if (json)
+ json_parent = json_object_new_object();
+
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
+ if (!json)
+ vty_out(vty, "VRF: %s\n", vrf->name);
+ else
+ json_vrf = json_object_new_object();
+ pim_show_rpf(vrf->info, vty, json_vrf);
+ if (json)
+ json_object_object_add(json_parent, vrf->name,
+ json_vrf);
+ }
+ if (json)
+ vty_json(vty, json_parent);
+
+ return CMD_SUCCESS;
+}
+
+DEFPY (show_ipv6_pim_secondary,
+ show_ipv6_pim_secondary_cmd,
+ "show ipv6 pim [vrf NAME] secondary",
+ SHOW_STR
+ IPV6_STR
+ PIM_STR
+ VRF_CMD_HELP_STR
+ "PIM neighbor addresses\n")
+{
+ struct pim_instance *pim;
+ struct vrf *v;
+
+ v = vrf_lookup_by_name(vrf ? vrf : VRF_DEFAULT_NAME);
+
+ if (!v)
+ return CMD_WARNING;
+
+ pim = pim_get_pim_instance(v->vrf_id);
+
+ if (!pim) {
+ vty_out(vty, "%% Unable to find pim instance\n");
+ return CMD_WARNING;
+ }
+
+ pim_show_neighbors_secondary(pim, vty);
+
+ return CMD_SUCCESS;
+}
+
+DEFPY (show_ipv6_pim_statistics,
+ show_ipv6_pim_statistics_cmd,
+ "show ipv6 pim [vrf NAME] statistics [interface WORD$word] [json$json]",
+ SHOW_STR
+ IPV6_STR
+ PIM_STR
+ VRF_CMD_HELP_STR
+ "PIM statistics\n"
+ INTERFACE_STR
+ "PIM interface\n"
+ JSON_STR)
+{
+ struct pim_instance *pim;
+ struct vrf *v;
+ bool uj = !!json;
+
+ v = vrf_lookup_by_name(vrf ? vrf : VRF_DEFAULT_NAME);
+
+ if (!v)
+ return CMD_WARNING;
+
+ pim = pim_get_pim_instance(v->vrf_id);
+
+ if (!pim) {
+ vty_out(vty, "%% Unable to find pim instance\n");
+ return CMD_WARNING;
+ }
+
+ if (word)
+ pim_show_statistics(pim, vty, word, uj);
+ else
+ pim_show_statistics(pim, vty, NULL, uj);
+
+ return CMD_SUCCESS;
+}
+
+DEFPY (show_ipv6_pim_upstream,
+ show_ipv6_pim_upstream_cmd,
+ "show ipv6 pim [vrf NAME] upstream [X:X::X:X$s_or_g [X:X::X:X$g]] [json$json]",
+ SHOW_STR
+ IPV6_STR
+ PIM_STR
+ VRF_CMD_HELP_STR
+ "PIM upstream information\n"
+ "The Source or Group\n"
+ "The Group\n"
+ JSON_STR)
+{
+ pim_sgaddr sg = {0};
+ struct vrf *v;
+ bool uj = !!json;
+ struct pim_instance *pim;
+ json_object *json_parent = NULL;
+
+ v = vrf_lookup_by_name(vrf ? vrf : VRF_DEFAULT_NAME);
+
+ if (!v) {
+ vty_out(vty, "%% Vrf specified: %s does not exist\n", vrf);
+ return CMD_WARNING;
+ }
+ pim = pim_get_pim_instance(v->vrf_id);
+
+ if (!pim) {
+ vty_out(vty, "%% Unable to find pim instance\n");
+ return CMD_WARNING;
+ }
+
+ if (uj)
+ json_parent = json_object_new_object();
+
+ if (!pim_addr_is_any(s_or_g)) {
+ if (!pim_addr_is_any(g)) {
+ sg.src = s_or_g;
+ sg.grp = g;
+ } else
+ sg.grp = s_or_g;
+ }
+
+ pim_show_upstream(pim, vty, &sg, json_parent);
+
+ if (uj)
+ vty_json(vty, json_parent);
+
+ return CMD_SUCCESS;
+}
+
+DEFPY (show_ipv6_pim_upstream_vrf_all,
+ show_ipv6_pim_upstream_vrf_all_cmd,
+ "show ipv6 pim vrf all upstream [json$json]",
+ SHOW_STR
+ IPV6_STR
+ PIM_STR
+ VRF_CMD_HELP_STR
+ "PIM upstream information\n"
+ JSON_STR)
+{
+ pim_sgaddr sg = {0};
+ struct vrf *vrf;
+ json_object *json_parent = NULL;
+ json_object *json_vrf = NULL;
+
+ if (json)
+ json_parent = json_object_new_object();
+
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
+ if (!json)
+ vty_out(vty, "VRF: %s\n", vrf->name);
+ else
+ json_vrf = json_object_new_object();
+ pim_show_upstream(vrf->info, vty, &sg, json_vrf);
+ if (json)
+ json_object_object_add(json_parent, vrf->name,
+ json_vrf);
+ }
+
+ if (json)
+ vty_json(vty, json_parent);
+
+ return CMD_SUCCESS;
+}
+
+DEFPY (show_ipv6_pim_upstream_join_desired,
+ show_ipv6_pim_upstream_join_desired_cmd,
+ "show ipv6 pim [vrf NAME] upstream-join-desired [json$json]",
+ SHOW_STR
+ IPV6_STR
+ PIM_STR
+ VRF_CMD_HELP_STR
+ "PIM upstream join-desired\n"
+ JSON_STR)
+{
+ struct pim_instance *pim;
+ struct vrf *v;
+ bool uj = !!json;
+
+ v = vrf_lookup_by_name(vrf ? vrf : VRF_DEFAULT_NAME);
+
+ if (!v)
+ return CMD_WARNING;
+
+ pim = pim_get_pim_instance(v->vrf_id);
+
+ if (!pim) {
+ vty_out(vty, "%% Unable to find pim instance\n");
+ return CMD_WARNING;
+ }
+
+ pim_show_join_desired(pim, vty, uj);
+
+ return CMD_SUCCESS;
+}
+
+DEFPY (show_ipv6_pim_upstream_rpf,
+ show_ipv6_pim_upstream_rpf_cmd,
+ "show ipv6 pim [vrf NAME] upstream-rpf [json$json]",
+ SHOW_STR
+ IPV6_STR
+ PIM_STR
+ VRF_CMD_HELP_STR
+ "PIM upstream source rpf\n"
+ JSON_STR)
+{
+ struct pim_instance *pim;
+ struct vrf *v;
+ bool uj = !!json;
+
+ v = vrf_lookup_by_name(vrf ? vrf : VRF_DEFAULT_NAME);
+
+ if (!v)
+ return CMD_WARNING;
+
+ pim = pim_get_pim_instance(v->vrf_id);
+
+ if (!pim) {
+ vty_out(vty, "%% Unable to find pim instance\n");
+ return CMD_WARNING;
+ }
+
+ pim_show_upstream_rpf(pim, vty, uj);
+
+ return CMD_SUCCESS;
+}
+
+DEFPY (show_ipv6_pim_state,
+ show_ipv6_pim_state_cmd,
+ "show ipv6 pim [vrf NAME] state [X:X::X:X$s_or_g [X:X::X:X$g]] [json$json]",
+ SHOW_STR
+ IPV6_STR
+ PIM_STR
+ VRF_CMD_HELP_STR
+ "PIM state information\n"
+ "Unicast or Multicast address\n"
+ "Multicast address\n"
+ JSON_STR)
+{
+ struct pim_instance *pim;
+ struct vrf *v;
+ json_object *json_parent = NULL;
+
+ v = vrf_lookup_by_name(vrf ? vrf : VRF_DEFAULT_NAME);
+
+ if (!v)
+ return CMD_WARNING;
+
+ pim = pim_get_pim_instance(v->vrf_id);
+
+ if (!pim) {
+ vty_out(vty, "%% Unable to find pim instance\n");
+ return CMD_WARNING;
+ }
+
+ if (json)
+ json_parent = json_object_new_object();
+
+ pim_show_state(pim, vty, s_or_g_str, g_str, json_parent);
+
+ if (json)
+ vty_json(vty, json_parent);
+
+ return CMD_SUCCESS;
+}
+
+DEFPY (show_ipv6_pim_state_vrf_all,
+ show_ipv6_pim_state_vrf_all_cmd,
+ "show ipv6 pim vrf all state [X:X::X:X$s_or_g [X:X::X:X$g]] [json$json]",
+ SHOW_STR
+ IPV6_STR
+ PIM_STR
+ VRF_CMD_HELP_STR
+ "PIM state information\n"
+ "Unicast or Multicast address\n"
+ "Multicast address\n"
+ JSON_STR)
+{
+ struct vrf *vrf;
+ json_object *json_parent = NULL;
+ json_object *json_vrf = NULL;
+
+ if (json)
+ json_parent = json_object_new_object();
+
+ RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
+ if (!json)
+ vty_out(vty, "VRF: %s\n", vrf->name);
+ else
+ json_vrf = json_object_new_object();
+ pim_show_state(vrf->info, vty, s_or_g_str, g_str, json_vrf);
+ if (json)
+ json_object_object_add(json_parent, vrf->name,
+ json_vrf);
+ }
+ if (json)
+ vty_json(vty, json_parent);
+
+ return CMD_SUCCESS;
+}
+
+DEFPY (show_ipv6_pim_channel,
+ show_ipv6_pim_channel_cmd,
+ "show ipv6 pim [vrf NAME] channel [json$json]",
+ SHOW_STR
+ IPV6_STR
+ PIM_STR
+ VRF_CMD_HELP_STR
+ "PIM downstream channel info\n"
+ JSON_STR)
+{
+ struct vrf *v;
+ bool uj = !!json;
+
+ v = vrf_lookup_by_name(vrf ? vrf : VRF_DEFAULT_NAME);
+
+ if (!v)
+ return CMD_WARNING;
+
+ pim_show_channel(v->info, vty, uj);
+
+ return CMD_SUCCESS;
+}
+
+DEFPY (show_ipv6_pim_interface,
+ show_ipv6_pim_interface_cmd,
+ "show ipv6 pim [vrf NAME] interface [detail|WORD]$interface [json$json]",
+ SHOW_STR
+ IPV6_STR
+ PIM_STR
+ VRF_CMD_HELP_STR
+ "PIM interface information\n"
+ "Detailed output\n"
+ "interface name\n"
+ JSON_STR)
+{
+ struct vrf *v;
+ bool uj = !!json;
+ json_object *json_parent = NULL;
+
+ v = vrf_lookup_by_name(vrf ? vrf : VRF_DEFAULT_NAME);
+
+ if (!v)
+ return CMD_WARNING;
+
+ if (uj)
+ json_parent = json_object_new_object();
+
+ if (interface)
+ pim_show_interfaces_single(v->info, vty, interface, false,
+ json_parent);
+ else
+ pim_show_interfaces(v->info, vty, false, json_parent);
+
+ if (uj)
+ vty_json(vty, json_parent);
+
+ return CMD_SUCCESS;
+}
+
+DEFPY (show_ipv6_pim_interface_vrf_all,
+ show_ipv6_pim_interface_vrf_all_cmd,
+ "show ipv6 pim vrf all interface [detail|WORD]$interface [json$json]",
+ SHOW_STR
+ IPV6_STR
+ PIM_STR
+ VRF_CMD_HELP_STR
+ "PIM interface information\n"
+ "Detailed output\n"
+ "interface name\n"
+ JSON_STR)
+{
+ bool uj = !!json;
+ struct vrf *v;
+ json_object *json_parent = NULL;
+ json_object *json_vrf = NULL;
+
+ if (uj)
+ json_parent = json_object_new_object();
+
+ RB_FOREACH (v, vrf_name_head, &vrfs_by_name) {
+ if (!uj)
+ vty_out(vty, "VRF: %s\n", v->name);
+ else
+ json_vrf = json_object_new_object();
+
+ if (interface)
+ pim_show_interfaces_single(v->info, vty, interface,
+ false, json_vrf);
+ else
+ pim_show_interfaces(v->info, vty, false, json_vrf);
+
+ if (uj)
+ json_object_object_add(json_parent, v->name, json_vrf);
+ }
+ if (uj)
+ vty_json(vty, json_parent);
+
+ return CMD_SUCCESS;
+}
+
+DEFPY (show_ipv6_pim_join,
+ show_ipv6_pim_join_cmd,
+ "show ipv6 pim [vrf NAME] join [X:X::X:X$s_or_g [X:X::X:X$g]] [json$json]",
+ SHOW_STR
+ IPV6_STR
+ PIM_STR
+ VRF_CMD_HELP_STR
+ "PIM interface join information\n"
+ "The Source or Group\n"
+ "The Group\n"
+ JSON_STR)
+{
+ pim_sgaddr sg = {};
+ struct vrf *v;
+ struct pim_instance *pim;
+ json_object *json_parent = NULL;
+
+ v = vrf_lookup_by_name(vrf ? vrf : VRF_DEFAULT_NAME);
+
+ if (!v) {
+ vty_out(vty, "%% Vrf specified: %s does not exist\n", vrf);
+ return CMD_WARNING;
+ }
+ pim = pim_get_pim_instance(v->vrf_id);
+
+ if (!pim) {
+ vty_out(vty, "%% Unable to find pim instance\n");
+ return CMD_WARNING;
+ }
+
+ if (!pim_addr_is_any(s_or_g)) {
+ if (!pim_addr_is_any(g)) {
+ sg.src = s_or_g;
+ sg.grp = g;
+ } else
+ sg.grp = s_or_g;
+ }
+
+ if (json)
+ json_parent = json_object_new_object();
+
+ pim_show_join(pim, vty, &sg, json_parent);
+
+ if (json)
+ vty_json(vty, json_parent);
+
+ return CMD_SUCCESS;
+}
+
+DEFPY (show_ipv6_pim_join_vrf_all,
+ show_ipv6_pim_join_vrf_all_cmd,
+ "show ipv6 pim vrf all join [json$json]",
+ SHOW_STR
+ IPV6_STR
+ PIM_STR
+ VRF_CMD_HELP_STR
+ "PIM interface join information\n"
+ JSON_STR)
+{
+ pim_sgaddr sg = {0};
+ struct vrf *vrf_struct;
+ json_object *json_parent = NULL;
+ json_object *json_vrf = NULL;
+
+ if (json)
+ json_parent = json_object_new_object();
+
+ RB_FOREACH (vrf_struct, vrf_name_head, &vrfs_by_name) {
+ if (!json_parent)
+ vty_out(vty, "VRF: %s\n", vrf_struct->name);
+ else
+ json_vrf = json_object_new_object();
+ pim_show_join(vrf_struct->info, vty, &sg, json_vrf);
+
+ if (json)
+ json_object_object_add(json_parent, vrf_struct->name,
+ json_vrf);
+ }
+ if (json)
+ vty_json(vty, json_parent);
+
+ return CMD_WARNING;
+}
+
+DEFPY (show_ipv6_pim_jp_agg,
+ show_ipv6_pim_jp_agg_cmd,
+ "show ipv6 pim [vrf NAME] jp-agg",
+ SHOW_STR
+ IPV6_STR
+ PIM_STR
+ VRF_CMD_HELP_STR
+ "join prune aggregation list\n")
+{
+ struct vrf *v;
+ struct pim_instance *pim;
+
+ v = vrf_lookup_by_name(vrf ? vrf : VRF_DEFAULT_NAME);
+
+ if (!v) {
+ vty_out(vty, "%% Vrf specified: %s does not exist\n", vrf);
+ return CMD_WARNING;
+ }
+ pim = pim_get_pim_instance(v->vrf_id);
+
+ if (!pim) {
+ vty_out(vty, "%% Unable to find pim instance\n");
+ return CMD_WARNING;
+ }
+
+ pim_show_jp_agg_list(pim, vty);
+
+ return CMD_SUCCESS;
+}
+
+DEFPY (show_ipv6_pim_local_membership,
+ show_ipv6_pim_local_membership_cmd,
+ "show ipv6 pim [vrf NAME] local-membership [json$json]",
+ SHOW_STR
+ IPV6_STR
+ PIM_STR
+ VRF_CMD_HELP_STR
+ "PIM interface local-membership\n"
+ JSON_STR)
+{
+ struct vrf *v;
+ bool uj = !!json;
+
+ v = vrf_lookup_by_name(vrf ? vrf : VRF_DEFAULT_NAME);
+
+ if (!v)
+ return CMD_WARNING;
+
+ pim_show_membership(v->info, vty, uj);
+
+ return CMD_SUCCESS;
+}
+
+DEFPY (show_ipv6_pim_neighbor,
+ show_ipv6_pim_neighbor_cmd,
+ "show ipv6 pim [vrf NAME] neighbor [detail|WORD]$interface [json$json]",
+ SHOW_STR
+ IPV6_STR
+ PIM_STR
+ VRF_CMD_HELP_STR
+ "PIM neighbor information\n"
+ "Detailed output\n"
+ "Name of interface or neighbor\n"
+ JSON_STR)
+{
+ struct vrf *v;
+ json_object *json_parent = NULL;
+
+ v = vrf_lookup_by_name(vrf ? vrf : VRF_DEFAULT_NAME);
+
+ if (!v)
+ return CMD_WARNING;
+
+ if (json)
+ json_parent = json_object_new_object();
+
+ if (interface)
+ pim_show_neighbors_single(v->info, vty, interface, json_parent);
+ else
+ pim_show_neighbors(v->info, vty, json_parent);
+
+ if (json)
+ vty_json(vty, json_parent);
+
+ return CMD_SUCCESS;
+}
+
+DEFPY (show_ipv6_pim_neighbor_vrf_all,
+ show_ipv6_pim_neighbor_vrf_all_cmd,
+ "show ipv6 pim vrf all neighbor [detail|WORD]$interface [json$json]",
+ SHOW_STR
+ IPV6_STR
+ PIM_STR
+ VRF_CMD_HELP_STR
+ "PIM neighbor information\n"
+ "Detailed output\n"
+ "Name of interface or neighbor\n"
+ JSON_STR)
+{
+ struct vrf *v;
+ json_object *json_parent = NULL;
+ json_object *json_vrf = NULL;
+
+ if (json)
+ json_parent = json_object_new_object();
+ RB_FOREACH (v, vrf_name_head, &vrfs_by_name) {
+ if (!json)
+ vty_out(vty, "VRF: %s\n", v->name);
+ else
+ json_vrf = json_object_new_object();
+
+ if (interface)
+ pim_show_neighbors_single(v->info, vty, interface,
+ json_vrf);
+ else
+ pim_show_neighbors(v->info, vty, json_vrf);
+
+ if (json)
+ json_object_object_add(json_parent, v->name, json_vrf);
+ }
+ if (json)
+ vty_json(vty, json_parent);
+
+ return CMD_SUCCESS;
+}
+
+DEFPY (show_ipv6_pim_nexthop,
+ show_ipv6_pim_nexthop_cmd,
+ "show ipv6 pim [vrf NAME] nexthop",
+ SHOW_STR
+ IPV6_STR
+ PIM_STR
+ VRF_CMD_HELP_STR
+ "PIM cached nexthop rpf information\n")
+{
+ struct vrf *v;
+
+ v = vrf_lookup_by_name(vrf ? vrf : VRF_DEFAULT_NAME);
+
+ if (!v)
+ return CMD_WARNING;
+
+ pim_show_nexthop(v->info, vty);
+
+ return CMD_SUCCESS;
+}
+
+DEFPY (show_ipv6_pim_nexthop_lookup,
+ show_ipv6_pim_nexthop_lookup_cmd,
+ "show ipv6 pim [vrf NAME] nexthop-lookup X:X::X:X$source X:X::X:X$group",
+ SHOW_STR
+ IPV6_STR
+ PIM_STR
+ VRF_CMD_HELP_STR
+ "PIM cached nexthop rpf lookup\n"
+ "Source/RP address\n"
+ "Multicast Group address\n")
+{
+ struct prefix nht_p;
+ int result = 0;
+ pim_addr vif_source;
+ struct prefix grp;
+ struct pim_nexthop nexthop;
+ char nexthop_addr_str[PIM_ADDRSTRLEN];
+ struct vrf *v;
+
+ v = vrf_lookup_by_name(vrf ? vrf : VRF_DEFAULT_NAME);
+
+ if (!v)
+ return CMD_WARNING;
+
+ if (!pim_rp_set_upstream_addr(v->info, &vif_source, source, group))
+ return CMD_SUCCESS;
+
+ pim_addr_to_prefix(&nht_p, vif_source);
+ pim_addr_to_prefix(&grp, group);
+ memset(&nexthop, 0, sizeof(nexthop));
+
+ result = pim_ecmp_nexthop_lookup(v->info, &nexthop, &nht_p, &grp, 0);
+
+ if (!result) {
+ vty_out(vty,
+ "Nexthop Lookup failed, no usable routes returned.\n");
+ return CMD_SUCCESS;
+ }
+
+ pim_addr_dump("<nexthop?>", &nexthop.mrib_nexthop_addr,
+ nexthop_addr_str, sizeof(nexthop_addr_str));
+ vty_out(vty, "Group %s --- Nexthop %s Interface %s\n", group_str,
+ nexthop_addr_str, nexthop.interface->name);
+
+ return CMD_SUCCESS;
+}
+
void pim_cmd_init(void)
{
if_cmd_init(pim_interface_config_write);
@@ -674,4 +1501,27 @@ void pim_cmd_init(void)
install_element(INTERFACE_NODE, &interface_ipv6_mld_query_interval_cmd);
install_element(INTERFACE_NODE,
&interface_no_ipv6_mld_query_interval_cmd);
+ install_element(VIEW_NODE, &show_ipv6_pim_rp_cmd);
+ install_element(VIEW_NODE, &show_ipv6_pim_rp_vrf_all_cmd);
+ install_element(VIEW_NODE, &show_ipv6_pim_rpf_cmd);
+ install_element(VIEW_NODE, &show_ipv6_pim_rpf_vrf_all_cmd);
+ install_element(VIEW_NODE, &show_ipv6_pim_secondary_cmd);
+ install_element(VIEW_NODE, &show_ipv6_pim_statistics_cmd);
+ install_element(VIEW_NODE, &show_ipv6_pim_upstream_cmd);
+ install_element(VIEW_NODE, &show_ipv6_pim_upstream_vrf_all_cmd);
+ install_element(VIEW_NODE, &show_ipv6_pim_upstream_join_desired_cmd);
+ install_element(VIEW_NODE, &show_ipv6_pim_upstream_rpf_cmd);
+ install_element(VIEW_NODE, &show_ipv6_pim_state_cmd);
+ install_element(VIEW_NODE, &show_ipv6_pim_state_vrf_all_cmd);
+ install_element(VIEW_NODE, &show_ipv6_pim_channel_cmd);
+ install_element(VIEW_NODE, &show_ipv6_pim_interface_cmd);
+ install_element(VIEW_NODE, &show_ipv6_pim_interface_vrf_all_cmd);
+ install_element(VIEW_NODE, &show_ipv6_pim_join_cmd);
+ install_element(VIEW_NODE, &show_ipv6_pim_join_vrf_all_cmd);
+ install_element(VIEW_NODE, &show_ipv6_pim_jp_agg_cmd);
+ install_element(VIEW_NODE, &show_ipv6_pim_local_membership_cmd);
+ install_element(VIEW_NODE, &show_ipv6_pim_neighbor_cmd);
+ install_element(VIEW_NODE, &show_ipv6_pim_neighbor_vrf_all_cmd);
+ install_element(VIEW_NODE, &show_ipv6_pim_nexthop_cmd);
+ install_element(VIEW_NODE, &show_ipv6_pim_nexthop_lookup_cmd);
}
diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c
index 86d179fe39..3f2e248481 100644
--- a/pimd/pim_cmd.c
+++ b/pimd/pim_cmd.c
@@ -67,6 +67,7 @@
#include "lib/northbound_cli.h"
#include "pim_errors.h"
#include "pim_nb.h"
+#include "pim_addr.h"
#include "pim_cmd_common.h"
#ifndef VTYSH_EXTRACT_PL
@@ -80,14 +81,6 @@ static struct cmd_node debug_node = {
.config_write = pim_debug_config_write,
};
-static inline bool pim_sgaddr_match(pim_sgaddr item, pim_sgaddr match)
-{
- return (pim_addr_is_any(match.grp) ||
- !pim_addr_cmp(match.grp, item.grp)) &&
- (pim_addr_is_any(match.src) ||
- !pim_addr_cmp(match.src, item.src));
-}
-
static struct vrf *pim_cmd_lookup_vrf(struct vty *vty, struct cmd_token *argv[],
const int argc, int *idx)
{
@@ -300,180 +293,6 @@ static void pim_show_assert_winner_metric(struct pim_instance *pim,
}
}
-static void json_object_pim_ifp_add(struct json_object *json,
- struct interface *ifp)
-{
- struct pim_interface *pim_ifp;
-
- pim_ifp = ifp->info;
- json_object_string_add(json, "name", ifp->name);
- json_object_string_add(json, "state", if_is_up(ifp) ? "up" : "down");
- json_object_string_addf(json, "address", "%pI4",
- &pim_ifp->primary_address);
- json_object_int_add(json, "index", ifp->ifindex);
-
- if (if_is_multicast(ifp))
- json_object_boolean_true_add(json, "flagMulticast");
-
- if (if_is_broadcast(ifp))
- json_object_boolean_true_add(json, "flagBroadcast");
-
- if (ifp->flags & IFF_ALLMULTI)
- json_object_boolean_true_add(json, "flagAllMulticast");
-
- if (ifp->flags & IFF_PROMISC)
- json_object_boolean_true_add(json, "flagPromiscuous");
-
- if (PIM_IF_IS_DELETED(ifp))
- json_object_boolean_true_add(json, "flagDeleted");
-
- if (pim_if_lan_delay_enabled(ifp))
- json_object_boolean_true_add(json, "lanDelayEnabled");
-}
-
-static void pim_show_membership_helper(struct vty *vty,
- struct pim_interface *pim_ifp,
- struct pim_ifchannel *ch,
- struct json_object *json)
-{
- char ch_grp_str[PIM_ADDRSTRLEN];
- json_object *json_iface = NULL;
- json_object *json_row = NULL;
-
- json_object_object_get_ex(json, ch->interface->name, &json_iface);
- if (!json_iface) {
- json_iface = json_object_new_object();
- json_object_pim_ifp_add(json_iface, ch->interface);
- json_object_object_add(json, ch->interface->name, json_iface);
- }
-
- snprintfrr(ch_grp_str, sizeof(ch_grp_str), "%pPAs", &ch->sg.grp);
-
- json_row = json_object_new_object();
- json_object_string_addf(json_row, "source", "%pPAs", &ch->sg.src);
- json_object_string_add(json_row, "group", ch_grp_str);
- json_object_string_add(json_row, "localMembership",
- ch->local_ifmembership == PIM_IFMEMBERSHIP_NOINFO
- ? "NOINFO"
- : "INCLUDE");
- json_object_object_add(json_iface, ch_grp_str, json_row);
-}
-
-static void pim_show_membership(struct pim_instance *pim, struct vty *vty,
- bool uj)
-{
- struct pim_interface *pim_ifp;
- struct pim_ifchannel *ch;
- struct interface *ifp;
- enum json_type type;
- json_object *json = NULL;
- json_object *json_tmp = NULL;
-
- json = json_object_new_object();
-
- FOR_ALL_INTERFACES (pim->vrf, ifp) {
- pim_ifp = ifp->info;
- if (!pim_ifp)
- continue;
-
- RB_FOREACH (ch, pim_ifchannel_rb, &pim_ifp->ifchannel_rb) {
- pim_show_membership_helper(vty, pim_ifp, ch, json);
- } /* scan interface channels */
- }
-
- if (uj) {
- vty_out(vty, "%s\n", json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
- } else {
- vty_out(vty,
- "Interface Address Source Group Membership\n");
-
- /*
- * Example of the json data we are traversing
- *
- * {
- * "swp3":{
- * "name":"swp3",
- * "state":"up",
- * "address":"10.1.20.1",
- * "index":5,
- * "flagMulticast":true,
- * "flagBroadcast":true,
- * "lanDelayEnabled":true,
- * "226.10.10.10":{
- * "source":"*",
- * "group":"226.10.10.10",
- * "localMembership":"INCLUDE"
- * }
- * }
- * }
- */
-
- /* foreach interface */
- json_object_object_foreach(json, key, val)
- {
-
- /* Find all of the keys where the val is an object. In
- * the example
- * above the only one is 226.10.10.10
- */
- json_object_object_foreach(val, if_field_key,
- if_field_val)
- {
- type = json_object_get_type(if_field_val);
-
- if (type == json_type_object) {
- vty_out(vty, "%-16s ", key);
-
- json_object_object_get_ex(
- val, "address", &json_tmp);
- vty_out(vty, "%-15s ",
- json_object_get_string(
- json_tmp));
-
- json_object_object_get_ex(if_field_val,
- "source",
- &json_tmp);
- vty_out(vty, "%-15s ",
- json_object_get_string(
- json_tmp));
-
- /* Group */
- vty_out(vty, "%-15s ", if_field_key);
-
- json_object_object_get_ex(
- if_field_val, "localMembership",
- &json_tmp);
- vty_out(vty, "%-10s\n",
- json_object_get_string(
- json_tmp));
- }
- }
- }
- }
-
- json_object_free(json);
-}
-
-static void pim_print_ifp_flags(struct vty *vty, struct interface *ifp)
-{
- vty_out(vty, "Flags\n");
- vty_out(vty, "-----\n");
- vty_out(vty, "All Multicast : %s\n",
- (ifp->flags & IFF_ALLMULTI) ? "yes" : "no");
- vty_out(vty, "Broadcast : %s\n",
- if_is_broadcast(ifp) ? "yes" : "no");
- vty_out(vty, "Deleted : %s\n",
- PIM_IF_IS_DELETED(ifp) ? "yes" : "no");
- vty_out(vty, "Interface Index : %d\n", ifp->ifindex);
- vty_out(vty, "Multicast : %s\n",
- if_is_multicast(ifp) ? "yes" : "no");
- vty_out(vty, "Promiscuous : %s\n",
- (ifp->flags & IFF_PROMISC) ? "yes" : "no");
- vty_out(vty, "\n");
- vty_out(vty, "\n");
-}
-
static void igmp_show_interfaces(struct pim_instance *pim, struct vty *vty,
bool uj)
{
@@ -874,412 +693,6 @@ static void igmp_show_interface_join(struct pim_instance *pim, struct vty *vty,
vty_json(vty, json);
}
-static void pim_show_interfaces_single(struct pim_instance *pim,
- struct vty *vty, const char *ifname,
- bool mlag, bool uj)
-{
- struct in_addr ifaddr;
- struct interface *ifp;
- struct listnode *neighnode;
- struct pim_interface *pim_ifp;
- struct pim_neighbor *neigh;
- struct pim_upstream *up;
- time_t now;
- char dr_str[INET_ADDRSTRLEN];
- char dr_uptime[10];
- char expire[10];
- char grp_str[INET_ADDRSTRLEN];
- char hello_period[10];
- char hello_timer[10];
- char neigh_src_str[INET_ADDRSTRLEN];
- char src_str[INET_ADDRSTRLEN];
- char stat_uptime[10];
- char uptime[10];
- int found_ifname = 0;
- int print_header;
- json_object *json = NULL;
- json_object *json_row = NULL;
- json_object *json_pim_neighbor = NULL;
- json_object *json_pim_neighbors = NULL;
- json_object *json_group = NULL;
- json_object *json_group_source = NULL;
- json_object *json_fhr_sources = NULL;
- struct pim_secondary_addr *sec_addr;
- struct listnode *sec_node;
-
- now = pim_time_monotonic_sec();
-
- if (uj)
- json = json_object_new_object();
-
- FOR_ALL_INTERFACES (pim->vrf, ifp) {
- pim_ifp = ifp->info;
-
- if (!pim_ifp)
- continue;
-
- if (mlag == true && pim_ifp->activeactive == false)
- continue;
-
- if (strcmp(ifname, "detail") && strcmp(ifname, ifp->name))
- continue;
-
- found_ifname = 1;
- ifaddr = pim_ifp->primary_address;
- pim_inet4_dump("<dr?>", pim_ifp->pim_dr_addr, dr_str,
- sizeof(dr_str));
- pim_time_uptime_begin(dr_uptime, sizeof(dr_uptime), now,
- pim_ifp->pim_dr_election_last);
- pim_time_timer_to_hhmmss(hello_timer, sizeof(hello_timer),
- pim_ifp->t_pim_hello_timer);
- pim_time_mmss(hello_period, sizeof(hello_period),
- pim_ifp->pim_hello_period);
- pim_time_uptime(stat_uptime, sizeof(stat_uptime),
- now - pim_ifp->pim_ifstat_start);
-
- if (uj) {
- char pbuf[PREFIX2STR_BUFFER];
- json_row = json_object_new_object();
- json_object_pim_ifp_add(json_row, ifp);
-
- if (pim_ifp->update_source.s_addr != INADDR_ANY) {
- json_object_string_addf(
- json_row, "useSource", "%pI4",
- &pim_ifp->update_source);
- }
- if (pim_ifp->sec_addr_list) {
- json_object *sec_list = NULL;
-
- sec_list = json_object_new_array();
- for (ALL_LIST_ELEMENTS_RO(
- pim_ifp->sec_addr_list, sec_node,
- sec_addr)) {
- json_object_array_add(
- sec_list,
- json_object_new_string(
- prefix2str(
- &sec_addr->addr,
- pbuf,
- sizeof(pbuf))));
- }
- json_object_object_add(json_row,
- "secondaryAddressList",
- sec_list);
- }
-
- // PIM neighbors
- if (pim_ifp->pim_neighbor_list->count) {
- json_pim_neighbors = json_object_new_object();
-
- for (ALL_LIST_ELEMENTS_RO(
- pim_ifp->pim_neighbor_list,
- neighnode, neigh)) {
- json_pim_neighbor =
- json_object_new_object();
- pim_inet4_dump("<src?>",
- neigh->source_addr,
- neigh_src_str,
- sizeof(neigh_src_str));
- pim_time_uptime(uptime, sizeof(uptime),
- now - neigh->creation);
- pim_time_timer_to_hhmmss(
- expire, sizeof(expire),
- neigh->t_expire_timer);
-
- json_object_string_add(
- json_pim_neighbor, "address",
- neigh_src_str);
- json_object_string_add(
- json_pim_neighbor, "upTime",
- uptime);
- json_object_string_add(
- json_pim_neighbor, "holdtime",
- expire);
-
- json_object_object_add(
- json_pim_neighbors,
- neigh_src_str,
- json_pim_neighbor);
- }
-
- json_object_object_add(json_row, "neighbors",
- json_pim_neighbors);
- }
-
- json_object_string_add(json_row, "drAddress", dr_str);
- json_object_int_add(json_row, "drPriority",
- pim_ifp->pim_dr_priority);
- json_object_string_add(json_row, "drUptime", dr_uptime);
- json_object_int_add(json_row, "drElections",
- pim_ifp->pim_dr_election_count);
- json_object_int_add(json_row, "drChanges",
- pim_ifp->pim_dr_election_changes);
-
- // FHR
- frr_each (rb_pim_upstream, &pim->upstream_head, up) {
- if (ifp != up->rpf.source_nexthop.interface)
- continue;
-
- if (!(up->flags & PIM_UPSTREAM_FLAG_MASK_FHR))
- continue;
-
- if (!json_fhr_sources)
- json_fhr_sources =
- json_object_new_object();
-
- snprintfrr(grp_str, sizeof(grp_str), "%pPAs",
- &up->sg.grp);
- snprintfrr(src_str, sizeof(src_str), "%pPAs",
- &up->sg.src);
- pim_time_uptime(uptime, sizeof(uptime),
- now - up->state_transition);
-
- /*
- * Does this group live in json_fhr_sources?
- * If not create it.
- */
- json_object_object_get_ex(json_fhr_sources,
- grp_str, &json_group);
-
- if (!json_group) {
- json_group = json_object_new_object();
- json_object_object_add(json_fhr_sources,
- grp_str,
- json_group);
- }
-
- json_group_source = json_object_new_object();
- json_object_string_add(json_group_source,
- "source", src_str);
- json_object_string_add(json_group_source,
- "group", grp_str);
- json_object_string_add(json_group_source,
- "upTime", uptime);
- json_object_object_add(json_group, src_str,
- json_group_source);
- }
-
- if (json_fhr_sources) {
- json_object_object_add(json_row,
- "firstHopRouter",
- json_fhr_sources);
- }
-
- json_object_int_add(json_row, "helloPeriod",
- pim_ifp->pim_hello_period);
- json_object_int_add(json_row, "holdTime",
- PIM_IF_DEFAULT_HOLDTIME(pim_ifp));
- json_object_string_add(json_row, "helloTimer",
- hello_timer);
- json_object_string_add(json_row, "helloStatStart",
- stat_uptime);
- json_object_int_add(json_row, "helloReceived",
- pim_ifp->pim_ifstat_hello_recv);
- json_object_int_add(json_row, "helloReceivedFailed",
- pim_ifp->pim_ifstat_hello_recvfail);
- json_object_int_add(json_row, "helloSend",
- pim_ifp->pim_ifstat_hello_sent);
- json_object_int_add(json_row, "hellosendFailed",
- pim_ifp->pim_ifstat_hello_sendfail);
- json_object_int_add(json_row, "helloGenerationId",
- pim_ifp->pim_generation_id);
-
- json_object_int_add(
- json_row, "effectivePropagationDelay",
- pim_if_effective_propagation_delay_msec(ifp));
- json_object_int_add(
- json_row, "effectiveOverrideInterval",
- pim_if_effective_override_interval_msec(ifp));
- json_object_int_add(
- json_row, "joinPruneOverrideInterval",
- pim_if_jp_override_interval_msec(ifp));
-
- json_object_int_add(
- json_row, "propagationDelay",
- pim_ifp->pim_propagation_delay_msec);
- json_object_int_add(
- json_row, "propagationDelayHighest",
- pim_ifp->pim_neighbors_highest_propagation_delay_msec);
- json_object_int_add(
- json_row, "overrideInterval",
- pim_ifp->pim_override_interval_msec);
- json_object_int_add(
- json_row, "overrideIntervalHighest",
- pim_ifp->pim_neighbors_highest_override_interval_msec);
- if (pim_ifp->bsm_enable)
- json_object_boolean_true_add(json_row,
- "bsmEnabled");
- if (pim_ifp->ucast_bsm_accept)
- json_object_boolean_true_add(json_row,
- "ucastBsmEnabled");
- json_object_object_add(json, ifp->name, json_row);
-
- } else {
- vty_out(vty, "Interface : %s\n", ifp->name);
- vty_out(vty, "State : %s\n",
- if_is_up(ifp) ? "up" : "down");
- if (pim_ifp->update_source.s_addr != INADDR_ANY) {
- vty_out(vty, "Use Source : %pI4\n",
- &pim_ifp->update_source);
- }
- if (pim_ifp->sec_addr_list) {
- vty_out(vty, "Address : %pI4 (primary)\n",
- &ifaddr);
- for (ALL_LIST_ELEMENTS_RO(
- pim_ifp->sec_addr_list, sec_node,
- sec_addr))
- vty_out(vty, " %pFX\n",
- &sec_addr->addr);
- } else {
- vty_out(vty, "Address : %pI4\n",
- &ifaddr);
- }
- vty_out(vty, "\n");
-
- // PIM neighbors
- print_header = 1;
-
- for (ALL_LIST_ELEMENTS_RO(pim_ifp->pim_neighbor_list,
- neighnode, neigh)) {
-
- if (print_header) {
- vty_out(vty, "PIM Neighbors\n");
- vty_out(vty, "-------------\n");
- print_header = 0;
- }
-
- pim_inet4_dump("<src?>", neigh->source_addr,
- neigh_src_str,
- sizeof(neigh_src_str));
- pim_time_uptime(uptime, sizeof(uptime),
- now - neigh->creation);
- pim_time_timer_to_hhmmss(expire, sizeof(expire),
- neigh->t_expire_timer);
- vty_out(vty,
- "%-15s : up for %s, holdtime expires in %s\n",
- neigh_src_str, uptime, expire);
- }
-
- if (!print_header) {
- vty_out(vty, "\n");
- vty_out(vty, "\n");
- }
-
- vty_out(vty, "Designated Router\n");
- vty_out(vty, "-----------------\n");
- vty_out(vty, "Address : %s\n", dr_str);
- vty_out(vty, "Priority : %u(%d)\n",
- pim_ifp->pim_dr_priority,
- pim_ifp->pim_dr_num_nondrpri_neighbors);
- vty_out(vty, "Uptime : %s\n", dr_uptime);
- vty_out(vty, "Elections : %d\n",
- pim_ifp->pim_dr_election_count);
- vty_out(vty, "Changes : %d\n",
- pim_ifp->pim_dr_election_changes);
- vty_out(vty, "\n");
- vty_out(vty, "\n");
-
- // FHR
- print_header = 1;
- frr_each (rb_pim_upstream, &pim->upstream_head, up) {
- if (!up->rpf.source_nexthop.interface)
- continue;
-
- if (strcmp(ifp->name,
- up->rpf.source_nexthop
- .interface->name)
- != 0)
- continue;
-
- if (!(up->flags & PIM_UPSTREAM_FLAG_MASK_FHR))
- continue;
-
- if (print_header) {
- vty_out(vty,
- "FHR - First Hop Router\n");
- vty_out(vty,
- "----------------------\n");
- print_header = 0;
- }
-
- pim_time_uptime(uptime, sizeof(uptime),
- now - up->state_transition);
- vty_out(vty,
- "%pPAs : %pPAs is a source, uptime is %s\n",
- &up->sg.grp, &up->sg.src, uptime);
- }
-
- if (!print_header) {
- vty_out(vty, "\n");
- vty_out(vty, "\n");
- }
-
- vty_out(vty, "Hellos\n");
- vty_out(vty, "------\n");
- vty_out(vty, "Period : %d\n",
- pim_ifp->pim_hello_period);
- vty_out(vty, "HoldTime : %d\n",
- PIM_IF_DEFAULT_HOLDTIME(pim_ifp));
- vty_out(vty, "Timer : %s\n", hello_timer);
- vty_out(vty, "StatStart : %s\n", stat_uptime);
- vty_out(vty, "Receive : %d\n",
- pim_ifp->pim_ifstat_hello_recv);
- vty_out(vty, "Receive Failed : %d\n",
- pim_ifp->pim_ifstat_hello_recvfail);
- vty_out(vty, "Send : %d\n",
- pim_ifp->pim_ifstat_hello_sent);
- vty_out(vty, "Send Failed : %d\n",
- pim_ifp->pim_ifstat_hello_sendfail);
- vty_out(vty, "Generation ID : %08x\n",
- pim_ifp->pim_generation_id);
- vty_out(vty, "\n");
- vty_out(vty, "\n");
-
- pim_print_ifp_flags(vty, ifp);
-
- vty_out(vty, "Join Prune Interval\n");
- vty_out(vty, "-------------------\n");
- vty_out(vty, "LAN Delay : %s\n",
- pim_if_lan_delay_enabled(ifp) ? "yes" : "no");
- vty_out(vty, "Effective Propagation Delay : %d msec\n",
- pim_if_effective_propagation_delay_msec(ifp));
- vty_out(vty, "Effective Override Interval : %d msec\n",
- pim_if_effective_override_interval_msec(ifp));
- vty_out(vty, "Join Prune Override Interval : %d msec\n",
- pim_if_jp_override_interval_msec(ifp));
- vty_out(vty, "\n");
- vty_out(vty, "\n");
-
- vty_out(vty, "LAN Prune Delay\n");
- vty_out(vty, "---------------\n");
- vty_out(vty, "Propagation Delay : %d msec\n",
- pim_ifp->pim_propagation_delay_msec);
- vty_out(vty, "Propagation Delay (Highest) : %d msec\n",
- pim_ifp->pim_neighbors_highest_propagation_delay_msec);
- vty_out(vty, "Override Interval : %d msec\n",
- pim_ifp->pim_override_interval_msec);
- vty_out(vty, "Override Interval (Highest) : %d msec\n",
- pim_ifp->pim_neighbors_highest_override_interval_msec);
- vty_out(vty, "\n");
- vty_out(vty, "\n");
-
- vty_out(vty, "BSM Status\n");
- vty_out(vty, "----------\n");
- vty_out(vty, "Bsm Enabled : %s\n",
- pim_ifp->bsm_enable ? "yes" : "no");
- vty_out(vty, "Unicast Bsm Enabled : %s\n",
- pim_ifp->ucast_bsm_accept ? "yes" : "no");
- vty_out(vty, "\n");
- vty_out(vty, "\n");
- }
- }
-
- if (uj)
- vty_json(vty, json);
- else if (!found_ifname)
- vty_out(vty, "%% No such interface\n");
-}
-
static void igmp_show_statistics(struct pim_instance *pim, struct vty *vty,
const char *ifname, bool uj)
{
@@ -1424,101 +837,6 @@ 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 mlag, bool uj)
-{
- struct interface *ifp;
- struct pim_interface *pim_ifp;
- struct pim_upstream *up;
- int fhr = 0;
- int pim_nbrs = 0;
- int pim_ifchannels = 0;
- json_object *json = NULL;
- json_object *json_row = NULL;
- json_object *json_tmp;
-
- json = json_object_new_object();
-
- FOR_ALL_INTERFACES (pim->vrf, ifp) {
- pim_ifp = ifp->info;
-
- 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;
-
- frr_each (rb_pim_upstream, &pim->upstream_head, up)
- if (ifp == up->rpf.source_nexthop.interface)
- if (up->flags & PIM_UPSTREAM_FLAG_MASK_FHR)
- fhr++;
-
- json_row = json_object_new_object();
- json_object_pim_ifp_add(json_row, ifp);
- json_object_int_add(json_row, "pimNeighbors", pim_nbrs);
- json_object_int_add(json_row, "pimIfChannels", pim_ifchannels);
- json_object_int_add(json_row, "firstHopRouterCount", fhr);
- json_object_string_addf(json_row, "pimDesignatedRouter", "%pI4",
- &pim_ifp->pim_dr_addr);
-
- if (pim_ifp->pim_dr_addr.s_addr
- == pim_ifp->primary_address.s_addr)
- json_object_boolean_true_add(
- json_row, "pimDesignatedRouterLocal");
-
- json_object_object_add(json, ifp->name, json_row);
- }
-
- if (uj) {
- vty_out(vty, "%s\n", json_object_to_json_string_ext(
- json, JSON_C_TO_STRING_PRETTY));
- } else {
- vty_out(vty,
- "Interface State Address PIM Nbrs PIM DR FHR IfChannels\n");
-
- json_object_object_foreach(json, key, val)
- {
- vty_out(vty, "%-16s ", key);
-
- json_object_object_get_ex(val, "state", &json_tmp);
- vty_out(vty, "%5s ", 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));
-
- json_object_object_get_ex(val, "pimNeighbors",
- &json_tmp);
- vty_out(vty, "%8d ", json_object_get_int(json_tmp));
-
- if (json_object_object_get_ex(
- val, "pimDesignatedRouterLocal",
- &json_tmp)) {
- vty_out(vty, "%15s ", "local");
- } else {
- json_object_object_get_ex(
- val, "pimDesignatedRouter", &json_tmp);
- vty_out(vty, "%15s ",
- 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));
-
- json_object_object_get_ex(val, "pimIfChannels",
- &json_tmp);
- vty_out(vty, "%9d\n", json_object_get_int(json_tmp));
- }
- }
-
- json_object_free(json);
-}
-
static void pim_show_interface_traffic(struct pim_instance *pim,
struct vty *vty, bool uj)
{
@@ -1702,1200 +1020,6 @@ static void pim_show_interface_traffic_single(struct pim_instance *pim,
vty_out(vty, "%% No such interface\n");
}
-static void pim_show_join_helper(struct vty *vty, struct pim_interface *pim_ifp,
- struct pim_ifchannel *ch, json_object *json,
- time_t now, bool uj)
-{
- json_object *json_iface = NULL;
- json_object *json_row = NULL;
- json_object *json_grp = NULL;
- struct in_addr ifaddr;
- char uptime[10];
- char expire[10];
- char prune[10];
- char buf[PREFIX_STRLEN];
-
- ifaddr = pim_ifp->primary_address;
-
- pim_time_uptime_begin(uptime, sizeof(uptime), now, ch->ifjoin_creation);
- pim_time_timer_to_mmss(expire, sizeof(expire),
- ch->t_ifjoin_expiry_timer);
- pim_time_timer_to_mmss(prune, sizeof(prune),
- ch->t_ifjoin_prune_pending_timer);
-
- if (uj) {
- char ch_grp_str[PIM_ADDRSTRLEN];
- char ch_src_str[PIM_ADDRSTRLEN];
-
- snprintfrr(ch_grp_str, sizeof(ch_grp_str), "%pPAs",
- &ch->sg.grp);
- snprintfrr(ch_src_str, sizeof(ch_src_str), "%pPAs",
- &ch->sg.src);
-
- json_object_object_get_ex(json, ch->interface->name,
- &json_iface);
-
- if (!json_iface) {
- json_iface = json_object_new_object();
- json_object_pim_ifp_add(json_iface, ch->interface);
- json_object_object_add(json, ch->interface->name,
- json_iface);
- }
-
- json_row = json_object_new_object();
- json_object_string_add(json_row, "source", ch_src_str);
- json_object_string_add(json_row, "group", ch_grp_str);
- json_object_string_add(json_row, "upTime", uptime);
- json_object_string_add(json_row, "expire", expire);
- json_object_string_add(json_row, "prune", prune);
- json_object_string_add(
- json_row, "channelJoinName",
- pim_ifchannel_ifjoin_name(ch->ifjoin_state, ch->flags));
- if (PIM_IF_FLAG_TEST_S_G_RPT(ch->flags)) {
-#if CONFDATE > 20230131
-CPP_NOTICE("Remove JSON object commands with keys starting with capital")
-#endif
- json_object_int_add(json_row, "SGRpt", 1);
- 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();
- json_object_object_add(json_grp, ch_src_str, json_row);
- json_object_object_add(json_iface, ch_grp_str,
- json_grp);
- } else
- json_object_object_add(json_grp, ch_src_str, json_row);
- } else {
- vty_out(vty, "%-16s %-15s %-15pPAs %-15pPAs %-10s %8s %-6s %5s\n",
- ch->interface->name,
- inet_ntop(AF_INET, &ifaddr, buf, sizeof(buf)),
- &ch->sg.src, &ch->sg.grp,
- pim_ifchannel_ifjoin_name(ch->ifjoin_state, ch->flags),
- uptime, expire, prune);
- }
-}
-
-static void pim_show_join(struct pim_instance *pim, struct vty *vty,
- pim_sgaddr *sg, bool uj)
-{
- struct pim_interface *pim_ifp;
- struct pim_ifchannel *ch;
- struct interface *ifp;
- time_t now;
- json_object *json = NULL;
-
- now = pim_time_monotonic_sec();
-
- if (uj)
- json = json_object_new_object();
- else
- vty_out(vty,
- "Interface Address Source Group State Uptime Expire Prune\n");
-
- FOR_ALL_INTERFACES (pim->vrf, ifp) {
- pim_ifp = ifp->info;
- if (!pim_ifp)
- continue;
-
- RB_FOREACH (ch, pim_ifchannel_rb, &pim_ifp->ifchannel_rb) {
- if (!pim_sgaddr_match(ch->sg, *sg))
- continue;
- pim_show_join_helper(vty, pim_ifp, ch, json, now, uj);
- } /* scan interface channels */
- }
-
- if (uj)
- vty_json(vty, json);
-}
-
-static void pim_show_neighbors_single(struct pim_instance *pim, struct vty *vty,
- const char *neighbor, bool uj)
-{
- struct listnode *neighnode;
- struct interface *ifp;
- struct pim_interface *pim_ifp;
- struct pim_neighbor *neigh;
- time_t now;
- int found_neighbor = 0;
- int option_address_list;
- int option_dr_priority;
- int option_generation_id;
- int option_holdtime;
- int option_lan_prune_delay;
- int option_t_bit;
- char uptime[10];
- char expire[10];
- char neigh_src_str[INET_ADDRSTRLEN];
-
- json_object *json = NULL;
- json_object *json_ifp = NULL;
- json_object *json_row = NULL;
-
- now = pim_time_monotonic_sec();
-
- if (uj)
- json = json_object_new_object();
-
- FOR_ALL_INTERFACES (pim->vrf, ifp) {
- pim_ifp = ifp->info;
-
- if (!pim_ifp)
- continue;
-
- if (pim_ifp->pim_sock_fd < 0)
- continue;
-
- for (ALL_LIST_ELEMENTS_RO(pim_ifp->pim_neighbor_list, neighnode,
- neigh)) {
- pim_inet4_dump("<src?>", neigh->source_addr,
- neigh_src_str, sizeof(neigh_src_str));
-
- /*
- * The user can specify either the interface name or the
- * PIM neighbor IP.
- * If this pim_ifp matches neither then skip.
- */
- if (strcmp(neighbor, "detail")
- && strcmp(neighbor, ifp->name)
- && strcmp(neighbor, neigh_src_str))
- continue;
-
- found_neighbor = 1;
- pim_time_uptime(uptime, sizeof(uptime),
- now - neigh->creation);
- pim_time_timer_to_hhmmss(expire, sizeof(expire),
- neigh->t_expire_timer);
-
- option_address_list = 0;
- option_dr_priority = 0;
- option_generation_id = 0;
- option_holdtime = 0;
- option_lan_prune_delay = 0;
- option_t_bit = 0;
-
- if (PIM_OPTION_IS_SET(neigh->hello_options,
- PIM_OPTION_MASK_ADDRESS_LIST))
- option_address_list = 1;
-
- if (PIM_OPTION_IS_SET(neigh->hello_options,
- PIM_OPTION_MASK_DR_PRIORITY))
- option_dr_priority = 1;
-
- if (PIM_OPTION_IS_SET(neigh->hello_options,
- PIM_OPTION_MASK_GENERATION_ID))
- option_generation_id = 1;
-
- if (PIM_OPTION_IS_SET(neigh->hello_options,
- PIM_OPTION_MASK_HOLDTIME))
- option_holdtime = 1;
-
- if (PIM_OPTION_IS_SET(neigh->hello_options,
- PIM_OPTION_MASK_LAN_PRUNE_DELAY))
- option_lan_prune_delay = 1;
-
- if (PIM_OPTION_IS_SET(
- neigh->hello_options,
- PIM_OPTION_MASK_CAN_DISABLE_JOIN_SUPPRESSION))
- option_t_bit = 1;
-
- if (uj) {
-
- /* Does this ifp live in json? If not create
- * it. */
- json_object_object_get_ex(json, ifp->name,
- &json_ifp);
-
- if (!json_ifp) {
- json_ifp = json_object_new_object();
- json_object_pim_ifp_add(json_ifp, ifp);
- json_object_object_add(json, ifp->name,
- json_ifp);
- }
-
- json_row = json_object_new_object();
- json_object_string_add(json_row, "interface",
- ifp->name);
- json_object_string_add(json_row, "address",
- neigh_src_str);
- json_object_string_add(json_row, "upTime",
- uptime);
- json_object_string_add(json_row, "holdtime",
- expire);
- json_object_int_add(json_row, "drPriority",
- neigh->dr_priority);
- json_object_int_add(json_row, "generationId",
- neigh->generation_id);
-
- if (option_address_list)
- json_object_boolean_true_add(
- json_row,
- "helloOptionAddressList");
-
- if (option_dr_priority)
- json_object_boolean_true_add(
- json_row,
- "helloOptionDrPriority");
-
- if (option_generation_id)
- json_object_boolean_true_add(
- json_row,
- "helloOptionGenerationId");
-
- if (option_holdtime)
- json_object_boolean_true_add(
- json_row,
- "helloOptionHoldtime");
-
- if (option_lan_prune_delay)
- json_object_boolean_true_add(
- json_row,
- "helloOptionLanPruneDelay");
-
- if (option_t_bit)
- json_object_boolean_true_add(
- json_row, "helloOptionTBit");
-
- json_object_object_add(json_ifp, neigh_src_str,
- json_row);
-
- } else {
- vty_out(vty, "Interface : %s\n", ifp->name);
- vty_out(vty, "Neighbor : %s\n", neigh_src_str);
- vty_out(vty,
- " Uptime : %s\n",
- uptime);
- vty_out(vty,
- " Holdtime : %s\n",
- expire);
- vty_out(vty,
- " DR Priority : %d\n",
- neigh->dr_priority);
- vty_out(vty,
- " Generation ID : %08x\n",
- neigh->generation_id);
- vty_out(vty,
- " Override Interval (msec) : %d\n",
- neigh->override_interval_msec);
- vty_out(vty,
- " Propagation Delay (msec) : %d\n",
- neigh->propagation_delay_msec);
- vty_out(vty,
- " Hello Option - Address List : %s\n",
- option_address_list ? "yes" : "no");
- vty_out(vty,
- " Hello Option - DR Priority : %s\n",
- option_dr_priority ? "yes" : "no");
- vty_out(vty,
- " Hello Option - Generation ID : %s\n",
- option_generation_id ? "yes" : "no");
- vty_out(vty,
- " Hello Option - Holdtime : %s\n",
- option_holdtime ? "yes" : "no");
- vty_out(vty,
- " Hello Option - LAN Prune Delay : %s\n",
- option_lan_prune_delay ? "yes" : "no");
- vty_out(vty,
- " Hello Option - T-bit : %s\n",
- option_t_bit ? "yes" : "no");
- bfd_sess_show(vty, json_ifp,
- neigh->bfd_session);
- vty_out(vty, "\n");
- }
- }
- }
-
- if (uj)
- vty_json(vty, json);
- else if (!found_neighbor)
- vty_out(vty, "%% No such interface or neighbor\n");
-}
-
-static void pim_show_state(struct pim_instance *pim, struct vty *vty,
- const char *src_or_group, const char *group, bool uj)
-{
- struct channel_oil *c_oil;
- json_object *json = NULL;
- json_object *json_group = NULL;
- json_object *json_ifp_in = NULL;
- json_object *json_ifp_out = NULL;
- json_object *json_source = NULL;
- time_t now;
- int first_oif;
- now = pim_time_monotonic_sec();
-
- if (uj) {
- json = json_object_new_object();
- } else {
- vty_out(vty,
- "Codes: J -> Pim Join, I -> IGMP Report, S -> Source, * -> Inherited from (*,G), V -> VxLAN, M -> Muted");
- vty_out(vty,
- "\nActive Source Group RPT IIF OIL\n");
- }
-
- frr_each (rb_pim_oil, &pim->channel_oil_head, c_oil) {
- char grp_str[INET_ADDRSTRLEN];
- char src_str[INET_ADDRSTRLEN];
- char in_ifname[INTERFACE_NAMSIZ + 1];
- char out_ifname[INTERFACE_NAMSIZ + 1];
- int oif_vif_index;
- struct interface *ifp_in;
- bool isRpt;
- first_oif = 1;
-
- if ((c_oil->up &&
- PIM_UPSTREAM_FLAG_TEST_USE_RPT(c_oil->up->flags)) ||
- c_oil->oil.mfcc_origin.s_addr == INADDR_ANY)
- isRpt = true;
- else
- isRpt = false;
-
- pim_inet4_dump("<group?>", c_oil->oil.mfcc_mcastgrp, grp_str,
- sizeof(grp_str));
- pim_inet4_dump("<source?>", c_oil->oil.mfcc_origin, src_str,
- sizeof(src_str));
- ifp_in = pim_if_find_by_vif_index(pim, c_oil->oil.mfcc_parent);
-
- if (ifp_in)
- strlcpy(in_ifname, ifp_in->name, sizeof(in_ifname));
- else
- strlcpy(in_ifname, "<iif?>", sizeof(in_ifname));
-
- if (src_or_group) {
- if (strcmp(src_or_group, src_str)
- && strcmp(src_or_group, grp_str))
- continue;
-
- if (group && strcmp(group, grp_str))
- continue;
- }
-
- if (uj) {
-
- /* Find the group, create it if it doesn't exist */
- 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);
- }
-
- /* Find the source nested under the group, create it if
- * it doesn't exist */
- json_object_object_get_ex(json_group, src_str,
- &json_source);
-
- if (!json_source) {
- json_source = json_object_new_object();
- json_object_object_add(json_group, src_str,
- json_source);
- }
-
- /* Find the inbound interface nested under the source,
- * create it if it doesn't exist */
- json_object_object_get_ex(json_source, in_ifname,
- &json_ifp_in);
-
- if (!json_ifp_in) {
- json_ifp_in = json_object_new_object();
- json_object_object_add(json_source, in_ifname,
- json_ifp_in);
- json_object_int_add(json_source, "Installed",
- c_oil->installed);
- json_object_int_add(json_source, "installed",
- c_oil->installed);
- if (isRpt)
- json_object_boolean_true_add(
- json_source, "isRpt");
- else
- json_object_boolean_false_add(
- json_source, "isRpt");
- json_object_int_add(json_source, "RefCount",
- c_oil->oil_ref_count);
- json_object_int_add(json_source, "refCount",
- c_oil->oil_ref_count);
- json_object_int_add(json_source, "OilListSize",
- c_oil->oil_size);
- json_object_int_add(json_source, "oilListSize",
- c_oil->oil_size);
- json_object_int_add(
- json_source, "OilRescan",
- c_oil->oil_inherited_rescan);
- json_object_int_add(
- json_source, "oilRescan",
- c_oil->oil_inherited_rescan);
- json_object_int_add(json_source, "LastUsed",
- c_oil->cc.lastused);
- json_object_int_add(json_source, "lastUsed",
- c_oil->cc.lastused);
- json_object_int_add(json_source, "PacketCount",
- c_oil->cc.pktcnt);
- json_object_int_add(json_source, "packetCount",
- c_oil->cc.pktcnt);
- json_object_int_add(json_source, "ByteCount",
- c_oil->cc.bytecnt);
- json_object_int_add(json_source, "byteCount",
- c_oil->cc.bytecnt);
- json_object_int_add(json_source,
- "WrongInterface",
- c_oil->cc.wrong_if);
- json_object_int_add(json_source,
- "wrongInterface",
- c_oil->cc.wrong_if);
- }
- } else {
- vty_out(vty, "%-6d %-15s %-15s %-3s %-16s ",
- c_oil->installed, src_str, grp_str,
- isRpt ? "y" : "n", in_ifname);
- }
-
- for (oif_vif_index = 0; oif_vif_index < MAXVIFS;
- ++oif_vif_index) {
- struct interface *ifp_out;
- char oif_uptime[10];
- int ttl;
-
- ttl = c_oil->oil.mfcc_ttls[oif_vif_index];
- if (ttl < 1)
- continue;
-
- ifp_out = pim_if_find_by_vif_index(pim, oif_vif_index);
- pim_time_uptime(
- oif_uptime, sizeof(oif_uptime),
- now - c_oil->oif_creation[oif_vif_index]);
-
- if (ifp_out)
- strlcpy(out_ifname, ifp_out->name, sizeof(out_ifname));
- else
- strlcpy(out_ifname, "<oif?>", sizeof(out_ifname));
-
- if (uj) {
- json_ifp_out = json_object_new_object();
- json_object_string_add(json_ifp_out, "source",
- src_str);
- json_object_string_add(json_ifp_out, "group",
- grp_str);
- json_object_string_add(json_ifp_out,
- "inboundInterface",
- in_ifname);
- json_object_string_add(json_ifp_out,
- "outboundInterface",
- out_ifname);
- json_object_int_add(json_ifp_out, "installed",
- c_oil->installed);
-
- json_object_object_add(json_ifp_in, out_ifname,
- json_ifp_out);
- } else {
- if (first_oif) {
- first_oif = 0;
- vty_out(vty, "%s(%c%c%c%c%c)",
- out_ifname,
- (c_oil->oif_flags[oif_vif_index]
- & PIM_OIF_FLAG_PROTO_IGMP)
- ? 'I'
- : ' ',
- (c_oil->oif_flags[oif_vif_index]
- & PIM_OIF_FLAG_PROTO_PIM)
- ? 'J'
- : ' ',
- (c_oil->oif_flags[oif_vif_index]
- & PIM_OIF_FLAG_PROTO_VXLAN)
- ? 'V'
- : ' ',
- (c_oil->oif_flags[oif_vif_index]
- & PIM_OIF_FLAG_PROTO_STAR)
- ? '*'
- : ' ',
- (c_oil->oif_flags[oif_vif_index]
- & PIM_OIF_FLAG_MUTE)
- ? 'M'
- : ' ');
- } else
- vty_out(vty, ", %s(%c%c%c%c%c)",
- out_ifname,
- (c_oil->oif_flags[oif_vif_index]
- & PIM_OIF_FLAG_PROTO_IGMP)
- ? 'I'
- : ' ',
- (c_oil->oif_flags[oif_vif_index]
- & PIM_OIF_FLAG_PROTO_PIM)
- ? 'J'
- : ' ',
- (c_oil->oif_flags[oif_vif_index]
- & PIM_OIF_FLAG_PROTO_VXLAN)
- ? 'V'
- : ' ',
- (c_oil->oif_flags[oif_vif_index]
- & PIM_OIF_FLAG_PROTO_STAR)
- ? '*'
- : ' ',
- (c_oil->oif_flags[oif_vif_index]
- & PIM_OIF_FLAG_MUTE)
- ? 'M'
- : ' ');
- }
- }
-
- if (!uj)
- vty_out(vty, "\n");
- }
-
-
- if (uj)
- vty_json(vty, json);
- else
- vty_out(vty, "\n");
-}
-
-static void pim_show_neighbors(struct pim_instance *pim, struct vty *vty,
- bool uj)
-{
- struct listnode *neighnode;
- struct interface *ifp;
- struct pim_interface *pim_ifp;
- struct pim_neighbor *neigh;
- time_t now;
- char uptime[10];
- char expire[10];
- char neigh_src_str[INET_ADDRSTRLEN];
- json_object *json = NULL;
- json_object *json_ifp_rows = NULL;
- json_object *json_row = NULL;
-
- now = pim_time_monotonic_sec();
-
- if (uj) {
- json = json_object_new_object();
- } else {
- vty_out(vty,
- "Interface Neighbor Uptime Holdtime DR Pri\n");
- }
-
- FOR_ALL_INTERFACES (pim->vrf, ifp) {
- pim_ifp = ifp->info;
-
- if (!pim_ifp)
- continue;
-
- if (pim_ifp->pim_sock_fd < 0)
- continue;
-
- if (uj)
- json_ifp_rows = json_object_new_object();
-
- for (ALL_LIST_ELEMENTS_RO(pim_ifp->pim_neighbor_list, neighnode,
- neigh)) {
- pim_inet4_dump("<src?>", neigh->source_addr,
- neigh_src_str, sizeof(neigh_src_str));
- pim_time_uptime(uptime, sizeof(uptime),
- now - neigh->creation);
- pim_time_timer_to_hhmmss(expire, sizeof(expire),
- neigh->t_expire_timer);
-
- if (uj) {
- json_row = json_object_new_object();
- json_object_string_add(json_row, "interface",
- ifp->name);
- json_object_string_add(json_row, "neighbor",
- neigh_src_str);
- json_object_string_add(json_row, "upTime",
- uptime);
- json_object_string_add(json_row, "holdTime",
- expire);
- json_object_int_add(json_row, "holdTimeMax",
- neigh->holdtime);
- json_object_int_add(json_row, "drPriority",
- neigh->dr_priority);
- json_object_object_add(json_ifp_rows,
- neigh_src_str, json_row);
-
- } else {
- vty_out(vty, "%-16s %15s %8s %8s %6d\n",
- ifp->name, neigh_src_str, uptime,
- expire, neigh->dr_priority);
- }
- }
-
- if (uj) {
- json_object_object_add(json, ifp->name, json_ifp_rows);
- json_ifp_rows = NULL;
- }
- }
-
- if (uj)
- vty_json(vty, json);
-}
-
-static void pim_show_neighbors_secondary(struct pim_instance *pim,
- struct vty *vty)
-{
- struct interface *ifp;
-
- vty_out(vty,
- "Interface Address Neighbor Secondary \n");
-
- FOR_ALL_INTERFACES (pim->vrf, ifp) {
- struct pim_interface *pim_ifp;
- struct in_addr ifaddr;
- struct listnode *neighnode;
- struct pim_neighbor *neigh;
- char buf[PREFIX_STRLEN];
-
- pim_ifp = ifp->info;
-
- if (!pim_ifp)
- continue;
-
- if (pim_ifp->pim_sock_fd < 0)
- continue;
-
- ifaddr = pim_ifp->primary_address;
-
- for (ALL_LIST_ELEMENTS_RO(pim_ifp->pim_neighbor_list, neighnode,
- neigh)) {
- char neigh_src_str[INET_ADDRSTRLEN];
- struct listnode *prefix_node;
- struct prefix *p;
-
- if (!neigh->prefix_list)
- continue;
-
- pim_inet4_dump("<src?>", neigh->source_addr,
- neigh_src_str, sizeof(neigh_src_str));
-
- for (ALL_LIST_ELEMENTS_RO(neigh->prefix_list,
- prefix_node, p))
- vty_out(vty, "%-16s %-15s %-15s %-15pFX\n",
- ifp->name,
- inet_ntop(AF_INET, &ifaddr,
- buf, sizeof(buf)),
- neigh_src_str, p);
- }
- }
-}
-
-static void json_object_pim_upstream_add(json_object *json,
- struct pim_upstream *up)
-{
- if (up->flags & PIM_UPSTREAM_FLAG_MASK_DR_JOIN_DESIRED)
- json_object_boolean_true_add(json, "drJoinDesired");
-
- if (up->flags & PIM_UPSTREAM_FLAG_MASK_DR_JOIN_DESIRED_UPDATED)
- json_object_boolean_true_add(json, "drJoinDesiredUpdated");
-
- if (up->flags & PIM_UPSTREAM_FLAG_MASK_FHR)
- json_object_boolean_true_add(json, "firstHopRouter");
-
- if (up->flags & PIM_UPSTREAM_FLAG_MASK_SRC_IGMP)
- json_object_boolean_true_add(json, "sourceIgmp");
-
- if (up->flags & PIM_UPSTREAM_FLAG_MASK_SRC_PIM)
- json_object_boolean_true_add(json, "sourcePim");
-
- if (up->flags & PIM_UPSTREAM_FLAG_MASK_SRC_STREAM)
- json_object_boolean_true_add(json, "sourceStream");
-
- /* XXX: need to print ths flag in the plain text display as well */
- if (up->flags & PIM_UPSTREAM_FLAG_MASK_SRC_MSDP)
- json_object_boolean_true_add(json, "sourceMsdp");
-
- if (up->flags & PIM_UPSTREAM_FLAG_MASK_SEND_SG_RPT_PRUNE)
- json_object_boolean_true_add(json, "sendSGRptPrune");
-
- if (up->flags & PIM_UPSTREAM_FLAG_MASK_SRC_LHR)
- json_object_boolean_true_add(json, "lastHopRouter");
-
- if (up->flags & PIM_UPSTREAM_FLAG_MASK_DISABLE_KAT_EXPIRY)
- json_object_boolean_true_add(json, "disableKATExpiry");
-
- if (up->flags & PIM_UPSTREAM_FLAG_MASK_STATIC_IIF)
- json_object_boolean_true_add(json, "staticIncomingInterface");
-
- if (up->flags & PIM_UPSTREAM_FLAG_MASK_ALLOW_IIF_IN_OIL)
- json_object_boolean_true_add(json,
- "allowIncomingInterfaceinOil");
-
- if (up->flags & PIM_UPSTREAM_FLAG_MASK_NO_PIMREG_DATA)
- json_object_boolean_true_add(json, "noPimRegistrationData");
-
- if (up->flags & PIM_UPSTREAM_FLAG_MASK_FORCE_PIMREG)
- json_object_boolean_true_add(json, "forcePimRegistration");
-
- if (up->flags & PIM_UPSTREAM_FLAG_MASK_SRC_VXLAN_ORIG)
- json_object_boolean_true_add(json, "sourceVxlanOrigination");
-
- if (up->flags & PIM_UPSTREAM_FLAG_MASK_SRC_VXLAN_TERM)
- json_object_boolean_true_add(json, "sourceVxlanTermination");
-
- if (up->flags & PIM_UPSTREAM_FLAG_MASK_MLAG_VXLAN)
- json_object_boolean_true_add(json, "mlagVxlan");
-
- if (up->flags & PIM_UPSTREAM_FLAG_MASK_MLAG_NON_DF)
- json_object_boolean_true_add(json,
- "mlagNonDesignatedForwarder");
-}
-
-static const char *
-pim_upstream_state2brief_str(enum pim_upstream_state join_state,
- char *state_str, size_t state_str_len)
-{
- switch (join_state) {
- case PIM_UPSTREAM_NOTJOINED:
- strlcpy(state_str, "NotJ", state_str_len);
- break;
- case PIM_UPSTREAM_JOINED:
- strlcpy(state_str, "J", state_str_len);
- break;
- default:
- strlcpy(state_str, "Unk", state_str_len);
- }
- return state_str;
-}
-
-static const char *pim_reg_state2brief_str(enum pim_reg_state reg_state,
- char *state_str, size_t state_str_len)
-{
- switch (reg_state) {
- case PIM_REG_NOINFO:
- strlcpy(state_str, "RegNI", state_str_len);
- break;
- case PIM_REG_JOIN:
- strlcpy(state_str, "RegJ", state_str_len);
- break;
- case PIM_REG_JOIN_PENDING:
- case PIM_REG_PRUNE:
- strlcpy(state_str, "RegP", state_str_len);
- break;
- }
- return state_str;
-}
-
-static void pim_show_upstream(struct pim_instance *pim, struct vty *vty,
- pim_sgaddr *sg, bool uj)
-{
- struct pim_upstream *up;
- time_t now;
- json_object *json = NULL;
- json_object *json_group = NULL;
- json_object *json_row = NULL;
-
- now = pim_time_monotonic_sec();
-
- if (uj)
- json = json_object_new_object();
- else
- vty_out(vty,
- "Iif Source Group State Uptime JoinTimer RSTimer KATimer RefCnt\n");
-
- frr_each (rb_pim_upstream, &pim->upstream_head, up) {
- char uptime[10];
- char join_timer[10];
- char rs_timer[10];
- char ka_timer[10];
- char msdp_reg_timer[10];
- char state_str[PIM_REG_STATE_STR_LEN];
-
- if (!pim_sgaddr_match(up->sg, *sg))
- continue;
-
- pim_time_uptime(uptime, sizeof(uptime),
- now - up->state_transition);
- pim_time_timer_to_hhmmss(join_timer, sizeof(join_timer),
- up->t_join_timer);
-
- /*
- * If the upstream is not dummy and it has a J/P timer for the
- * neighbor display that
- */
- if (!up->t_join_timer && up->rpf.source_nexthop.interface) {
- struct pim_neighbor *nbr;
-
- nbr = pim_neighbor_find_prefix(
- up->rpf.source_nexthop.interface,
- &up->rpf.rpf_addr);
- if (nbr)
- pim_time_timer_to_hhmmss(join_timer,
- sizeof(join_timer),
- nbr->jp_timer);
- }
-
- pim_time_timer_to_hhmmss(rs_timer, sizeof(rs_timer),
- up->t_rs_timer);
- pim_time_timer_to_hhmmss(ka_timer, sizeof(ka_timer),
- up->t_ka_timer);
- pim_time_timer_to_hhmmss(msdp_reg_timer, sizeof(msdp_reg_timer),
- up->t_msdp_reg_timer);
-
- pim_upstream_state2brief_str(up->join_state, state_str, sizeof(state_str));
- if (up->reg_state != PIM_REG_NOINFO) {
- char tmp_str[PIM_REG_STATE_STR_LEN];
- char tmp[sizeof(state_str) + 1];
-
- snprintf(tmp, sizeof(tmp), ",%s",
- pim_reg_state2brief_str(up->reg_state, tmp_str,
- sizeof(tmp_str)));
- strlcat(state_str, tmp, sizeof(state_str));
- }
-
- if (uj) {
- char grp_str[PIM_ADDRSTRLEN];
- char src_str[PIM_ADDRSTRLEN];
-
- snprintfrr(grp_str, sizeof(grp_str), "%pPAs",
- &up->sg.grp);
- snprintfrr(src_str, sizeof(src_str), "%pPAs",
- &up->sg.src);
-
- 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_pim_upstream_add(json_row, up);
- json_object_string_add(
- json_row, "inboundInterface",
- up->rpf.source_nexthop.interface
- ? up->rpf.source_nexthop.interface->name
- : "Unknown");
-
- /*
- * The RPF address we use is slightly different
- * based upon what we are looking up.
- * If we have a S, list that unless
- * we are the FHR, else we just put
- * the RP as the rpfAddress
- */
- if (up->flags & PIM_UPSTREAM_FLAG_MASK_FHR ||
- pim_addr_is_any(up->sg.src)) {
- char rpf[PREFIX_STRLEN];
- struct pim_rpf *rpg;
-
- rpg = RP(pim, up->sg.grp);
- pim_inet4_dump("<rpf?>",
- rpg->rpf_addr.u.prefix4, rpf,
- sizeof(rpf));
- json_object_string_add(json_row, "rpfAddress",
- rpf);
- } else {
- json_object_string_add(json_row, "rpfAddress",
- src_str);
- }
-
- json_object_string_add(json_row, "source", src_str);
- json_object_string_add(json_row, "group", grp_str);
- json_object_string_add(json_row, "state", state_str);
- json_object_string_add(
- json_row, "joinState",
- pim_upstream_state2str(up->join_state));
- json_object_string_add(
- json_row, "regState",
- pim_reg_state2str(up->reg_state, state_str, sizeof(state_str)));
- json_object_string_add(json_row, "upTime", uptime);
- json_object_string_add(json_row, "joinTimer",
- join_timer);
- json_object_string_add(json_row, "resetTimer",
- rs_timer);
- json_object_string_add(json_row, "keepaliveTimer",
- ka_timer);
- json_object_string_add(json_row, "msdpRegTimer",
- msdp_reg_timer);
- json_object_int_add(json_row, "refCount",
- up->ref_count);
- json_object_int_add(json_row, "sptBit", up->sptbit);
- json_object_object_add(json_group, src_str, json_row);
- } else {
- vty_out(vty,
- "%-16s%-15pPAs %-15pPAs %-11s %-8s %-9s %-9s %-9s %6d\n",
- up->rpf.source_nexthop.interface
- ? up->rpf.source_nexthop.interface->name
- : "Unknown",
- &up->sg.src, &up->sg.grp, state_str, uptime,
- join_timer, rs_timer, ka_timer, up->ref_count);
- }
- }
-
- if (uj)
- vty_json(vty, json);
-}
-
-static void pim_show_channel_helper(struct pim_instance *pim,
- struct vty *vty,
- struct pim_interface *pim_ifp,
- struct pim_ifchannel *ch,
- json_object *json, bool uj)
-{
- struct pim_upstream *up = ch->upstream;
- json_object *json_group = NULL;
- json_object *json_row = NULL;
-
- if (uj) {
- char grp_str[PIM_ADDRSTRLEN];
- char src_str[PIM_ADDRSTRLEN];
-
- snprintfrr(grp_str, sizeof(grp_str), "%pPAs", &up->sg.grp);
- snprintfrr(src_str, sizeof(src_str), "%pPAs", &up->sg.src);
-
- 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_pim_upstream_add(json_row, up);
- json_object_string_add(json_row, "interface",
- ch->interface->name);
- json_object_string_add(json_row, "source", src_str);
- json_object_string_add(json_row, "group", grp_str);
-
- if (pim_macro_ch_lost_assert(ch))
- json_object_boolean_true_add(json_row, "lostAssert");
-
- if (pim_macro_chisin_joins(ch))
- json_object_boolean_true_add(json_row, "joins");
-
- if (pim_macro_chisin_pim_include(ch))
- json_object_boolean_true_add(json_row, "pimInclude");
-
- if (pim_upstream_evaluate_join_desired(pim, up))
- json_object_boolean_true_add(json_row,
- "evaluateJoinDesired");
-
- json_object_object_add(json_group, src_str, json_row);
-
- } else {
- vty_out(vty, "%-16s %-15pPAs %-15pPAs %-10s %-5s %-10s %-11s %-6s\n",
- ch->interface->name, &up->sg.src, &up->sg.grp,
- pim_macro_ch_lost_assert(ch) ? "yes" : "no",
- pim_macro_chisin_joins(ch) ? "yes" : "no",
- pim_macro_chisin_pim_include(ch) ? "yes" : "no",
- PIM_UPSTREAM_FLAG_TEST_DR_JOIN_DESIRED(up->flags)
- ? "yes"
- : "no",
- pim_upstream_evaluate_join_desired(pim, up) ? "yes"
- : "no");
- }
-}
-
-static void pim_show_channel(struct pim_instance *pim, struct vty *vty,
- bool uj)
-{
- struct pim_interface *pim_ifp;
- struct pim_ifchannel *ch;
- struct interface *ifp;
-
- json_object *json = NULL;
-
- if (uj)
- json = json_object_new_object();
- else
- vty_out(vty,
- "Interface Source Group LostAssert Joins PimInclude JoinDesired EvalJD\n");
-
- /* scan per-interface (S,G) state */
- FOR_ALL_INTERFACES (pim->vrf, ifp) {
- pim_ifp = ifp->info;
- if (!pim_ifp)
- continue;
-
-
- RB_FOREACH (ch, pim_ifchannel_rb, &pim_ifp->ifchannel_rb) {
- /* scan all interfaces */
- pim_show_channel_helper(pim, vty, pim_ifp, ch,
- json, uj);
- }
- }
-
- if (uj)
- vty_json(vty, json);
-}
-
-static void pim_show_join_desired_helper(struct pim_instance *pim,
- struct vty *vty,
- struct pim_upstream *up,
- json_object *json, bool uj)
-{
- json_object *json_group = NULL;
- json_object *json_row = NULL;
-
- if (uj) {
- char grp_str[PIM_ADDRSTRLEN];
- char src_str[PIM_ADDRSTRLEN];
-
- snprintfrr(grp_str, sizeof(grp_str), "%pPAs", &up->sg.grp);
- snprintfrr(src_str, sizeof(src_str), "%pPAs", &up->sg.src);
-
- 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_pim_upstream_add(json_row, up);
- json_object_string_add(json_row, "source", src_str);
- json_object_string_add(json_row, "group", grp_str);
-
- if (pim_upstream_evaluate_join_desired(pim, up))
- json_object_boolean_true_add(json_row,
- "evaluateJoinDesired");
-
- json_object_object_add(json_group, src_str, json_row);
-
- } else {
- vty_out(vty, "%-15pPAs %-15pPAs %-6s\n",
- &up->sg.src, &up->sg.grp,
- pim_upstream_evaluate_join_desired(pim, up) ? "yes"
- : "no");
- }
-}
-
-static void pim_show_join_desired(struct pim_instance *pim, struct vty *vty,
- bool uj)
-{
- struct pim_upstream *up;
-
- json_object *json = NULL;
-
- if (uj)
- json = json_object_new_object();
- else
- vty_out(vty,
- "Source Group EvalJD\n");
-
- frr_each (rb_pim_upstream, &pim->upstream_head, up) {
- /* scan all interfaces */
- pim_show_join_desired_helper(pim, vty, up,
- json, uj);
- }
-
- if (uj)
- vty_json(vty, json);
-}
-
-static void pim_show_upstream_rpf(struct pim_instance *pim, struct vty *vty,
- bool uj)
-{
- struct pim_upstream *up;
- json_object *json = NULL;
- json_object *json_group = NULL;
- json_object *json_row = NULL;
-
- if (uj)
- json = json_object_new_object();
- else
- vty_out(vty,
- "Source Group RpfIface RibNextHop RpfAddress \n");
-
- frr_each (rb_pim_upstream, &pim->upstream_head, up) {
- char rpf_nexthop_str[PREFIX_STRLEN];
- char rpf_addr_str[PREFIX_STRLEN];
- struct pim_rpf *rpf;
- const char *rpf_ifname;
-
- rpf = &up->rpf;
-
- pim_addr_dump("<nexthop?>",
- &rpf->source_nexthop.mrib_nexthop_addr,
- rpf_nexthop_str, sizeof(rpf_nexthop_str));
- pim_addr_dump("<rpf?>", &rpf->rpf_addr, rpf_addr_str,
- sizeof(rpf_addr_str));
-
- rpf_ifname = rpf->source_nexthop.interface ? rpf->source_nexthop.interface->name : "<ifname?>";
-
- if (uj) {
- char grp_str[PIM_ADDRSTRLEN];
- char src_str[PIM_ADDRSTRLEN];
-
- snprintfrr(grp_str, sizeof(grp_str), "%pPAs",
- &up->sg.grp);
- snprintfrr(src_str, sizeof(src_str), "%pPAs",
- &up->sg.src);
-
- 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_pim_upstream_add(json_row, up);
- json_object_string_add(json_row, "source", src_str);
- json_object_string_add(json_row, "group", grp_str);
- json_object_string_add(json_row, "rpfInterface",
- rpf_ifname);
- json_object_string_add(json_row, "ribNexthop",
- rpf_nexthop_str);
- json_object_string_add(json_row, "rpfAddress",
- rpf_addr_str);
- json_object_object_add(json_group, src_str, json_row);
- } else {
- vty_out(vty, "%-15pPAs %-15pPAs %-16s %-15s %-15s\n",
- &up->sg.src, &up->sg.grp, rpf_ifname,
- rpf_nexthop_str, rpf_addr_str);
- }
- }
-
- if (uj)
- vty_json(vty, json);
-}
-
-static void show_rpf_refresh_stats(struct vty *vty, struct pim_instance *pim,
- time_t now, json_object *json)
-{
- char refresh_uptime[10];
-
- pim_time_uptime_begin(refresh_uptime, sizeof(refresh_uptime), now,
- pim->rpf_cache_refresh_last);
-
- if (json) {
- json_object_int_add(json, "rpfCacheRefreshDelayMsecs",
- router->rpf_cache_refresh_delay_msec);
- json_object_int_add(
- json, "rpfCacheRefreshTimer",
- pim_time_timer_remain_msec(pim->rpf_cache_refresher));
- json_object_int_add(json, "rpfCacheRefreshRequests",
- pim->rpf_cache_refresh_requests);
- json_object_int_add(json, "rpfCacheRefreshEvents",
- pim->rpf_cache_refresh_events);
- json_object_string_add(json, "rpfCacheRefreshLast",
- refresh_uptime);
- json_object_int_add(json, "nexthopLookups",
- pim->nexthop_lookups);
- json_object_int_add(json, "nexthopLookupsAvoided",
- pim->nexthop_lookups_avoided);
- } else {
- vty_out(vty,
- "RPF Cache Refresh Delay: %ld msecs\n"
- "RPF Cache Refresh Timer: %ld msecs\n"
- "RPF Cache Refresh Requests: %lld\n"
- "RPF Cache Refresh Events: %lld\n"
- "RPF Cache Refresh Last: %s\n"
- "Nexthop Lookups: %lld\n"
- "Nexthop Lookups Avoided: %lld\n",
- router->rpf_cache_refresh_delay_msec,
- pim_time_timer_remain_msec(pim->rpf_cache_refresher),
- (long long)pim->rpf_cache_refresh_requests,
- (long long)pim->rpf_cache_refresh_events,
- refresh_uptime, (long long)pim->nexthop_lookups,
- (long long)pim->nexthop_lookups_avoided);
- }
-}
-
static void show_scan_oil_stats(struct pim_instance *pim, struct vty *vty,
time_t now)
{
@@ -2919,129 +1043,6 @@ static void show_scan_oil_stats(struct pim_instance *pim, struct vty *vty,
uptime_mroute_del, (long long)pim->mroute_del_events);
}
-static void pim_show_rpf(struct pim_instance *pim, struct vty *vty, bool uj)
-{
- struct pim_upstream *up;
- time_t now = pim_time_monotonic_sec();
- json_object *json = NULL;
- json_object *json_group = NULL;
- json_object *json_row = NULL;
-
- if (uj) {
- json = json_object_new_object();
- show_rpf_refresh_stats(vty, pim, now, json);
- } else {
- show_rpf_refresh_stats(vty, pim, now, json);
- vty_out(vty, "\n");
- vty_out(vty,
- "Source Group RpfIface RpfAddress RibNextHop Metric Pref\n");
- }
-
- frr_each (rb_pim_upstream, &pim->upstream_head, up) {
- char rpf_addr_str[PREFIX_STRLEN];
- char rib_nexthop_str[PREFIX_STRLEN];
- const char *rpf_ifname;
- struct pim_rpf *rpf = &up->rpf;
-
- pim_addr_dump("<rpf?>", &rpf->rpf_addr, rpf_addr_str,
- sizeof(rpf_addr_str));
- pim_addr_dump("<nexthop?>",
- &rpf->source_nexthop.mrib_nexthop_addr,
- rib_nexthop_str, sizeof(rib_nexthop_str));
-
- rpf_ifname = rpf->source_nexthop.interface ? rpf->source_nexthop.interface->name : "<ifname?>";
-
- if (uj) {
- char grp_str[PIM_ADDRSTRLEN];
- char src_str[PIM_ADDRSTRLEN];
-
- snprintfrr(grp_str, sizeof(grp_str), "%pPAs",
- &up->sg.grp);
- snprintfrr(src_str, sizeof(src_str), "%pPAs",
- &up->sg.src);
-
- 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);
- json_object_string_add(json_row, "rpfInterface",
- rpf_ifname);
- json_object_string_add(json_row, "rpfAddress",
- rpf_addr_str);
- json_object_string_add(json_row, "ribNexthop",
- rib_nexthop_str);
- json_object_int_add(
- json_row, "routeMetric",
- rpf->source_nexthop.mrib_route_metric);
- json_object_int_add(
- json_row, "routePreference",
- rpf->source_nexthop.mrib_metric_preference);
- json_object_object_add(json_group, src_str, json_row);
-
- } else {
- vty_out(vty, "%-15pPAs %-15pPAs %-16s %-15s %-15s %6d %4d\n",
- &up->sg.src, &up->sg.grp, rpf_ifname,
- rpf_addr_str, rib_nexthop_str,
- rpf->source_nexthop.mrib_route_metric,
- rpf->source_nexthop.mrib_metric_preference);
- }
- }
-
- if (uj)
- vty_json(vty, json);
-}
-
-struct pnc_cache_walk_data {
- struct vty *vty;
- struct pim_instance *pim;
-};
-
-static int pim_print_pnc_cache_walkcb(struct hash_bucket *bucket, void *arg)
-{
- struct pim_nexthop_cache *pnc = bucket->data;
- struct pnc_cache_walk_data *cwd = arg;
- struct vty *vty = cwd->vty;
- struct pim_instance *pim = cwd->pim;
- struct nexthop *nh_node = NULL;
- ifindex_t first_ifindex;
- struct interface *ifp = NULL;
- char buf[PREFIX_STRLEN];
-
- for (nh_node = pnc->nexthop; nh_node; nh_node = nh_node->next) {
- first_ifindex = nh_node->ifindex;
- ifp = if_lookup_by_index(first_ifindex, pim->vrf->vrf_id);
-
- vty_out(vty, "%-15s ", inet_ntop(AF_INET,
- &pnc->rpf.rpf_addr.u.prefix4,
- buf, sizeof(buf)));
- vty_out(vty, "%-16s ", ifp ? ifp->name : "NULL");
- vty_out(vty, "%pI4 ", &nh_node->gate.ipv4);
- vty_out(vty, "\n");
- }
- return CMD_SUCCESS;
-}
-
-static void pim_show_nexthop(struct pim_instance *pim, struct vty *vty)
-{
- struct pnc_cache_walk_data cwd;
-
- cwd.vty = vty;
- cwd.pim = pim;
- vty_out(vty, "Number of registered addresses: %lu\n",
- pim->rpf_hash->count);
- vty_out(vty, "Address Interface Nexthop\n");
- vty_out(vty, "---------------------------------------------\n");
-
- hash_walk(pim->rpf_hash, pim_print_pnc_cache_walkcb, &cwd);
-}
-
/* Display the bsm database details */
static void pim_show_bsm_db(struct pim_instance *pim, struct vty *vty, bool uj)
{
@@ -3325,78 +1326,6 @@ static void pim_show_group_rp_mappings_info(struct pim_instance *pim,
vty_json(vty, json);
}
-/* pim statistics - just adding only bsm related now.
- * We can continue to add all pim related stats here.
- */
-static void pim_show_statistics(struct pim_instance *pim, struct vty *vty,
- const char *ifname, bool uj)
-{
- json_object *json = NULL;
- struct interface *ifp;
-
- if (uj) {
- json = json_object_new_object();
- 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");
- vty_out(vty, "Number of Received BSMs : %" PRIu64 "\n",
- pim->bsm_rcvd);
- vty_out(vty, "Number of Forwared BSMs : %" PRIu64 "\n",
- pim->bsm_sent);
- vty_out(vty, "Number of Dropped BSMs : %" PRIu64 "\n",
- pim->bsm_dropped);
- }
-
- vty_out(vty, "\n");
-
- /* scan interfaces */
- FOR_ALL_INTERFACES (pim->vrf, ifp) {
- struct pim_interface *pim_ifp = ifp->info;
-
- if (ifname && strcmp(ifname, ifp->name))
- continue;
-
- if (!pim_ifp)
- continue;
-
- if (!uj) {
- vty_out(vty, "Interface : %s\n", ifp->name);
- vty_out(vty, "-------------------\n");
- vty_out(vty,
- "Number of BSMs dropped due to config miss : %u\n",
- pim_ifp->pim_ifstat_bsm_cfg_miss);
- vty_out(vty, "Number of unicast BSMs dropped : %u\n",
- pim_ifp->pim_ifstat_ucast_bsm_cfg_miss);
- vty_out(vty,
- "Number of BSMs dropped due to invalid scope zone : %u\n",
- pim_ifp->pim_ifstat_bsm_invalid_sz);
- } else {
-
- json_object *json_row = NULL;
-
- 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, "bsmDroppedUnicast",
- pim_ifp->pim_ifstat_ucast_bsm_cfg_miss);
- json_object_int_add(json_row,
- "bsmDroppedInvalidScopeZone",
- pim_ifp->pim_ifstat_bsm_invalid_sz);
- json_object_object_add(json, ifp->name, json_row);
- }
- vty_out(vty, "\n");
- }
-
- if (uj)
- vty_json(vty, json);
-}
-
static void clear_pim_statistics(struct pim_instance *pim)
{
struct interface *ifp;
@@ -4570,9 +2499,9 @@ DEFUN (show_ip_pim_assert_winner_metric,
return CMD_SUCCESS;
}
-DEFUN (show_ip_pim_interface,
+DEFPY (show_ip_pim_interface,
show_ip_pim_interface_cmd,
- "show ip pim [mlag] [vrf NAME] interface [detail|WORD] [json]",
+ "show ip pim [mlag$mlag] [vrf NAME] interface [detail|WORD]$interface [json$json]",
SHOW_STR
IP_STR
PIM_STR
@@ -4583,30 +2512,34 @@ DEFUN (show_ip_pim_interface,
"interface name\n"
JSON_STR)
{
- int idx = 2;
- struct vrf *vrf = pim_cmd_lookup_vrf(vty, argv, argc, &idx);
- bool uj = use_json(argc, argv);
- bool mlag = false;
+ struct vrf *v;
+ bool uj = !!json;
+ bool is_mlag = !!mlag;
+ json_object *json_parent = NULL;
- if (!vrf)
+ v = vrf_lookup_by_name(vrf ? vrf : VRF_DEFAULT_NAME);
+
+ if (!v)
return CMD_WARNING;
- if (argv_find(argv, argc, "mlag", &idx))
- mlag = true;
+ if (uj)
+ json_parent = json_object_new_object();
- if (argv_find(argv, argc, "WORD", &idx)
- || argv_find(argv, argc, "detail", &idx))
- pim_show_interfaces_single(vrf->info, vty, argv[idx]->arg, mlag,
- uj);
+ if (interface)
+ pim_show_interfaces_single(v->info, vty, interface, is_mlag,
+ json_parent);
else
- pim_show_interfaces(vrf->info, vty, mlag, uj);
+ pim_show_interfaces(v->info, vty, is_mlag, json_parent);
+
+ if (uj)
+ vty_json(vty, json_parent);
return CMD_SUCCESS;
}
-DEFUN (show_ip_pim_interface_vrf_all,
+DEFPY (show_ip_pim_interface_vrf_all,
show_ip_pim_interface_vrf_all_cmd,
- "show ip pim [mlag] vrf all interface [detail|WORD] [json]",
+ "show ip pim [mlag$mlag] vrf all interface [detail|WORD]$interface [json$json]",
SHOW_STR
IP_STR
PIM_STR
@@ -4617,35 +2550,32 @@ DEFUN (show_ip_pim_interface_vrf_all,
"interface name\n"
JSON_STR)
{
- 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;
+ bool uj = !!json;
+ bool is_mlag = !!mlag;
+ struct vrf *v;
+ json_object *json_parent = NULL;
+ json_object *json_vrf = NULL;
- idx = 6;
if (uj)
- vty_out(vty, "{ ");
- RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
- if (uj) {
- if (!first)
- vty_out(vty, ", ");
- vty_out(vty, " \"%s\": ", vrf->name);
- first = false;
- } else
- vty_out(vty, "VRF: %s\n", vrf->name);
- if (argv_find(argv, argc, "WORD", &idx)
- || argv_find(argv, argc, "detail", &idx))
- pim_show_interfaces_single(vrf->info, vty,
- argv[idx]->arg, mlag, uj);
+ json_parent = json_object_new_object();
+
+ RB_FOREACH (v, vrf_name_head, &vrfs_by_name) {
+ if (!uj)
+ vty_out(vty, "VRF: %s\n", v->name);
+ else
+ json_vrf = json_object_new_object();
+
+ if (interface)
+ pim_show_interfaces_single(v->info, vty, interface,
+ is_mlag, json_vrf);
else
- pim_show_interfaces(vrf->info, vty, mlag, uj);
+ pim_show_interfaces(v->info, vty, is_mlag, json_vrf);
+
+ if (uj)
+ json_object_object_add(json_parent, v->name, json_vrf);
}
if (uj)
- vty_out(vty, "}\n");
+ vty_json(vty, json_parent);
return CMD_SUCCESS;
}
@@ -4664,8 +2594,8 @@ DEFPY (show_ip_pim_join,
{
pim_sgaddr sg = {0};
struct vrf *v;
- bool uj = !!json;
struct pim_instance *pim;
+ json_object *json_parent = NULL;
v = vrf_lookup_by_name(vrf ? vrf : VRF_DEFAULT_NAME);
@@ -4688,14 +2618,20 @@ DEFPY (show_ip_pim_join,
sg.grp = s_or_g;
}
- pim_show_join(pim, vty, &sg, uj);
+ if (json)
+ json_parent = json_object_new_object();
+
+ pim_show_join(pim, vty, &sg, json_parent);
+
+ if (json)
+ vty_json(vty, json_parent);
return CMD_SUCCESS;
}
-DEFUN (show_ip_pim_join_vrf_all,
+DEFPY (show_ip_pim_join_vrf_all,
show_ip_pim_join_vrf_all_cmd,
- "show ip pim vrf all join [json]",
+ "show ip pim vrf all join [json$json]",
SHOW_STR
IP_STR
PIM_STR
@@ -4704,77 +2640,29 @@ DEFUN (show_ip_pim_join_vrf_all,
JSON_STR)
{
pim_sgaddr sg = {0};
- bool uj = use_json(argc, argv);
- struct vrf *vrf;
- bool first = true;
+ struct vrf *vrf_struct;
+ json_object *json_parent = NULL;
+ json_object *json_vrf = NULL;
- if (uj)
- vty_out(vty, "{ ");
- RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
- if (uj) {
- if (!first)
- vty_out(vty, ", ");
- vty_out(vty, " \"%s\": ", vrf->name);
- first = false;
- } else
- vty_out(vty, "VRF: %s\n", vrf->name);
- pim_show_join(vrf->info, vty, &sg, uj);
+ if (json)
+ json_parent = json_object_new_object();
+ RB_FOREACH (vrf_struct, vrf_name_head, &vrfs_by_name) {
+ if (!json)
+ vty_out(vty, "VRF: %s\n", vrf_struct->name);
+ else
+ json_vrf = json_object_new_object();
+ pim_show_join(vrf_struct->info, vty, &sg, json_vrf);
+
+ if (json)
+ json_object_object_add(json_parent, vrf_struct->name,
+ json_vrf);
}
- if (uj)
- vty_out(vty, "}\n");
+ if (json)
+ vty_json(vty, json_parent);
return CMD_WARNING;
}
-static void pim_show_jp_agg_helper(struct vty *vty,
- struct interface *ifp,
- struct pim_neighbor *neigh,
- struct pim_upstream *up,
- int is_join)
-{
- char rpf_str[INET_ADDRSTRLEN];
-
- /* pius->address.s_addr */
- pim_inet4_dump("<rpf?>", neigh->source_addr, rpf_str, sizeof(rpf_str));
-
- vty_out(vty, "%-16s %-15s %-15pPAs %-15pPAs %5s\n", ifp->name, rpf_str,
- &up->sg.src, &up->sg.grp, is_join ? "J" : "P");
-}
-
-static void pim_show_jp_agg_list(struct pim_instance *pim, struct vty *vty)
-{
- struct interface *ifp;
- struct pim_interface *pim_ifp;
- struct listnode *n_node;
- struct pim_neighbor *neigh;
- struct listnode *jag_node;
- struct pim_jp_agg_group *jag;
- struct listnode *js_node;
- struct pim_jp_sources *js;
-
- vty_out(vty,
- "Interface RPF Nbr Source Group State\n");
-
- FOR_ALL_INTERFACES (pim->vrf, ifp) {
- pim_ifp = ifp->info;
- if (!pim_ifp)
- continue;
-
- for (ALL_LIST_ELEMENTS_RO(pim_ifp->pim_neighbor_list,
- n_node, neigh)) {
- for (ALL_LIST_ELEMENTS_RO(neigh->upstream_jp_agg,
- jag_node, jag)) {
- for (ALL_LIST_ELEMENTS_RO(jag->sources,
- js_node, js)) {
- pim_show_jp_agg_helper(vty,
- ifp, neigh, js->up,
- js->is_join);
- }
- }
- }
- }
-}
-
DEFPY (show_ip_pim_jp_agg,
show_ip_pim_jp_agg_cmd,
"show ip pim [vrf NAME] jp-agg",
@@ -4805,9 +2693,9 @@ DEFPY (show_ip_pim_jp_agg,
return CMD_SUCCESS;
}
-DEFUN (show_ip_pim_local_membership,
+DEFPY (show_ip_pim_local_membership,
show_ip_pim_local_membership_cmd,
- "show ip pim [vrf NAME] local-membership [json]",
+ "show ip pim [vrf NAME] local-membership [json$json]",
SHOW_STR
IP_STR
PIM_STR
@@ -4815,14 +2703,15 @@ DEFUN (show_ip_pim_local_membership,
"PIM interface local-membership\n"
JSON_STR)
{
- int idx = 2;
- struct vrf *vrf = pim_cmd_lookup_vrf(vty, argv, argc, &idx);
- bool uj = use_json(argc, argv);
+ struct vrf *v;
+ bool uj = !!json;
- if (!vrf)
+ v = vrf_lookup_by_name(vrf ? vrf : VRF_DEFAULT_NAME);
+
+ if (!v)
return CMD_WARNING;
- pim_show_membership(vrf->info, vty, uj);
+ pim_show_membership(v->info, vty, uj);
return CMD_SUCCESS;
}
@@ -5094,9 +2983,9 @@ DEFUN(show_ip_pim_mlag_up_vrf_all, show_ip_pim_mlag_up_vrf_all_cmd,
return CMD_SUCCESS;
}
-DEFUN (show_ip_pim_neighbor,
+DEFPY (show_ip_pim_neighbor,
show_ip_pim_neighbor_cmd,
- "show ip pim [vrf NAME] neighbor [detail|WORD] [json]",
+ "show ip pim [vrf NAME] neighbor [detail|WORD]$interface [json$json]",
SHOW_STR
IP_STR
PIM_STR
@@ -5106,25 +2995,31 @@ DEFUN (show_ip_pim_neighbor,
"Name of interface or neighbor\n"
JSON_STR)
{
- int idx = 2;
- struct vrf *vrf = pim_cmd_lookup_vrf(vty, argv, argc, &idx);
- bool uj = use_json(argc, argv);
+ struct vrf *v;
+ json_object *json_parent = NULL;
- if (!vrf)
+ v = vrf_lookup_by_name(vrf ? vrf : VRF_DEFAULT_NAME);
+
+ if (!v)
return CMD_WARNING;
- if (argv_find(argv, argc, "detail", &idx)
- || argv_find(argv, argc, "WORD", &idx))
- pim_show_neighbors_single(vrf->info, vty, argv[idx]->arg, uj);
+ if (json)
+ json_parent = json_object_new_object();
+
+ if (interface)
+ pim_show_neighbors_single(v->info, vty, interface, json_parent);
else
- pim_show_neighbors(vrf->info, vty, uj);
+ pim_show_neighbors(v->info, vty, json_parent);
+
+ if (json)
+ vty_json(vty, json_parent);
return CMD_SUCCESS;
}
-DEFUN (show_ip_pim_neighbor_vrf_all,
+DEFPY (show_ip_pim_neighbor_vrf_all,
show_ip_pim_neighbor_vrf_all_cmd,
- "show ip pim vrf all neighbor [detail|WORD] [json]",
+ "show ip pim vrf all neighbor [detail|WORD]$interface [json$json]",
SHOW_STR
IP_STR
PIM_STR
@@ -5134,35 +3029,34 @@ DEFUN (show_ip_pim_neighbor_vrf_all,
"Name of interface or neighbor\n"
JSON_STR)
{
- int idx = 2;
- bool uj = use_json(argc, argv);
- struct vrf *vrf;
- bool first = true;
+ struct vrf *v;
+ json_object *json_parent = NULL;
+ json_object *json_vrf = NULL;
- if (uj)
- vty_out(vty, "{ ");
- RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
- if (uj) {
- if (!first)
- vty_out(vty, ", ");
- vty_out(vty, " \"%s\": ", vrf->name);
- first = false;
- } else
- vty_out(vty, "VRF: %s\n", vrf->name);
- if (argv_find(argv, argc, "detail", &idx)
- || argv_find(argv, argc, "WORD", &idx))
- pim_show_neighbors_single(vrf->info, vty,
- argv[idx]->arg, uj);
+ if (json)
+ json_parent = json_object_new_object();
+ RB_FOREACH (v, vrf_name_head, &vrfs_by_name) {
+ if (!json)
+ vty_out(vty, "VRF: %s\n", v->name);
+ else
+ json_vrf = json_object_new_object();
+
+ if (interface)
+ pim_show_neighbors_single(v->info, vty, interface,
+ json_vrf);
else
- pim_show_neighbors(vrf->info, vty, uj);
+ pim_show_neighbors(v->info, vty, json_vrf);
+
+ if (json)
+ json_object_object_add(json_parent, v->name, json_vrf);
}
- if (uj)
- vty_out(vty, "}\n");
+ if (json)
+ vty_json(vty, json_parent);
return CMD_SUCCESS;
}
-DEFUN (show_ip_pim_secondary,
+DEFPY (show_ip_pim_secondary,
show_ip_pim_secondary_cmd,
"show ip pim [vrf NAME] secondary",
SHOW_STR
@@ -5171,20 +3065,29 @@ DEFUN (show_ip_pim_secondary,
VRF_CMD_HELP_STR
"PIM neighbor addresses\n")
{
- int idx = 2;
- struct vrf *vrf = pim_cmd_lookup_vrf(vty, argv, argc, &idx);
+ struct pim_instance *pim;
+ struct vrf *v;
- if (!vrf)
+ v = vrf_lookup_by_name(vrf ? vrf : VRF_DEFAULT_NAME);
+
+ if (!v)
return CMD_WARNING;
- pim_show_neighbors_secondary(vrf->info, vty);
+ pim = pim_get_pim_instance(v->vrf_id);
+
+ if (!pim) {
+ vty_out(vty, "%% Unable to find pim instance\n");
+ return CMD_WARNING;
+ }
+
+ pim_show_neighbors_secondary(pim, vty);
return CMD_SUCCESS;
}
-DEFUN (show_ip_pim_state,
+DEFPY (show_ip_pim_state,
show_ip_pim_state_cmd,
- "show ip pim [vrf NAME] state [A.B.C.D [A.B.C.D]] [json]",
+ "show ip pim [vrf NAME] state [A.B.C.D$s_or_g [A.B.C.D$g]] [json$json]",
SHOW_STR
IP_STR
PIM_STR
@@ -5194,32 +3097,36 @@ DEFUN (show_ip_pim_state,
"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);
+ struct pim_instance *pim;
+ struct vrf *v;
+ json_object *json_parent = NULL;
- if (!vrf)
+ v = vrf_lookup_by_name(vrf ? vrf : VRF_DEFAULT_NAME);
+
+ if (!v)
return CMD_WARNING;
- if (uj)
- argc--;
+ pim = pim_get_pim_instance(v->vrf_id);
- 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;
+ if (!pim) {
+ vty_out(vty, "%% Unable to find pim instance\n");
+ return CMD_WARNING;
}
- pim_show_state(vrf->info, vty, src_or_group, group, uj);
+ if (json)
+ json_parent = json_object_new_object();
+
+ pim_show_state(pim, vty, s_or_g_str, g_str, json_parent);
+
+ if (json)
+ vty_json(vty, json_parent);
return CMD_SUCCESS;
}
-DEFUN (show_ip_pim_state_vrf_all,
+DEFPY (show_ip_pim_state_vrf_all,
show_ip_pim_state_vrf_all_cmd,
- "show ip pim vrf all state [A.B.C.D [A.B.C.D]] [json]",
+ "show ip pim vrf all state [A.B.C.D$s_or_g [A.B.C.D$g]] [json$json]",
SHOW_STR
IP_STR
PIM_STR
@@ -5229,36 +3136,25 @@ DEFUN (show_ip_pim_state_vrf_all,
"Multicast address\n"
JSON_STR)
{
- const char *src_or_group = NULL;
- const char *group = NULL;
- int idx = 2;
- bool uj = use_json(argc, argv);
struct vrf *vrf;
- bool first = true;
-
- if (uj) {
- vty_out(vty, "{ ");
- argc--;
- }
+ json_object *json_parent = NULL;
+ json_object *json_vrf = NULL;
- 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;
- }
+ if (json)
+ json_parent = json_object_new_object();
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
- if (uj) {
- if (!first)
- vty_out(vty, ", ");
- vty_out(vty, " \"%s\": ", vrf->name);
- first = false;
- } else
+ if (!json)
vty_out(vty, "VRF: %s\n", vrf->name);
- pim_show_state(vrf->info, vty, src_or_group, group, uj);
+ else
+ json_vrf = json_object_new_object();
+ pim_show_state(vrf->info, vty, s_or_g_str, g_str, json_vrf);
+ if (json)
+ json_object_object_add(json_parent, vrf->name,
+ json_vrf);
}
- if (uj)
- vty_out(vty, "}\n");
+ if (json)
+ vty_json(vty, json_parent);
return CMD_SUCCESS;
}
@@ -5279,6 +3175,7 @@ DEFPY (show_ip_pim_upstream,
struct vrf *v;
bool uj = !!json;
struct pim_instance *pim;
+ json_object *json_parent = NULL;
v = vrf_lookup_by_name(vrf ? vrf : VRF_DEFAULT_NAME);
@@ -5293,6 +3190,9 @@ DEFPY (show_ip_pim_upstream,
return CMD_WARNING;
}
+ if (uj)
+ json_parent = json_object_new_object();
+
if (s_or_g.s_addr != INADDR_ANY) {
if (g.s_addr != INADDR_ANY) {
sg.src = s_or_g;
@@ -5300,14 +3200,17 @@ DEFPY (show_ip_pim_upstream,
} else
sg.grp = s_or_g;
}
- pim_show_upstream(pim, vty, &sg, uj);
+ pim_show_upstream(pim, vty, &sg, json_parent);
+
+ if (uj)
+ vty_json(vty, json_parent);
return CMD_SUCCESS;
}
-DEFUN (show_ip_pim_upstream_vrf_all,
+DEFPY (show_ip_pim_upstream_vrf_all,
show_ip_pim_upstream_vrf_all_cmd,
- "show ip pim vrf all upstream [json]",
+ "show ip pim vrf all upstream [json$json]",
SHOW_STR
IP_STR
PIM_STR
@@ -5316,29 +3219,33 @@ DEFUN (show_ip_pim_upstream_vrf_all,
JSON_STR)
{
pim_sgaddr sg = {0};
- bool uj = use_json(argc, argv);
struct vrf *vrf;
- bool first = true;
+ json_object *json_parent = NULL;
+ json_object *json_vrf = NULL;
+
+ if (json)
+ json_parent = json_object_new_object();
- if (uj)
- vty_out(vty, "{ ");
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
- if (uj) {
- if (!first)
- vty_out(vty, ", ");
- vty_out(vty, " \"%s\": ", vrf->name);
- first = false;
- } else
+ if (!json)
vty_out(vty, "VRF: %s\n", vrf->name);
- pim_show_upstream(vrf->info, vty, &sg, uj);
+ else
+ json_vrf = json_object_new_object();
+ pim_show_upstream(vrf->info, vty, &sg, json_vrf);
+ if (json)
+ json_object_object_add(json_parent, vrf->name,
+ json_vrf);
}
+ if (json)
+ vty_json(vty, json_parent);
+
return CMD_SUCCESS;
}
-DEFUN (show_ip_pim_channel,
+DEFPY (show_ip_pim_channel,
show_ip_pim_channel_cmd,
- "show ip pim [vrf NAME] channel [json]",
+ "show ip pim [vrf NAME] channel [json$json]",
SHOW_STR
IP_STR
PIM_STR
@@ -5346,21 +3253,22 @@ DEFUN (show_ip_pim_channel,
"PIM downstream channel info\n"
JSON_STR)
{
- int idx = 2;
- struct vrf *vrf = pim_cmd_lookup_vrf(vty, argv, argc, &idx);
- bool uj = use_json(argc, argv);
+ struct vrf *v;
+ bool uj = !!json;
- if (!vrf)
+ v = vrf_lookup_by_name(vrf ? vrf : VRF_DEFAULT_NAME);
+
+ if (!v)
return CMD_WARNING;
- pim_show_channel(vrf->info, vty, uj);
+ pim_show_channel(v->info, vty, uj);
return CMD_SUCCESS;
}
-DEFUN (show_ip_pim_upstream_join_desired,
+DEFPY (show_ip_pim_upstream_join_desired,
show_ip_pim_upstream_join_desired_cmd,
- "show ip pim [vrf NAME] upstream-join-desired [json]",
+ "show ip pim [vrf NAME] upstream-join-desired [json$json]",
SHOW_STR
IP_STR
PIM_STR
@@ -5368,21 +3276,30 @@ DEFUN (show_ip_pim_upstream_join_desired,
"PIM upstream join-desired\n"
JSON_STR)
{
- int idx = 2;
- struct vrf *vrf = pim_cmd_lookup_vrf(vty, argv, argc, &idx);
- bool uj = use_json(argc, argv);
+ struct pim_instance *pim;
+ struct vrf *v;
+ bool uj = !!json;
- if (!vrf)
+ v = vrf_lookup_by_name(vrf ? vrf : VRF_DEFAULT_NAME);
+
+ if (!v)
+ return CMD_WARNING;
+
+ pim = pim_get_pim_instance(v->vrf_id);
+
+ if (!pim) {
+ vty_out(vty, "%% Unable to find pim instance\n");
return CMD_WARNING;
+ }
- pim_show_join_desired(vrf->info, vty, uj);
+ pim_show_join_desired(pim, vty, uj);
return CMD_SUCCESS;
}
-DEFUN (show_ip_pim_upstream_rpf,
+DEFPY (show_ip_pim_upstream_rpf,
show_ip_pim_upstream_rpf_cmd,
- "show ip pim [vrf NAME] upstream-rpf [json]",
+ "show ip pim [vrf NAME] upstream-rpf [json$json]",
SHOW_STR
IP_STR
PIM_STR
@@ -5390,21 +3307,30 @@ DEFUN (show_ip_pim_upstream_rpf,
"PIM upstream source rpf\n"
JSON_STR)
{
- int idx = 2;
- struct vrf *vrf = pim_cmd_lookup_vrf(vty, argv, argc, &idx);
- bool uj = use_json(argc, argv);
+ struct pim_instance *pim;
+ struct vrf *v;
+ bool uj = !!json;
- if (!vrf)
+ v = vrf_lookup_by_name(vrf ? vrf : VRF_DEFAULT_NAME);
+
+ if (!v)
+ return CMD_WARNING;
+
+ pim = pim_get_pim_instance(v->vrf_id);
+
+ if (!pim) {
+ vty_out(vty, "%% Unable to find pim instance\n");
return CMD_WARNING;
+ }
- pim_show_upstream_rpf(vrf->info, vty, uj);
+ pim_show_upstream_rpf(pim, vty, uj);
return CMD_SUCCESS;
}
-DEFUN (show_ip_pim_rp,
+DEFPY (show_ip_pim_rp,
show_ip_pim_rp_cmd,
- "show ip pim [vrf NAME] rp-info [A.B.C.D/M] [json]",
+ "show ip pim [vrf NAME] rp-info [A.B.C.D/M$group] [json$json]",
SHOW_STR
IP_STR
PIM_STR
@@ -5413,28 +3339,45 @@ DEFUN (show_ip_pim_rp,
"Multicast Group range\n"
JSON_STR)
{
- int idx = 2;
- struct vrf *vrf = pim_cmd_lookup_vrf(vty, argv, argc, &idx);
- bool uj = use_json(argc, argv);
+ struct pim_instance *pim;
+ struct vrf *v;
+ json_object *json_parent = NULL;
struct prefix *range = NULL;
- if (!vrf)
+ v = vrf_lookup_by_name(vrf ? vrf : VRF_DEFAULT_NAME);
+
+ if (!v)
+ return CMD_WARNING;
+
+ pim = pim_get_pim_instance(v->vrf_id);
+
+ if (!pim) {
+ vty_out(vty, "%% Unable to find pim instance\n");
return CMD_WARNING;
+ }
- if (argv_find(argv, argc, "A.B.C.D/M", &idx)) {
+ if (group_str) {
range = prefix_new();
- (void)str2prefix(argv[idx]->arg, range);
+ prefix_copy(range, group);
apply_mask(range);
}
- pim_rp_show_information(vrf->info, range, vty, uj);
+ if (json)
+ json_parent = json_object_new_object();
+
+ pim_rp_show_information(pim, range, vty, json_parent);
+
+ if (json)
+ vty_json(vty, json_parent);
+
+ prefix_free(&range);
return CMD_SUCCESS;
}
-DEFUN (show_ip_pim_rp_vrf_all,
+DEFPY (show_ip_pim_rp_vrf_all,
show_ip_pim_rp_vrf_all_cmd,
- "show ip pim vrf all rp-info [A.B.C.D/M] [json]",
+ "show ip pim vrf all rp-info [A.B.C.D/M$group] [json$json]",
SHOW_STR
IP_STR
PIM_STR
@@ -5443,39 +3386,41 @@ DEFUN (show_ip_pim_rp_vrf_all,
"Multicast Group range\n"
JSON_STR)
{
- int idx = 0;
- bool uj = use_json(argc, argv);
struct vrf *vrf;
- bool first = true;
+ json_object *json_parent = NULL;
+ json_object *json_vrf = NULL;
struct prefix *range = NULL;
- if (argv_find(argv, argc, "A.B.C.D/M", &idx)) {
+ if (group_str) {
range = prefix_new();
- (void)str2prefix(argv[idx]->arg, range);
+ prefix_copy(range, group);
apply_mask(range);
}
- if (uj)
- vty_out(vty, "{ ");
+ if (json)
+ json_parent = json_object_new_object();
+
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
- if (uj) {
- if (!first)
- vty_out(vty, ", ");
- vty_out(vty, " \"%s\": ", vrf->name);
- first = false;
- } else
+ if (!json)
vty_out(vty, "VRF: %s\n", vrf->name);
- pim_rp_show_information(vrf->info, range, vty, uj);
+ else
+ json_vrf = json_object_new_object();
+ pim_rp_show_information(vrf->info, range, vty, json_vrf);
+ if (json)
+ json_object_object_add(json_parent, vrf->name,
+ json_vrf);
}
- if (uj)
- vty_out(vty, "}\n");
+ if (json)
+ vty_json(vty, json_parent);
+
+ prefix_free(&range);
return CMD_SUCCESS;
}
-DEFUN (show_ip_pim_rpf,
+DEFPY (show_ip_pim_rpf,
show_ip_pim_rpf_cmd,
- "show ip pim [vrf NAME] rpf [json]",
+ "show ip pim [vrf NAME] rpf [json$json]",
SHOW_STR
IP_STR
PIM_STR
@@ -5483,21 +3428,36 @@ DEFUN (show_ip_pim_rpf,
"PIM cached source rpf information\n"
JSON_STR)
{
- int idx = 2;
- struct vrf *vrf = pim_cmd_lookup_vrf(vty, argv, argc, &idx);
- bool uj = use_json(argc, argv);
+ struct pim_instance *pim;
+ struct vrf *v;
+ json_object *json_parent = NULL;
- if (!vrf)
+ v = vrf_lookup_by_name(vrf ? vrf : VRF_DEFAULT_NAME);
+
+ if (!v)
return CMD_WARNING;
- pim_show_rpf(vrf->info, vty, uj);
+ pim = pim_get_pim_instance(v->vrf_id);
+
+ if (!pim) {
+ vty_out(vty, "%% Unable to find pim instance\n");
+ return CMD_WARNING;
+ }
+
+ if (json)
+ json_parent = json_object_new_object();
+
+ pim_show_rpf(pim, vty, json_parent);
+
+ if (json)
+ vty_json(vty, json_parent);
return CMD_SUCCESS;
}
-DEFUN (show_ip_pim_rpf_vrf_all,
+DEFPY (show_ip_pim_rpf_vrf_all,
show_ip_pim_rpf_vrf_all_cmd,
- "show ip pim vrf all rpf [json]",
+ "show ip pim vrf all rpf [json$json]",
SHOW_STR
IP_STR
PIM_STR
@@ -5505,29 +3465,30 @@ DEFUN (show_ip_pim_rpf_vrf_all,
"PIM cached source rpf information\n"
JSON_STR)
{
- bool uj = use_json(argc, argv);
struct vrf *vrf;
- bool first = true;
+ json_object *json_parent = NULL;
+ json_object *json_vrf = NULL;
+
+ if (json)
+ json_parent = json_object_new_object();
- if (uj)
- vty_out(vty, "{ ");
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
- if (uj) {
- if (!first)
- vty_out(vty, ", ");
- vty_out(vty, " \"%s\": ", vrf->name);
- first = false;
- } else
+ if (!json)
vty_out(vty, "VRF: %s\n", vrf->name);
- pim_show_rpf(vrf->info, vty, uj);
+ else
+ json_vrf = json_object_new_object();
+ pim_show_rpf(vrf->info, vty, json_vrf);
+ if (json)
+ json_object_object_add(json_parent, vrf->name,
+ json_vrf);
}
- if (uj)
- vty_out(vty, "}\n");
+ if (json)
+ vty_json(vty, json_parent);
return CMD_SUCCESS;
}
-DEFUN (show_ip_pim_nexthop,
+DEFPY (show_ip_pim_nexthop,
show_ip_pim_nexthop_cmd,
"show ip pim [vrf NAME] nexthop",
SHOW_STR
@@ -5536,20 +3497,21 @@ DEFUN (show_ip_pim_nexthop,
VRF_CMD_HELP_STR
"PIM cached nexthop rpf information\n")
{
- int idx = 2;
- struct vrf *vrf = pim_cmd_lookup_vrf(vty, argv, argc, &idx);
+ struct vrf *v;
- if (!vrf)
+ v = vrf_lookup_by_name(vrf ? vrf : VRF_DEFAULT_NAME);
+
+ if (!v)
return CMD_WARNING;
- pim_show_nexthop(vrf->info, vty);
+ pim_show_nexthop(v->info, vty);
return CMD_SUCCESS;
}
-DEFUN (show_ip_pim_nexthop_lookup,
+DEFPY (show_ip_pim_nexthop_lookup,
show_ip_pim_nexthop_lookup_cmd,
- "show ip pim [vrf NAME] nexthop-lookup A.B.C.D A.B.C.D",
+ "show ip pim [vrf NAME] nexthop-lookup A.B.C.D$source A.B.C.D$group",
SHOW_STR
IP_STR
PIM_STR
@@ -5560,61 +3522,37 @@ DEFUN (show_ip_pim_nexthop_lookup,
{
struct prefix nht_p;
int result = 0;
- struct in_addr src_addr, grp_addr;
- struct in_addr vif_source;
- const char *addr_str, *addr_str1;
+ pim_addr vif_source;
struct prefix grp;
struct pim_nexthop nexthop;
char nexthop_addr_str[PREFIX_STRLEN];
- char grp_str[PREFIX_STRLEN];
- int idx = 2;
- struct vrf *vrf = pim_cmd_lookup_vrf(vty, argv, argc, &idx);
+ struct vrf *v;
- if (!vrf)
- return CMD_WARNING;
+ v = vrf_lookup_by_name(vrf ? vrf : VRF_DEFAULT_NAME);
- argv_find(argv, argc, "A.B.C.D", &idx);
- addr_str = argv[idx]->arg;
- result = inet_pton(AF_INET, addr_str, &src_addr);
- if (result <= 0) {
- vty_out(vty, "Bad unicast address %s: errno=%d: %s\n", addr_str,
- errno, safe_strerror(errno));
+ if (!v)
return CMD_WARNING;
- }
- if (pim_is_group_224_4(src_addr)) {
+ if (pim_is_group_224_4(source)) {
vty_out(vty,
"Invalid argument. Expected Valid Source Address.\n");
return CMD_WARNING;
}
- addr_str1 = argv[idx + 1]->arg;
- result = inet_pton(AF_INET, addr_str1, &grp_addr);
- if (result <= 0) {
- vty_out(vty, "Bad unicast address %s: errno=%d: %s\n", addr_str,
- errno, safe_strerror(errno));
- return CMD_WARNING;
- }
-
- if (!pim_is_group_224_4(grp_addr)) {
+ if (!pim_is_group_224_4(group)) {
vty_out(vty,
"Invalid argument. Expected Valid Multicast Group Address.\n");
return CMD_WARNING;
}
- if (!pim_rp_set_upstream_addr(vrf->info, &vif_source, src_addr,
- grp_addr))
+ if (!pim_rp_set_upstream_addr(v->info, &vif_source, source, group))
return CMD_SUCCESS;
- nht_p.family = AF_INET;
- nht_p.prefixlen = IPV4_MAX_BITLEN;
- nht_p.u.prefix4 = vif_source;
- grp.family = AF_INET;
- grp.prefixlen = IPV4_MAX_BITLEN;
- grp.u.prefix4 = grp_addr;
+ pim_addr_to_prefix(&nht_p, vif_source);
+ pim_addr_to_prefix(&grp, group);
memset(&nexthop, 0, sizeof(nexthop));
- result = pim_ecmp_nexthop_lookup(vrf->info, &nexthop, &nht_p, &grp, 0);
+ result = pim_ecmp_nexthop_lookup(v->info, &nexthop, &nht_p, &grp, 0);
if (!result) {
vty_out(vty,
@@ -5622,10 +3560,9 @@ DEFUN (show_ip_pim_nexthop_lookup,
return CMD_SUCCESS;
}
- pim_addr_dump("<grp?>", &grp, grp_str, sizeof(grp_str));
pim_addr_dump("<nexthop?>", &nexthop.mrib_nexthop_addr,
nexthop_addr_str, sizeof(nexthop_addr_str));
- vty_out(vty, "Group %s --- Nexthop %s Interface %s \n", grp_str,
+ vty_out(vty, "Group %s --- Nexthop %s Interface %s \n", group_str,
nexthop_addr_str, nexthop.interface->name);
return CMD_SUCCESS;
@@ -5702,9 +3639,9 @@ DEFUN (show_ip_pim_bsrp,
return CMD_SUCCESS;
}
-DEFUN (show_ip_pim_statistics,
+DEFPY (show_ip_pim_statistics,
show_ip_pim_statistics_cmd,
- "show ip pim [vrf NAME] statistics [interface WORD] [json]",
+ "show ip pim [vrf NAME] statistics [interface WORD$word] [json$json]",
SHOW_STR
IP_STR
PIM_STR
@@ -5714,17 +3651,26 @@ DEFUN (show_ip_pim_statistics,
"PIM interface\n"
JSON_STR)
{
- int idx = 2;
- struct vrf *vrf = pim_cmd_lookup_vrf(vty, argv, argc, &idx);
- bool uj = use_json(argc, argv);
+ struct pim_instance *pim;
+ struct vrf *v;
+ bool uj = !!json;
- if (!vrf)
+ v = vrf_lookup_by_name(vrf ? vrf : VRF_DEFAULT_NAME);
+
+ if (!v)
return CMD_WARNING;
- if (argv_find(argv, argc, "WORD", &idx))
- pim_show_statistics(vrf->info, vty, argv[idx]->arg, uj);
+ pim = pim_get_pim_instance(v->vrf_id);
+
+ if (!pim) {
+ vty_out(vty, "%% Unable to find pim instance\n");
+ return CMD_WARNING;
+ }
+
+ if (word)
+ pim_show_statistics(pim, vty, word, uj);
else
- pim_show_statistics(vrf->info, vty, NULL, uj);
+ pim_show_statistics(pim, vty, NULL, uj);
return CMD_SUCCESS;
}
@@ -5840,7 +3786,7 @@ static void pim_cmd_show_ip_multicast_helper(struct pim_instance *pim,
vty_out(vty, "\n");
- show_rpf_refresh_stats(vty, pim, now, NULL);
+ pim_show_rpf_refresh_stats(vty, pim, now, NULL);
vty_out(vty, "\n");
@@ -7265,22 +5211,6 @@ DEFUN (no_ip_pim_ssm_prefix_list_name,
return CMD_WARNING_CONFIG_FAILED;
}
-static void ip_pim_ssm_show_group_range(struct pim_instance *pim,
- struct vty *vty, bool uj)
-{
- struct pim_ssm *ssm = pim->ssm_info;
- const char *range_str =
- ssm->plist_name ? ssm->plist_name : PIM_SSM_STANDARD_RANGE;
-
- if (uj) {
- json_object *json;
- json = json_object_new_object();
- json_object_string_add(json, "ssmGroups", range_str);
- vty_json(vty, json);
- } else
- vty_out(vty, "SSM group range : %s\n", range_str);
-}
-
DEFUN (show_ip_pim_ssm_range,
show_ip_pim_ssm_range_cmd,
"show ip pim [vrf NAME] group-type [json]",
diff --git a/pimd/pim_cmd.h b/pimd/pim_cmd.h
index 89a4e6e699..8022eeea0e 100644
--- a/pimd/pim_cmd.h
+++ b/pimd/pim_cmd.h
@@ -73,13 +73,4 @@
void pim_cmd_init(void);
-/*
- * Special Macro to allow us to get the correct pim_instance;
- */
-#define PIM_DECLVAR_CONTEXT(A, B) \
- struct vrf *A = VTY_GET_CONTEXT(vrf); \
- struct pim_instance *B = \
- (vrf) ? vrf->info : pim_get_pim_instance(VRF_DEFAULT); \
- vrf = (vrf) ? vrf : pim->vrf;
-
#endif /* PIM_CMD_H */
diff --git a/pimd/pim_cmd_common.c b/pimd/pim_cmd_common.c
index c5d89f8065..0d575a1456 100644
--- a/pimd/pim_cmd_common.c
+++ b/pimd/pim_cmd_common.c
@@ -31,13 +31,27 @@
#include "vrf.h"
#include "ferr.h"
#include "lib/srcdest_table.h"
+#include "lib/linklist.h"
#include "pimd.h"
#include "pim_vty.h"
#include "lib/northbound_cli.h"
#include "pim_errors.h"
#include "pim_nb.h"
+#include "pim_mroute.h"
+#include "pim_cmd.h"
+#include "pim6_cmd.h"
#include "pim_cmd_common.h"
+#include "pim_time.h"
+#include "pim_zebra.h"
+#include "pim_zlookup.h"
+#include "pim_iface.h"
+#include "pim_macro.h"
+#include "pim_neighbor.h"
+#include "pim_nht.h"
+#include "pim_sock.h"
+#include "pim_ssm.h"
+#include "pim_addr.h"
/**
* Get current node VRF name.
@@ -653,3 +667,2085 @@ int pim_process_no_rp_plist_cmd(struct vty *vty, const char *rp_str,
return nb_cli_apply_changes(vty, NULL);
}
+
+bool pim_sgaddr_match(pim_sgaddr item, pim_sgaddr match)
+{
+ return (pim_addr_is_any(match.grp) ||
+ !pim_addr_cmp(match.grp, item.grp)) &&
+ (pim_addr_is_any(match.src) ||
+ !pim_addr_cmp(match.src, item.src));
+}
+
+void json_object_pim_ifp_add(struct json_object *json, struct interface *ifp)
+{
+ struct pim_interface *pim_ifp;
+
+ pim_ifp = ifp->info;
+ json_object_string_add(json, "name", ifp->name);
+ json_object_string_add(json, "state", if_is_up(ifp) ? "up" : "down");
+ json_object_string_addf(json, "address", "%pPA",
+ &pim_ifp->primary_address);
+ json_object_int_add(json, "index", ifp->ifindex);
+
+ if (if_is_multicast(ifp))
+ json_object_boolean_true_add(json, "flagMulticast");
+
+ if (if_is_broadcast(ifp))
+ json_object_boolean_true_add(json, "flagBroadcast");
+
+ if (ifp->flags & IFF_ALLMULTI)
+ json_object_boolean_true_add(json, "flagAllMulticast");
+
+ if (ifp->flags & IFF_PROMISC)
+ json_object_boolean_true_add(json, "flagPromiscuous");
+
+ if (PIM_IF_IS_DELETED(ifp))
+ json_object_boolean_true_add(json, "flagDeleted");
+
+ if (pim_if_lan_delay_enabled(ifp))
+ json_object_boolean_true_add(json, "lanDelayEnabled");
+}
+
+void pim_print_ifp_flags(struct vty *vty, struct interface *ifp)
+{
+ vty_out(vty, "Flags\n");
+ vty_out(vty, "-----\n");
+ vty_out(vty, "All Multicast : %s\n",
+ (ifp->flags & IFF_ALLMULTI) ? "yes" : "no");
+ vty_out(vty, "Broadcast : %s\n",
+ if_is_broadcast(ifp) ? "yes" : "no");
+ vty_out(vty, "Deleted : %s\n",
+ PIM_IF_IS_DELETED(ifp) ? "yes" : "no");
+ vty_out(vty, "Interface Index : %d\n", ifp->ifindex);
+ vty_out(vty, "Multicast : %s\n",
+ if_is_multicast(ifp) ? "yes" : "no");
+ vty_out(vty, "Promiscuous : %s\n",
+ (ifp->flags & IFF_PROMISC) ? "yes" : "no");
+ vty_out(vty, "\n");
+ vty_out(vty, "\n");
+}
+
+void json_object_pim_upstream_add(json_object *json, struct pim_upstream *up)
+{
+ json_object_boolean_add(
+ json, "drJoinDesired",
+ CHECK_FLAG(up->flags, PIM_UPSTREAM_FLAG_MASK_DR_JOIN_DESIRED));
+ json_object_boolean_add(
+ json, "drJoinDesiredUpdated",
+ CHECK_FLAG(up->flags,
+ PIM_UPSTREAM_FLAG_MASK_DR_JOIN_DESIRED_UPDATED));
+ json_object_boolean_add(
+ json, "firstHopRouter",
+ CHECK_FLAG(up->flags, PIM_UPSTREAM_FLAG_MASK_FHR));
+ json_object_boolean_add(
+ json, "sourceIgmp",
+ CHECK_FLAG(up->flags, PIM_UPSTREAM_FLAG_MASK_SRC_IGMP));
+ json_object_boolean_add(
+ json, "sourcePim",
+ CHECK_FLAG(up->flags, PIM_UPSTREAM_FLAG_MASK_SRC_PIM));
+ json_object_boolean_add(
+ json, "sourceStream",
+ CHECK_FLAG(up->flags, PIM_UPSTREAM_FLAG_MASK_SRC_STREAM));
+ /* XXX: need to print ths flag in the plain text display as well */
+ json_object_boolean_add(
+ json, "sourceMsdp",
+ CHECK_FLAG(up->flags, PIM_UPSTREAM_FLAG_MASK_SRC_MSDP));
+ json_object_boolean_add(
+ json, "sendSGRptPrune",
+ CHECK_FLAG(up->flags,
+ PIM_UPSTREAM_FLAG_MASK_SEND_SG_RPT_PRUNE));
+ json_object_boolean_add(
+ json, "lastHopRouter",
+ CHECK_FLAG(up->flags, PIM_UPSTREAM_FLAG_MASK_SRC_LHR));
+ json_object_boolean_add(
+ json, "disableKATExpiry",
+ CHECK_FLAG(up->flags,
+ PIM_UPSTREAM_FLAG_MASK_DISABLE_KAT_EXPIRY));
+ json_object_boolean_add(
+ json, "staticIncomingInterface",
+ CHECK_FLAG(up->flags, PIM_UPSTREAM_FLAG_MASK_STATIC_IIF));
+ json_object_boolean_add(
+ json, "allowIncomingInterfaceinOil",
+ CHECK_FLAG(up->flags, PIM_UPSTREAM_FLAG_MASK_ALLOW_IIF_IN_OIL));
+ json_object_boolean_add(
+ json, "noPimRegistrationData",
+ CHECK_FLAG(up->flags, PIM_UPSTREAM_FLAG_MASK_NO_PIMREG_DATA));
+ json_object_boolean_add(
+ json, "forcePimRegistration",
+ CHECK_FLAG(up->flags, PIM_UPSTREAM_FLAG_MASK_FORCE_PIMREG));
+ json_object_boolean_add(
+ json, "sourceVxlanOrigination",
+ CHECK_FLAG(up->flags, PIM_UPSTREAM_FLAG_MASK_SRC_VXLAN_ORIG));
+ json_object_boolean_add(
+ json, "sourceVxlanTermination",
+ CHECK_FLAG(up->flags, PIM_UPSTREAM_FLAG_MASK_SRC_VXLAN_TERM));
+ json_object_boolean_add(
+ json, "mlagVxlan",
+ CHECK_FLAG(up->flags, PIM_UPSTREAM_FLAG_MASK_MLAG_VXLAN));
+ json_object_boolean_add(
+ json, "mlagNonDesignatedForwarder",
+ CHECK_FLAG(up->flags, PIM_UPSTREAM_FLAG_MASK_MLAG_NON_DF));
+}
+
+static const char *
+pim_upstream_state2brief_str(enum pim_upstream_state join_state,
+ char *state_str, size_t state_str_len)
+{
+ switch (join_state) {
+ case PIM_UPSTREAM_NOTJOINED:
+ strlcpy(state_str, "NotJ", state_str_len);
+ break;
+ case PIM_UPSTREAM_JOINED:
+ strlcpy(state_str, "J", state_str_len);
+ break;
+ default:
+ strlcpy(state_str, "Unk", state_str_len);
+ }
+ return state_str;
+}
+
+static const char *pim_reg_state2brief_str(enum pim_reg_state reg_state,
+ char *state_str,
+ size_t state_str_len)
+{
+ switch (reg_state) {
+ case PIM_REG_NOINFO:
+ strlcpy(state_str, "RegNI", state_str_len);
+ break;
+ case PIM_REG_JOIN:
+ strlcpy(state_str, "RegJ", state_str_len);
+ break;
+ case PIM_REG_JOIN_PENDING:
+ case PIM_REG_PRUNE:
+ strlcpy(state_str, "RegP", state_str_len);
+ break;
+ }
+ return state_str;
+}
+
+void pim_show_rpf_refresh_stats(struct vty *vty, struct pim_instance *pim,
+ time_t now, json_object *json)
+{
+ char refresh_uptime[10];
+
+ pim_time_uptime_begin(refresh_uptime, sizeof(refresh_uptime), now,
+ pim->rpf_cache_refresh_last);
+
+ if (json) {
+ json_object_int_add(json, "rpfCacheRefreshDelayMsecs",
+ router->rpf_cache_refresh_delay_msec);
+ json_object_int_add(
+ json, "rpfCacheRefreshTimer",
+ pim_time_timer_remain_msec(pim->rpf_cache_refresher));
+ json_object_int_add(json, "rpfCacheRefreshRequests",
+ pim->rpf_cache_refresh_requests);
+ json_object_int_add(json, "rpfCacheRefreshEvents",
+ pim->rpf_cache_refresh_events);
+ json_object_string_add(json, "rpfCacheRefreshLast",
+ refresh_uptime);
+ json_object_int_add(json, "nexthopLookups",
+ pim->nexthop_lookups);
+ json_object_int_add(json, "nexthopLookupsAvoided",
+ pim->nexthop_lookups_avoided);
+ } else {
+ vty_out(vty,
+ "RPF Cache Refresh Delay: %ld msecs\n"
+ "RPF Cache Refresh Timer: %ld msecs\n"
+ "RPF Cache Refresh Requests: %lld\n"
+ "RPF Cache Refresh Events: %lld\n"
+ "RPF Cache Refresh Last: %s\n"
+ "Nexthop Lookups: %lld\n"
+ "Nexthop Lookups Avoided: %lld\n",
+ router->rpf_cache_refresh_delay_msec,
+ pim_time_timer_remain_msec(pim->rpf_cache_refresher),
+ (long long)pim->rpf_cache_refresh_requests,
+ (long long)pim->rpf_cache_refresh_events,
+ refresh_uptime, (long long)pim->nexthop_lookups,
+ (long long)pim->nexthop_lookups_avoided);
+ }
+}
+
+void pim_show_rpf(struct pim_instance *pim, struct vty *vty, json_object *json)
+{
+ struct pim_upstream *up;
+ time_t now = pim_time_monotonic_sec();
+ json_object *json_group = NULL;
+ json_object *json_row = NULL;
+
+ pim_show_rpf_refresh_stats(vty, pim, now, json);
+
+ if (!json) {
+ vty_out(vty, "\n");
+ vty_out(vty,
+ "Source Group RpfIface RpfAddress RibNextHop Metric Pref\n");
+ }
+
+ frr_each (rb_pim_upstream, &pim->upstream_head, up) {
+ char rpf_addr_str[PREFIX_STRLEN];
+ char rib_nexthop_str[PREFIX_STRLEN];
+ const char *rpf_ifname;
+ struct pim_rpf *rpf = &up->rpf;
+
+ pim_addr_dump("<rpf?>", &rpf->rpf_addr, rpf_addr_str,
+ sizeof(rpf_addr_str));
+ pim_addr_dump("<nexthop?>",
+ &rpf->source_nexthop.mrib_nexthop_addr,
+ rib_nexthop_str, sizeof(rib_nexthop_str));
+
+ rpf_ifname =
+ rpf->source_nexthop.interface ? rpf->source_nexthop
+ .interface->name
+ : "<ifname?>";
+
+ if (json) {
+ char grp_str[PIM_ADDRSTRLEN];
+ char src_str[PIM_ADDRSTRLEN];
+
+ snprintfrr(grp_str, sizeof(grp_str), "%pPAs",
+ &up->sg.grp);
+ snprintfrr(src_str, sizeof(src_str), "%pPAs",
+ &up->sg.src);
+
+ 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);
+ json_object_string_add(json_row, "rpfInterface",
+ rpf_ifname);
+ json_object_string_add(json_row, "rpfAddress",
+ rpf_addr_str);
+ json_object_string_add(json_row, "ribNexthop",
+ rib_nexthop_str);
+ json_object_int_add(
+ json_row, "routeMetric",
+ rpf->source_nexthop.mrib_route_metric);
+ json_object_int_add(
+ json_row, "routePreference",
+ rpf->source_nexthop.mrib_metric_preference);
+ json_object_object_add(json_group, src_str, json_row);
+
+ } else {
+ vty_out(vty,
+ "%-15pPAs %-15pPAs %-16s %-15s %-15s %6d %4d\n",
+ &up->sg.src, &up->sg.grp, rpf_ifname,
+ rpf_addr_str, rib_nexthop_str,
+ rpf->source_nexthop.mrib_route_metric,
+ rpf->source_nexthop.mrib_metric_preference);
+ }
+ }
+}
+
+void pim_show_neighbors_secondary(struct pim_instance *pim, struct vty *vty)
+{
+ struct interface *ifp;
+
+ vty_out(vty,
+ "Interface Address Neighbor Secondary \n");
+
+ FOR_ALL_INTERFACES (pim->vrf, ifp) {
+ struct pim_interface *pim_ifp;
+ pim_addr ifaddr;
+ struct listnode *neighnode;
+ struct pim_neighbor *neigh;
+
+ pim_ifp = ifp->info;
+
+ if (!pim_ifp)
+ continue;
+
+ if (pim_ifp->pim_sock_fd < 0)
+ continue;
+
+ ifaddr = pim_ifp->primary_address;
+
+ for (ALL_LIST_ELEMENTS_RO(pim_ifp->pim_neighbor_list, neighnode,
+ neigh)) {
+ struct listnode *prefix_node;
+ struct prefix *p;
+
+ if (!neigh->prefix_list)
+ continue;
+
+ for (ALL_LIST_ELEMENTS_RO(neigh->prefix_list,
+ prefix_node, p))
+ vty_out(vty,
+ "%-16s %-15pPAs %-15pPAs %-15pFX\n",
+ ifp->name, &ifaddr, &neigh->source_addr,
+ p);
+ }
+ }
+}
+
+void pim_show_state(struct pim_instance *pim, struct vty *vty,
+ const char *src_or_group, const char *group,
+ json_object *json)
+{
+ struct channel_oil *c_oil;
+ json_object *json_group = NULL;
+ json_object *json_ifp_in = NULL;
+ json_object *json_ifp_out = NULL;
+ json_object *json_source = NULL;
+ time_t now;
+ int first_oif;
+
+ now = pim_time_monotonic_sec();
+
+ if (!json) {
+ vty_out(vty,
+ "Codes: J -> Pim Join, I -> IGMP Report, S -> Source, * -> Inherited from (*,G), V -> VxLAN, M -> Muted");
+ vty_out(vty,
+ "\nActive Source Group RPT IIF OIL\n");
+ }
+
+ frr_each (rb_pim_oil, &pim->channel_oil_head, c_oil) {
+ char src_str[PIM_ADDRSTRLEN];
+ char grp_str[PIM_ADDRSTRLEN];
+ char in_ifname[INTERFACE_NAMSIZ + 1];
+ char out_ifname[INTERFACE_NAMSIZ + 1];
+ int oif_vif_index;
+ struct interface *ifp_in;
+ bool isRpt;
+
+ first_oif = 1;
+
+ if ((c_oil->up &&
+ PIM_UPSTREAM_FLAG_TEST_USE_RPT(c_oil->up->flags)) ||
+ pim_addr_is_any(*oil_origin(c_oil)))
+ isRpt = true;
+ else
+ isRpt = false;
+
+ snprintfrr(grp_str, sizeof(grp_str), "%pPAs",
+ oil_mcastgrp(c_oil));
+ snprintfrr(src_str, sizeof(src_str), "%pPAs",
+ oil_origin(c_oil));
+ ifp_in = pim_if_find_by_vif_index(pim, *oil_parent(c_oil));
+
+ if (ifp_in)
+ strlcpy(in_ifname, ifp_in->name, sizeof(in_ifname));
+ else
+ strlcpy(in_ifname, "<iif?>", sizeof(in_ifname));
+
+ if (src_or_group) {
+ if (strcmp(src_or_group, src_str) &&
+ strcmp(src_or_group, grp_str))
+ continue;
+
+ if (group && strcmp(group, grp_str))
+ continue;
+ }
+
+ if (json) {
+
+ /* Find the group, create it if it doesn't exist */
+ 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);
+ }
+
+ /* Find the source nested under the group, create it if
+ * it doesn't exist
+ */
+ json_object_object_get_ex(json_group, src_str,
+ &json_source);
+
+ if (!json_source) {
+ json_source = json_object_new_object();
+ json_object_object_add(json_group, src_str,
+ json_source);
+ }
+
+ /* Find the inbound interface nested under the source,
+ * create it if it doesn't exist
+ */
+ json_object_object_get_ex(json_source, in_ifname,
+ &json_ifp_in);
+
+ if (!json_ifp_in) {
+ json_ifp_in = json_object_new_object();
+ json_object_object_add(json_source, in_ifname,
+ json_ifp_in);
+ json_object_int_add(json_source, "Installed",
+ c_oil->installed);
+ json_object_int_add(json_source, "installed",
+ c_oil->installed);
+ json_object_boolean_add(json_source, "isRpt",
+ isRpt);
+ json_object_int_add(json_source, "RefCount",
+ c_oil->oil_ref_count);
+ json_object_int_add(json_source, "refCount",
+ c_oil->oil_ref_count);
+ json_object_int_add(json_source, "OilListSize",
+ c_oil->oil_size);
+ json_object_int_add(json_source, "oilListSize",
+ c_oil->oil_size);
+ json_object_int_add(
+ json_source, "OilRescan",
+ c_oil->oil_inherited_rescan);
+ json_object_int_add(
+ json_source, "oilRescan",
+ c_oil->oil_inherited_rescan);
+ json_object_int_add(json_source, "LastUsed",
+ c_oil->cc.lastused);
+ json_object_int_add(json_source, "lastUsed",
+ c_oil->cc.lastused);
+ json_object_int_add(json_source, "PacketCount",
+ c_oil->cc.pktcnt);
+ json_object_int_add(json_source, "packetCount",
+ c_oil->cc.pktcnt);
+ json_object_int_add(json_source, "ByteCount",
+ c_oil->cc.bytecnt);
+ json_object_int_add(json_source, "byteCount",
+ c_oil->cc.bytecnt);
+ json_object_int_add(json_source,
+ "WrongInterface",
+ c_oil->cc.wrong_if);
+ json_object_int_add(json_source,
+ "wrongInterface",
+ c_oil->cc.wrong_if);
+ }
+ } else
+ vty_out(vty, "%-6d %-15pPAs %-15pPAs %-3s %-16s ",
+ c_oil->installed, oil_origin(c_oil),
+ oil_mcastgrp(c_oil), isRpt ? "y" : "n",
+ in_ifname);
+
+ for (oif_vif_index = 0; oif_vif_index < MAXVIFS;
+ ++oif_vif_index) {
+ struct interface *ifp_out;
+ char oif_uptime[10];
+ int ttl;
+
+ ttl = oil_if_has(c_oil, oif_vif_index);
+ if (ttl < 1)
+ continue;
+
+ ifp_out = pim_if_find_by_vif_index(pim, oif_vif_index);
+ pim_time_uptime(
+ oif_uptime, sizeof(oif_uptime),
+ now - c_oil->oif_creation[oif_vif_index]);
+
+ if (ifp_out)
+ strlcpy(out_ifname, ifp_out->name,
+ sizeof(out_ifname));
+ else
+ strlcpy(out_ifname, "<oif?>",
+ sizeof(out_ifname));
+
+ if (json) {
+ json_ifp_out = json_object_new_object();
+ json_object_string_add(json_ifp_out, "source",
+ src_str);
+ json_object_string_add(json_ifp_out, "group",
+ grp_str);
+ json_object_string_add(json_ifp_out,
+ "inboundInterface",
+ in_ifname);
+ json_object_string_add(json_ifp_out,
+ "outboundInterface",
+ out_ifname);
+ json_object_int_add(json_ifp_out, "installed",
+ c_oil->installed);
+
+ json_object_object_add(json_ifp_in, out_ifname,
+ json_ifp_out);
+ } else {
+ if (first_oif) {
+ first_oif = 0;
+ vty_out(vty, "%s(%c%c%c%c%c)",
+ out_ifname,
+ (c_oil->oif_flags
+ [oif_vif_index] &
+ PIM_OIF_FLAG_PROTO_IGMP)
+ ? 'I'
+ : ' ',
+ (c_oil->oif_flags
+ [oif_vif_index] &
+ PIM_OIF_FLAG_PROTO_PIM)
+ ? 'J'
+ : ' ',
+ (c_oil->oif_flags
+ [oif_vif_index] &
+ PIM_OIF_FLAG_PROTO_VXLAN)
+ ? 'V'
+ : ' ',
+ (c_oil->oif_flags
+ [oif_vif_index] &
+ PIM_OIF_FLAG_PROTO_STAR)
+ ? '*'
+ : ' ',
+ (c_oil->oif_flags
+ [oif_vif_index] &
+ PIM_OIF_FLAG_MUTE)
+ ? 'M'
+ : ' ');
+ } else
+ vty_out(vty, ", %s(%c%c%c%c%c)",
+ out_ifname,
+ (c_oil->oif_flags
+ [oif_vif_index] &
+ PIM_OIF_FLAG_PROTO_IGMP)
+ ? 'I'
+ : ' ',
+ (c_oil->oif_flags
+ [oif_vif_index] &
+ PIM_OIF_FLAG_PROTO_PIM)
+ ? 'J'
+ : ' ',
+ (c_oil->oif_flags
+ [oif_vif_index] &
+ PIM_OIF_FLAG_PROTO_VXLAN)
+ ? 'V'
+ : ' ',
+ (c_oil->oif_flags
+ [oif_vif_index] &
+ PIM_OIF_FLAG_PROTO_STAR)
+ ? '*'
+ : ' ',
+ (c_oil->oif_flags
+ [oif_vif_index] &
+ PIM_OIF_FLAG_MUTE)
+ ? 'M'
+ : ' ');
+ }
+ }
+
+ if (!json)
+ vty_out(vty, "\n");
+ }
+
+ if (!json)
+ vty_out(vty, "\n");
+}
+
+/* pim statistics - just adding only bsm related now.
+ * We can continue to add all pim related stats here.
+ */
+void pim_show_statistics(struct pim_instance *pim, struct vty *vty,
+ const char *ifname, bool uj)
+{
+ json_object *json = NULL;
+ struct interface *ifp;
+
+ if (uj) {
+ json = json_object_new_object();
+ 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");
+ vty_out(vty, "Number of Received BSMs : %" PRIu64 "\n",
+ pim->bsm_rcvd);
+ vty_out(vty, "Number of Forwared BSMs : %" PRIu64 "\n",
+ pim->bsm_sent);
+ vty_out(vty, "Number of Dropped BSMs : %" PRIu64 "\n",
+ pim->bsm_dropped);
+ }
+
+ vty_out(vty, "\n");
+
+ /* scan interfaces */
+ FOR_ALL_INTERFACES (pim->vrf, ifp) {
+ struct pim_interface *pim_ifp = ifp->info;
+
+ if (ifname && strcmp(ifname, ifp->name))
+ continue;
+
+ if (!pim_ifp)
+ continue;
+
+ if (!uj) {
+ vty_out(vty, "Interface : %s\n", ifp->name);
+ vty_out(vty, "-------------------\n");
+ vty_out(vty,
+ "Number of BSMs dropped due to config miss : %u\n",
+ pim_ifp->pim_ifstat_bsm_cfg_miss);
+ vty_out(vty, "Number of unicast BSMs dropped : %u\n",
+ pim_ifp->pim_ifstat_ucast_bsm_cfg_miss);
+ vty_out(vty,
+ "Number of BSMs dropped due to invalid scope zone : %u\n",
+ pim_ifp->pim_ifstat_bsm_invalid_sz);
+ } else {
+
+ json_object *json_row = NULL;
+
+ 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, "bsmDroppedUnicast",
+ pim_ifp->pim_ifstat_ucast_bsm_cfg_miss);
+ json_object_int_add(json_row,
+ "bsmDroppedInvalidScopeZone",
+ pim_ifp->pim_ifstat_bsm_invalid_sz);
+ json_object_object_add(json, ifp->name, json_row);
+ }
+ vty_out(vty, "\n");
+ }
+
+ if (uj)
+ vty_json(vty, json);
+}
+
+void pim_show_upstream(struct pim_instance *pim, struct vty *vty,
+ pim_sgaddr *sg, json_object *json)
+{
+ struct pim_upstream *up;
+ time_t now;
+ json_object *json_group = NULL;
+ json_object *json_row = NULL;
+
+ now = pim_time_monotonic_sec();
+
+ if (!json)
+ vty_out(vty,
+ "Iif Source Group State Uptime JoinTimer RSTimer KATimer RefCnt\n");
+
+ frr_each (rb_pim_upstream, &pim->upstream_head, up) {
+ char uptime[10];
+ char join_timer[10];
+ char rs_timer[10];
+ char ka_timer[10];
+ char msdp_reg_timer[10];
+ char state_str[PIM_REG_STATE_STR_LEN];
+
+ if (!pim_sgaddr_match(up->sg, *sg))
+ continue;
+
+ pim_time_uptime(uptime, sizeof(uptime),
+ now - up->state_transition);
+ pim_time_timer_to_hhmmss(join_timer, sizeof(join_timer),
+ up->t_join_timer);
+
+ /*
+ * If the upstream is not dummy and it has a J/P timer for the
+ * neighbor display that
+ */
+ if (!up->t_join_timer && up->rpf.source_nexthop.interface) {
+ struct pim_neighbor *nbr;
+
+ nbr = pim_neighbor_find_prefix(
+ up->rpf.source_nexthop.interface,
+ &up->rpf.rpf_addr);
+ if (nbr)
+ pim_time_timer_to_hhmmss(join_timer,
+ sizeof(join_timer),
+ nbr->jp_timer);
+ }
+
+ pim_time_timer_to_hhmmss(rs_timer, sizeof(rs_timer),
+ up->t_rs_timer);
+ pim_time_timer_to_hhmmss(ka_timer, sizeof(ka_timer),
+ up->t_ka_timer);
+ pim_time_timer_to_hhmmss(msdp_reg_timer, sizeof(msdp_reg_timer),
+ up->t_msdp_reg_timer);
+
+ pim_upstream_state2brief_str(up->join_state, state_str,
+ sizeof(state_str));
+ if (up->reg_state != PIM_REG_NOINFO) {
+ char tmp_str[PIM_REG_STATE_STR_LEN];
+ char tmp[sizeof(state_str) + 1];
+
+ snprintf(tmp, sizeof(tmp), ",%s",
+ pim_reg_state2brief_str(up->reg_state, tmp_str,
+ sizeof(tmp_str)));
+ strlcat(state_str, tmp, sizeof(state_str));
+ }
+
+ if (json) {
+ char grp_str[PIM_ADDRSTRLEN];
+ char src_str[PIM_ADDRSTRLEN];
+
+ snprintfrr(grp_str, sizeof(grp_str), "%pPAs",
+ &up->sg.grp);
+ snprintfrr(src_str, sizeof(src_str), "%pPAs",
+ &up->sg.src);
+
+ 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_pim_upstream_add(json_row, up);
+ json_object_string_add(
+ json_row, "inboundInterface",
+ up->rpf.source_nexthop.interface
+ ? up->rpf.source_nexthop.interface->name
+ : "Unknown");
+
+ /*
+ * The RPF address we use is slightly different
+ * based upon what we are looking up.
+ * If we have a S, list that unless
+ * we are the FHR, else we just put
+ * the RP as the rpfAddress
+ */
+ if (up->flags & PIM_UPSTREAM_FLAG_MASK_FHR ||
+ pim_addr_is_any(up->sg.src)) {
+ struct pim_rpf *rpg;
+
+ rpg = RP(pim, up->sg.grp);
+ json_object_string_addf(json_row, "rpfAddress",
+ "%pFX", &rpg->rpf_addr);
+ } else {
+ json_object_string_add(json_row, "rpfAddress",
+ src_str);
+ }
+
+ json_object_string_add(json_row, "source", src_str);
+ json_object_string_add(json_row, "group", grp_str);
+ json_object_string_add(json_row, "state", state_str);
+ json_object_string_add(
+ json_row, "joinState",
+ pim_upstream_state2str(up->join_state));
+ json_object_string_add(
+ json_row, "regState",
+ pim_reg_state2str(up->reg_state, state_str,
+ sizeof(state_str)));
+ json_object_string_add(json_row, "upTime", uptime);
+ json_object_string_add(json_row, "joinTimer",
+ join_timer);
+ json_object_string_add(json_row, "resetTimer",
+ rs_timer);
+ json_object_string_add(json_row, "keepaliveTimer",
+ ka_timer);
+ json_object_string_add(json_row, "msdpRegTimer",
+ msdp_reg_timer);
+ json_object_int_add(json_row, "refCount",
+ up->ref_count);
+ json_object_int_add(json_row, "sptBit", up->sptbit);
+ json_object_object_add(json_group, src_str, json_row);
+ } else {
+ vty_out(vty,
+ "%-16s%-15pPAs %-15pPAs %-11s %-8s %-9s %-9s %-9s %6d\n",
+ up->rpf.source_nexthop.interface
+ ? up->rpf.source_nexthop.interface->name
+ : "Unknown",
+ &up->sg.src, &up->sg.grp, state_str, uptime,
+ join_timer, rs_timer, ka_timer, up->ref_count);
+ }
+ }
+}
+
+static void pim_show_join_desired_helper(struct pim_instance *pim,
+ struct vty *vty,
+ struct pim_upstream *up,
+ json_object *json, bool uj)
+{
+ json_object *json_group = NULL;
+ json_object *json_row = NULL;
+
+ if (uj) {
+ char grp_str[PIM_ADDRSTRLEN];
+ char src_str[PIM_ADDRSTRLEN];
+
+ snprintfrr(grp_str, sizeof(grp_str), "%pPAs", &up->sg.grp);
+ snprintfrr(src_str, sizeof(src_str), "%pPAs", &up->sg.src);
+
+ 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_pim_upstream_add(json_row, up);
+ json_object_string_add(json_row, "source", src_str);
+ json_object_string_add(json_row, "group", grp_str);
+
+ if (pim_upstream_evaluate_join_desired(pim, up))
+ json_object_boolean_true_add(json_row,
+ "evaluateJoinDesired");
+
+ json_object_object_add(json_group, src_str, json_row);
+
+ } else {
+ vty_out(vty, "%-15pPAs %-15pPAs %-6s\n", &up->sg.src,
+ &up->sg.grp,
+ pim_upstream_evaluate_join_desired(pim, up) ? "yes"
+ : "no");
+ }
+}
+
+void pim_show_join_desired(struct pim_instance *pim, struct vty *vty, bool uj)
+{
+ struct pim_upstream *up;
+
+ json_object *json = NULL;
+
+ if (uj)
+ json = json_object_new_object();
+ else
+ vty_out(vty, "Source Group EvalJD\n");
+
+ frr_each (rb_pim_upstream, &pim->upstream_head, up) {
+ /* scan all interfaces */
+ pim_show_join_desired_helper(pim, vty, up, json, uj);
+ }
+
+ if (uj)
+ vty_json(vty, json);
+}
+
+void pim_show_upstream_rpf(struct pim_instance *pim, struct vty *vty, bool uj)
+{
+ struct pim_upstream *up;
+ json_object *json = NULL;
+ json_object *json_group = NULL;
+ json_object *json_row = NULL;
+
+ if (uj)
+ json = json_object_new_object();
+ else
+ vty_out(vty,
+ "Source Group RpfIface RibNextHop RpfAddress \n");
+
+ frr_each (rb_pim_upstream, &pim->upstream_head, up) {
+ char rpf_nexthop_str[PREFIX_STRLEN];
+ char rpf_addr_str[PREFIX_STRLEN];
+ struct pim_rpf *rpf;
+ const char *rpf_ifname;
+
+ rpf = &up->rpf;
+
+ pim_addr_dump("<nexthop?>",
+ &rpf->source_nexthop.mrib_nexthop_addr,
+ rpf_nexthop_str, sizeof(rpf_nexthop_str));
+ pim_addr_dump("<rpf?>", &rpf->rpf_addr, rpf_addr_str,
+ sizeof(rpf_addr_str));
+
+ rpf_ifname =
+ rpf->source_nexthop.interface ? rpf->source_nexthop
+ .interface->name
+ : "<ifname?>";
+
+ if (uj) {
+ char grp_str[PIM_ADDRSTRLEN];
+ char src_str[PIM_ADDRSTRLEN];
+
+ snprintfrr(grp_str, sizeof(grp_str), "%pPAs",
+ &up->sg.grp);
+ snprintfrr(src_str, sizeof(src_str), "%pPAs",
+ &up->sg.src);
+ 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_pim_upstream_add(json_row, up);
+ json_object_string_add(json_row, "source", src_str);
+ json_object_string_add(json_row, "group", grp_str);
+ json_object_string_add(json_row, "rpfInterface",
+ rpf_ifname);
+ json_object_string_add(json_row, "ribNexthop",
+ rpf_nexthop_str);
+ json_object_string_add(json_row, "rpfAddress",
+ rpf_addr_str);
+ json_object_object_add(json_group, src_str, json_row);
+ } else {
+ vty_out(vty, "%-15pPAs %-15pPAs %-16s %-15s %-15s\n",
+ &up->sg.src, &up->sg.grp, rpf_ifname,
+ rpf_nexthop_str, rpf_addr_str);
+ }
+ }
+
+ if (uj)
+ vty_json(vty, json);
+}
+
+static void pim_show_join_helper(struct vty *vty, struct pim_interface *pim_ifp,
+ struct pim_ifchannel *ch, json_object *json,
+ time_t now)
+{
+ json_object *json_iface = NULL;
+ json_object *json_row = NULL;
+ json_object *json_grp = NULL;
+ pim_addr ifaddr;
+ char uptime[10];
+ char expire[10];
+ char prune[10];
+
+ ifaddr = pim_ifp->primary_address;
+
+ pim_time_uptime_begin(uptime, sizeof(uptime), now, ch->ifjoin_creation);
+ pim_time_timer_to_mmss(expire, sizeof(expire),
+ ch->t_ifjoin_expiry_timer);
+ pim_time_timer_to_mmss(prune, sizeof(prune),
+ ch->t_ifjoin_prune_pending_timer);
+
+ if (json) {
+ char ch_grp_str[PIM_ADDRSTRLEN];
+
+ json_object_object_get_ex(json, ch->interface->name,
+ &json_iface);
+
+ if (!json_iface) {
+ json_iface = json_object_new_object();
+ json_object_pim_ifp_add(json_iface, ch->interface);
+ json_object_object_add(json, ch->interface->name,
+ json_iface);
+ }
+
+ json_row = json_object_new_object();
+ json_object_string_addf(json_row, "source", "%pPAs",
+ &ch->sg.src);
+ json_object_string_addf(json_row, "group", "%pPAs",
+ &ch->sg.grp);
+ json_object_string_add(json_row, "upTime", uptime);
+ json_object_string_add(json_row, "expire", expire);
+ json_object_string_add(json_row, "prune", prune);
+ json_object_string_add(
+ json_row, "channelJoinName",
+ pim_ifchannel_ifjoin_name(ch->ifjoin_state, ch->flags));
+ if (PIM_IF_FLAG_TEST_S_G_RPT(ch->flags)) {
+#if CONFDATE > 20230131
+ CPP_NOTICE(
+ "Remove JSON object commands with keys starting with capital")
+#endif
+ json_object_int_add(json_row, "SGRpt", 1);
+ 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);
+ snprintfrr(ch_grp_str, sizeof(ch_grp_str), "%pPAs",
+ &ch->sg.grp);
+ json_object_object_get_ex(json_iface, ch_grp_str, &json_grp);
+ if (!json_grp) {
+ json_grp = json_object_new_object();
+ json_object_object_addf(json_grp, json_row, "%pPAs",
+ &ch->sg.src);
+ json_object_object_addf(json_iface, json_grp, "%pPAs",
+ &ch->sg.grp);
+ } else
+ json_object_object_addf(json_grp, json_row, "%pPAs",
+ &ch->sg.src);
+ } else {
+ vty_out(vty,
+ "%-16s %-15pPAs %-15pPAs %-15pPAs %-10s %8s %-6s %5s\n",
+ ch->interface->name, &ifaddr, &ch->sg.src, &ch->sg.grp,
+ pim_ifchannel_ifjoin_name(ch->ifjoin_state, ch->flags),
+ uptime, expire, prune);
+ }
+}
+
+void pim_show_join(struct pim_instance *pim, struct vty *vty, pim_sgaddr *sg,
+ json_object *json)
+{
+ struct pim_interface *pim_ifp;
+ struct pim_ifchannel *ch;
+ struct interface *ifp;
+ time_t now;
+
+ now = pim_time_monotonic_sec();
+
+ if (!json)
+ vty_out(vty,
+ "Interface Address Source Group State Uptime Expire Prune\n");
+
+ FOR_ALL_INTERFACES (pim->vrf, ifp) {
+ pim_ifp = ifp->info;
+ if (!pim_ifp)
+ continue;
+
+ RB_FOREACH (ch, pim_ifchannel_rb, &pim_ifp->ifchannel_rb) {
+ if (!pim_sgaddr_match(ch->sg, *sg))
+ continue;
+
+ pim_show_join_helper(vty, pim_ifp, ch, json, now);
+ } /* scan interface channels */
+ }
+}
+
+static void pim_show_jp_agg_helper(struct vty *vty, struct interface *ifp,
+ struct pim_neighbor *neigh,
+ struct pim_upstream *up, int is_join)
+{
+ vty_out(vty, "%-16s %-15pPAs %-15pPAs %-15pPAs %5s\n", ifp->name,
+ &neigh->source_addr, &up->sg.src, &up->sg.grp,
+ is_join ? "J" : "P");
+}
+
+void pim_show_jp_agg_list(struct pim_instance *pim, struct vty *vty)
+{
+ struct interface *ifp;
+ struct pim_interface *pim_ifp;
+ struct listnode *n_node;
+ struct pim_neighbor *neigh;
+ struct listnode *jag_node;
+ struct pim_jp_agg_group *jag;
+ struct listnode *js_node;
+ struct pim_jp_sources *js;
+
+ vty_out(vty,
+ "Interface RPF Nbr Source Group State\n");
+
+ FOR_ALL_INTERFACES (pim->vrf, ifp) {
+ pim_ifp = ifp->info;
+ if (!pim_ifp)
+ continue;
+
+ for (ALL_LIST_ELEMENTS_RO(pim_ifp->pim_neighbor_list, n_node,
+ neigh)) {
+ for (ALL_LIST_ELEMENTS_RO(neigh->upstream_jp_agg,
+ jag_node, jag)) {
+ for (ALL_LIST_ELEMENTS_RO(jag->sources, js_node,
+ js)) {
+ pim_show_jp_agg_helper(vty, ifp, neigh,
+ js->up,
+ js->is_join);
+ }
+ }
+ }
+ }
+}
+
+static void pim_show_membership_helper(struct vty *vty,
+ struct pim_interface *pim_ifp,
+ struct pim_ifchannel *ch,
+ struct json_object *json)
+{
+ json_object *json_iface = NULL;
+ json_object *json_row = NULL;
+
+ json_object_object_get_ex(json, ch->interface->name, &json_iface);
+ if (!json_iface) {
+ json_iface = json_object_new_object();
+ json_object_pim_ifp_add(json_iface, ch->interface);
+ json_object_object_add(json, ch->interface->name, json_iface);
+ }
+
+ json_row = json_object_new_object();
+ json_object_string_addf(json_row, "source", "%pPAs", &ch->sg.src);
+ json_object_string_addf(json_row, "group", "%pPAs", &ch->sg.grp);
+ json_object_string_add(json_row, "localMembership",
+ ch->local_ifmembership == PIM_IFMEMBERSHIP_NOINFO
+ ? "NOINFO"
+ : "INCLUDE");
+ json_object_object_addf(json_iface, json_row, "%pPAs", &ch->sg.grp);
+}
+
+void pim_show_membership(struct pim_instance *pim, struct vty *vty, bool uj)
+{
+ struct pim_interface *pim_ifp;
+ struct pim_ifchannel *ch;
+ struct interface *ifp;
+ enum json_type type;
+ json_object *json = NULL;
+ json_object *json_tmp = NULL;
+
+ json = json_object_new_object();
+
+ FOR_ALL_INTERFACES (pim->vrf, ifp) {
+ pim_ifp = ifp->info;
+ if (!pim_ifp)
+ continue;
+
+ RB_FOREACH (ch, pim_ifchannel_rb, &pim_ifp->ifchannel_rb) {
+ pim_show_membership_helper(vty, pim_ifp, ch, json);
+ } /* scan interface channels */
+ }
+
+ if (uj) {
+ vty_json(vty, json);
+ } else {
+ vty_out(vty,
+ "Interface Address Source Group Membership\n");
+
+ /*
+ * Example of the json data we are traversing
+ *
+ * {
+ * "swp3":{
+ * "name":"swp3",
+ * "state":"up",
+ * "address":"10.1.20.1",
+ * "index":5,
+ * "flagMulticast":true,
+ * "flagBroadcast":true,
+ * "lanDelayEnabled":true,
+ * "226.10.10.10":{
+ * "source":"*",
+ * "group":"226.10.10.10",
+ * "localMembership":"INCLUDE"
+ * }
+ * }
+ * }
+ */
+
+ /* foreach interface */
+ json_object_object_foreach(json, key, val)
+ {
+
+ /* Find all of the keys where the val is an object. In
+ * the example
+ * above the only one is 226.10.10.10
+ */
+ json_object_object_foreach(val, if_field_key,
+ if_field_val)
+ {
+ type = json_object_get_type(if_field_val);
+
+ if (type == json_type_object) {
+ vty_out(vty, "%-16s ", key);
+
+ json_object_object_get_ex(
+ val, "address", &json_tmp);
+ vty_out(vty, "%-15s ",
+ json_object_get_string(
+ json_tmp));
+
+ json_object_object_get_ex(if_field_val,
+ "source",
+ &json_tmp);
+ vty_out(vty, "%-15s ",
+ json_object_get_string(
+ json_tmp));
+
+ /* Group */
+ vty_out(vty, "%-15s ", if_field_key);
+
+ json_object_object_get_ex(
+ if_field_val, "localMembership",
+ &json_tmp);
+ vty_out(vty, "%-10s\n",
+ json_object_get_string(
+ json_tmp));
+ }
+ }
+ }
+ json_object_free(json);
+ }
+}
+
+static void pim_show_channel_helper(struct pim_instance *pim, struct vty *vty,
+ struct pim_interface *pim_ifp,
+ struct pim_ifchannel *ch, json_object *json,
+ bool uj)
+{
+ struct pim_upstream *up = ch->upstream;
+ json_object *json_group = NULL;
+ json_object *json_row = NULL;
+
+ if (uj) {
+ char grp_str[PIM_ADDRSTRLEN];
+
+ snprintfrr(grp_str, sizeof(grp_str), "%pPAs", &up->sg.grp);
+ 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_pim_upstream_add(json_row, up);
+ json_object_string_add(json_row, "interface",
+ ch->interface->name);
+ json_object_string_addf(json_row, "source", "%pPAs",
+ &up->sg.src);
+ json_object_string_addf(json_row, "group", "%pPAs",
+ &up->sg.grp);
+
+ if (pim_macro_ch_lost_assert(ch))
+ json_object_boolean_true_add(json_row, "lostAssert");
+
+ if (pim_macro_chisin_joins(ch))
+ json_object_boolean_true_add(json_row, "joins");
+
+ if (pim_macro_chisin_pim_include(ch))
+ json_object_boolean_true_add(json_row, "pimInclude");
+
+ if (pim_upstream_evaluate_join_desired(pim, up))
+ json_object_boolean_true_add(json_row,
+ "evaluateJoinDesired");
+
+ json_object_object_addf(json_group, json_row, "%pPAs",
+ &up->sg.src);
+
+ } else {
+ vty_out(vty,
+ "%-16s %-15pPAs %-15pPAs %-10s %-5s %-10s %-11s %-6s\n",
+ ch->interface->name, &up->sg.src, &up->sg.grp,
+ pim_macro_ch_lost_assert(ch) ? "yes" : "no",
+ pim_macro_chisin_joins(ch) ? "yes" : "no",
+ pim_macro_chisin_pim_include(ch) ? "yes" : "no",
+ PIM_UPSTREAM_FLAG_TEST_DR_JOIN_DESIRED(up->flags)
+ ? "yes"
+ : "no",
+ pim_upstream_evaluate_join_desired(pim, up) ? "yes"
+ : "no");
+ }
+}
+
+void pim_show_channel(struct pim_instance *pim, struct vty *vty, bool uj)
+{
+ struct pim_interface *pim_ifp;
+ struct pim_ifchannel *ch;
+ struct interface *ifp;
+
+ json_object *json = NULL;
+
+ if (uj)
+ json = json_object_new_object();
+ else
+ vty_out(vty,
+ "Interface Source Group LostAssert Joins PimInclude JoinDesired EvalJD\n");
+
+ /* scan per-interface (S,G) state */
+ FOR_ALL_INTERFACES (pim->vrf, ifp) {
+ pim_ifp = ifp->info;
+ if (!pim_ifp)
+ continue;
+
+
+ RB_FOREACH (ch, pim_ifchannel_rb, &pim_ifp->ifchannel_rb) {
+ /* scan all interfaces */
+ pim_show_channel_helper(pim, vty, pim_ifp, ch, json,
+ uj);
+ }
+ }
+
+ if (uj)
+ vty_json(vty, json);
+}
+
+void pim_show_interfaces(struct pim_instance *pim, struct vty *vty, bool mlag,
+ json_object *json)
+{
+ struct interface *ifp;
+ struct pim_interface *pim_ifp;
+ struct pim_upstream *up;
+ int fhr = 0;
+ int pim_nbrs = 0;
+ int pim_ifchannels = 0;
+ bool uj = true;
+ json_object *json_row = NULL;
+ json_object *json_tmp;
+
+ if (!json) {
+ uj = false;
+ json = json_object_new_object();
+ }
+
+ FOR_ALL_INTERFACES (pim->vrf, ifp) {
+ pim_ifp = ifp->info;
+
+ 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;
+
+ frr_each (rb_pim_upstream, &pim->upstream_head, up)
+ if (ifp == up->rpf.source_nexthop.interface)
+ if (up->flags & PIM_UPSTREAM_FLAG_MASK_FHR)
+ fhr++;
+
+ json_row = json_object_new_object();
+ json_object_pim_ifp_add(json_row, ifp);
+ json_object_int_add(json_row, "pimNeighbors", pim_nbrs);
+ json_object_int_add(json_row, "pimIfChannels", pim_ifchannels);
+ json_object_int_add(json_row, "firstHopRouterCount", fhr);
+ json_object_string_addf(json_row, "pimDesignatedRouter",
+ "%pPAs", &pim_ifp->pim_dr_addr);
+
+ if (pim_addr_cmp(pim_ifp->pim_dr_addr,
+ pim_ifp->primary_address))
+ json_object_boolean_true_add(
+ json_row, "pimDesignatedRouterLocal");
+
+ json_object_object_add(json, ifp->name, json_row);
+ }
+
+ if (!uj) {
+ vty_out(vty,
+ "Interface State Address PIM Nbrs PIM DR FHR IfChannels\n");
+
+ json_object_object_foreach(json, key, val)
+ {
+ vty_out(vty, "%-16s ", key);
+
+ json_object_object_get_ex(val, "state", &json_tmp);
+ vty_out(vty, "%5s ", 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));
+
+ json_object_object_get_ex(val, "pimNeighbors",
+ &json_tmp);
+ vty_out(vty, "%8d ", json_object_get_int(json_tmp));
+
+ if (json_object_object_get_ex(
+ val, "pimDesignatedRouterLocal",
+ &json_tmp)) {
+ vty_out(vty, "%15s ", "local");
+ } else {
+ json_object_object_get_ex(
+ val, "pimDesignatedRouter", &json_tmp);
+ vty_out(vty, "%15s ",
+ 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));
+
+ json_object_object_get_ex(val, "pimIfChannels",
+ &json_tmp);
+ vty_out(vty, "%9d\n", json_object_get_int(json_tmp));
+ }
+ }
+}
+
+void pim_show_interfaces_single(struct pim_instance *pim, struct vty *vty,
+ const char *ifname, bool mlag,
+ json_object *json)
+{
+ pim_addr ifaddr;
+ struct interface *ifp;
+ struct listnode *neighnode;
+ struct pim_interface *pim_ifp;
+ struct pim_neighbor *neigh;
+ struct pim_upstream *up;
+ time_t now;
+ char dr_str[PIM_ADDRSTRLEN];
+ char dr_uptime[10];
+ char expire[10];
+ char grp_str[PIM_ADDRSTRLEN];
+ char hello_period[10];
+ char hello_timer[10];
+ char neigh_src_str[PIM_ADDRSTRLEN];
+ char src_str[PIM_ADDRSTRLEN];
+ char stat_uptime[10];
+ char uptime[10];
+ int found_ifname = 0;
+ int print_header;
+ json_object *json_row = NULL;
+ json_object *json_pim_neighbor = NULL;
+ json_object *json_pim_neighbors = NULL;
+ json_object *json_group = NULL;
+ json_object *json_group_source = NULL;
+ json_object *json_fhr_sources = NULL;
+ struct pim_secondary_addr *sec_addr;
+ struct listnode *sec_node;
+
+ now = pim_time_monotonic_sec();
+
+ FOR_ALL_INTERFACES (pim->vrf, ifp) {
+ pim_ifp = ifp->info;
+
+ if (!pim_ifp)
+ continue;
+
+ if (mlag == true && pim_ifp->activeactive == false)
+ continue;
+
+ if (strcmp(ifname, "detail") && strcmp(ifname, ifp->name))
+ continue;
+
+ found_ifname = 1;
+ ifaddr = pim_ifp->primary_address;
+ snprintfrr(dr_str, sizeof(dr_str), "%pPAs",
+ &pim_ifp->pim_dr_addr);
+ pim_time_uptime_begin(dr_uptime, sizeof(dr_uptime), now,
+ pim_ifp->pim_dr_election_last);
+ pim_time_timer_to_hhmmss(hello_timer, sizeof(hello_timer),
+ pim_ifp->t_pim_hello_timer);
+ pim_time_mmss(hello_period, sizeof(hello_period),
+ pim_ifp->pim_hello_period);
+ pim_time_uptime(stat_uptime, sizeof(stat_uptime),
+ now - pim_ifp->pim_ifstat_start);
+
+ if (json) {
+ json_row = json_object_new_object();
+ json_object_pim_ifp_add(json_row, ifp);
+
+ if (!pim_addr_is_any(pim_ifp->update_source)) {
+ json_object_string_addf(
+ json_row, "useSource", "%pPAs",
+ &pim_ifp->update_source);
+ }
+ if (pim_ifp->sec_addr_list) {
+ json_object *sec_list = NULL;
+
+ sec_list = json_object_new_array();
+ for (ALL_LIST_ELEMENTS_RO(
+ pim_ifp->sec_addr_list, sec_node,
+ sec_addr)) {
+ json_object_array_add(
+ sec_list,
+ json_object_new_stringf(
+ "%pFXh",
+ &sec_addr->addr));
+ }
+ json_object_object_add(json_row,
+ "secondaryAddressList",
+ sec_list);
+ }
+
+ /* PIM neighbors */
+ if (pim_ifp->pim_neighbor_list->count) {
+ json_pim_neighbors = json_object_new_object();
+
+ for (ALL_LIST_ELEMENTS_RO(
+ pim_ifp->pim_neighbor_list,
+ neighnode, neigh)) {
+ json_pim_neighbor =
+ json_object_new_object();
+ snprintfrr(neigh_src_str,
+ sizeof(neigh_src_str),
+ "%pPAs",
+ &neigh->source_addr);
+ pim_time_uptime(uptime, sizeof(uptime),
+ now - neigh->creation);
+ pim_time_timer_to_hhmmss(
+ expire, sizeof(expire),
+ neigh->t_expire_timer);
+
+ json_object_string_add(
+ json_pim_neighbor, "address",
+ neigh_src_str);
+ json_object_string_add(
+ json_pim_neighbor, "upTime",
+ uptime);
+ json_object_string_add(
+ json_pim_neighbor, "holdtime",
+ expire);
+
+ json_object_object_add(
+ json_pim_neighbors,
+ neigh_src_str,
+ json_pim_neighbor);
+ }
+
+ json_object_object_add(json_row, "neighbors",
+ json_pim_neighbors);
+ }
+
+ json_object_string_add(json_row, "drAddress", dr_str);
+ json_object_int_add(json_row, "drPriority",
+ pim_ifp->pim_dr_priority);
+ json_object_string_add(json_row, "drUptime", dr_uptime);
+ json_object_int_add(json_row, "drElections",
+ pim_ifp->pim_dr_election_count);
+ json_object_int_add(json_row, "drChanges",
+ pim_ifp->pim_dr_election_changes);
+
+ /* FHR */
+ frr_each (rb_pim_upstream, &pim->upstream_head, up) {
+ if (ifp != up->rpf.source_nexthop.interface)
+ continue;
+
+ if (!(up->flags & PIM_UPSTREAM_FLAG_MASK_FHR))
+ continue;
+
+ if (!json_fhr_sources)
+ json_fhr_sources =
+ json_object_new_object();
+
+ snprintfrr(grp_str, sizeof(grp_str), "%pPAs",
+ &up->sg.grp);
+ snprintfrr(src_str, sizeof(src_str), "%pPAs",
+ &up->sg.src);
+ pim_time_uptime(uptime, sizeof(uptime),
+ now - up->state_transition);
+
+ /*
+ * Does this group live in json_fhr_sources?
+ * If not create it.
+ */
+ json_object_object_get_ex(json_fhr_sources,
+ grp_str, &json_group);
+
+ if (!json_group) {
+ json_group = json_object_new_object();
+ json_object_object_add(json_fhr_sources,
+ grp_str,
+ json_group);
+ }
+
+ json_group_source = json_object_new_object();
+ json_object_string_add(json_group_source,
+ "source", src_str);
+ json_object_string_add(json_group_source,
+ "group", grp_str);
+ json_object_string_add(json_group_source,
+ "upTime", uptime);
+ json_object_object_add(json_group, src_str,
+ json_group_source);
+ }
+
+ if (json_fhr_sources) {
+ json_object_object_add(json_row,
+ "firstHopRouter",
+ json_fhr_sources);
+ }
+
+ json_object_int_add(json_row, "helloPeriod",
+ pim_ifp->pim_hello_period);
+ json_object_int_add(json_row, "holdTime",
+ PIM_IF_DEFAULT_HOLDTIME(pim_ifp));
+ json_object_string_add(json_row, "helloTimer",
+ hello_timer);
+ json_object_string_add(json_row, "helloStatStart",
+ stat_uptime);
+ json_object_int_add(json_row, "helloReceived",
+ pim_ifp->pim_ifstat_hello_recv);
+ json_object_int_add(json_row, "helloReceivedFailed",
+ pim_ifp->pim_ifstat_hello_recvfail);
+ json_object_int_add(json_row, "helloSend",
+ pim_ifp->pim_ifstat_hello_sent);
+ json_object_int_add(json_row, "hellosendFailed",
+ pim_ifp->pim_ifstat_hello_sendfail);
+ json_object_int_add(json_row, "helloGenerationId",
+ pim_ifp->pim_generation_id);
+
+ json_object_int_add(
+ json_row, "effectivePropagationDelay",
+ pim_if_effective_propagation_delay_msec(ifp));
+ json_object_int_add(
+ json_row, "effectiveOverrideInterval",
+ pim_if_effective_override_interval_msec(ifp));
+ json_object_int_add(
+ json_row, "joinPruneOverrideInterval",
+ pim_if_jp_override_interval_msec(ifp));
+
+ json_object_int_add(
+ json_row, "propagationDelay",
+ pim_ifp->pim_propagation_delay_msec);
+ json_object_int_add(
+ json_row, "propagationDelayHighest",
+ pim_ifp->pim_neighbors_highest_propagation_delay_msec);
+ json_object_int_add(
+ json_row, "overrideInterval",
+ pim_ifp->pim_override_interval_msec);
+ json_object_int_add(
+ json_row, "overrideIntervalHighest",
+ pim_ifp->pim_neighbors_highest_override_interval_msec);
+ if (pim_ifp->bsm_enable)
+ json_object_boolean_true_add(json_row,
+ "bsmEnabled");
+ if (pim_ifp->ucast_bsm_accept)
+ json_object_boolean_true_add(json_row,
+ "ucastBsmEnabled");
+ json_object_object_add(json, ifp->name, json_row);
+
+ } else {
+ vty_out(vty, "Interface : %s\n", ifp->name);
+ vty_out(vty, "State : %s\n",
+ if_is_up(ifp) ? "up" : "down");
+ if (!pim_addr_is_any(pim_ifp->update_source)) {
+ vty_out(vty, "Use Source : %pPAs\n",
+ &pim_ifp->update_source);
+ }
+ if (pim_ifp->sec_addr_list) {
+ vty_out(vty, "Address : %pPAs (primary)\n",
+ &ifaddr);
+ for (ALL_LIST_ELEMENTS_RO(
+ pim_ifp->sec_addr_list, sec_node,
+ sec_addr))
+ vty_out(vty, " %pFX\n",
+ &sec_addr->addr);
+ } else {
+ vty_out(vty, "Address : %pPAs\n", &ifaddr);
+ }
+ vty_out(vty, "\n");
+
+ /* PIM neighbors */
+ print_header = 1;
+
+ for (ALL_LIST_ELEMENTS_RO(pim_ifp->pim_neighbor_list,
+ neighnode, neigh)) {
+
+ if (print_header) {
+ vty_out(vty, "PIM Neighbors\n");
+ vty_out(vty, "-------------\n");
+ print_header = 0;
+ }
+
+ snprintfrr(neigh_src_str, sizeof(neigh_src_str),
+ "%pPAs", &neigh->source_addr);
+ pim_time_uptime(uptime, sizeof(uptime),
+ now - neigh->creation);
+ pim_time_timer_to_hhmmss(expire, sizeof(expire),
+ neigh->t_expire_timer);
+ vty_out(vty,
+ "%-15s : up for %s, holdtime expires in %s\n",
+ neigh_src_str, uptime, expire);
+ }
+
+ if (!print_header) {
+ vty_out(vty, "\n");
+ vty_out(vty, "\n");
+ }
+
+ vty_out(vty, "Designated Router\n");
+ vty_out(vty, "-----------------\n");
+ vty_out(vty, "Address : %s\n", dr_str);
+ vty_out(vty, "Priority : %u(%d)\n",
+ pim_ifp->pim_dr_priority,
+ pim_ifp->pim_dr_num_nondrpri_neighbors);
+ vty_out(vty, "Uptime : %s\n", dr_uptime);
+ vty_out(vty, "Elections : %d\n",
+ pim_ifp->pim_dr_election_count);
+ vty_out(vty, "Changes : %d\n",
+ pim_ifp->pim_dr_election_changes);
+ vty_out(vty, "\n");
+ vty_out(vty, "\n");
+
+ /* FHR */
+ print_header = 1;
+ frr_each (rb_pim_upstream, &pim->upstream_head, up) {
+ if (!up->rpf.source_nexthop.interface)
+ continue;
+
+ if (strcmp(ifp->name,
+ up->rpf.source_nexthop
+ .interface->name) != 0)
+ continue;
+
+ if (!(up->flags & PIM_UPSTREAM_FLAG_MASK_FHR))
+ continue;
+
+ if (print_header) {
+ vty_out(vty,
+ "FHR - First Hop Router\n");
+ vty_out(vty,
+ "----------------------\n");
+ print_header = 0;
+ }
+
+ pim_time_uptime(uptime, sizeof(uptime),
+ now - up->state_transition);
+ vty_out(vty,
+ "%pPAs : %pPAs is a source, uptime is %s\n",
+ &up->sg.grp, &up->sg.src, uptime);
+ }
+
+ if (!print_header) {
+ vty_out(vty, "\n");
+ vty_out(vty, "\n");
+ }
+
+ vty_out(vty, "Hellos\n");
+ vty_out(vty, "------\n");
+ vty_out(vty, "Period : %d\n",
+ pim_ifp->pim_hello_period);
+ vty_out(vty, "HoldTime : %d\n",
+ PIM_IF_DEFAULT_HOLDTIME(pim_ifp));
+ vty_out(vty, "Timer : %s\n", hello_timer);
+ vty_out(vty, "StatStart : %s\n", stat_uptime);
+ vty_out(vty, "Receive : %d\n",
+ pim_ifp->pim_ifstat_hello_recv);
+ vty_out(vty, "Receive Failed : %d\n",
+ pim_ifp->pim_ifstat_hello_recvfail);
+ vty_out(vty, "Send : %d\n",
+ pim_ifp->pim_ifstat_hello_sent);
+ vty_out(vty, "Send Failed : %d\n",
+ pim_ifp->pim_ifstat_hello_sendfail);
+ vty_out(vty, "Generation ID : %08x\n",
+ pim_ifp->pim_generation_id);
+ vty_out(vty, "\n");
+ vty_out(vty, "\n");
+
+ pim_print_ifp_flags(vty, ifp);
+
+ vty_out(vty, "Join Prune Interval\n");
+ vty_out(vty, "-------------------\n");
+ vty_out(vty, "LAN Delay : %s\n",
+ pim_if_lan_delay_enabled(ifp) ? "yes" : "no");
+ vty_out(vty, "Effective Propagation Delay : %d msec\n",
+ pim_if_effective_propagation_delay_msec(ifp));
+ vty_out(vty, "Effective Override Interval : %d msec\n",
+ pim_if_effective_override_interval_msec(ifp));
+ vty_out(vty, "Join Prune Override Interval : %d msec\n",
+ pim_if_jp_override_interval_msec(ifp));
+ vty_out(vty, "\n");
+ vty_out(vty, "\n");
+
+ vty_out(vty, "LAN Prune Delay\n");
+ vty_out(vty, "---------------\n");
+ vty_out(vty, "Propagation Delay : %d msec\n",
+ pim_ifp->pim_propagation_delay_msec);
+ vty_out(vty, "Propagation Delay (Highest) : %d msec\n",
+ pim_ifp->pim_neighbors_highest_propagation_delay_msec);
+ vty_out(vty, "Override Interval : %d msec\n",
+ pim_ifp->pim_override_interval_msec);
+ vty_out(vty, "Override Interval (Highest) : %d msec\n",
+ pim_ifp->pim_neighbors_highest_override_interval_msec);
+ vty_out(vty, "\n");
+ vty_out(vty, "\n");
+
+ vty_out(vty, "BSM Status\n");
+ vty_out(vty, "----------\n");
+ vty_out(vty, "Bsm Enabled : %s\n",
+ pim_ifp->bsm_enable ? "yes" : "no");
+ vty_out(vty, "Unicast Bsm Enabled : %s\n",
+ pim_ifp->ucast_bsm_accept ? "yes" : "no");
+ vty_out(vty, "\n");
+ vty_out(vty, "\n");
+ }
+ }
+
+ if (!found_ifname)
+ vty_out(vty, "%% No such interface\n");
+}
+
+void ip_pim_ssm_show_group_range(struct pim_instance *pim, struct vty *vty,
+ bool uj)
+{
+ struct pim_ssm *ssm = pim->ssm_info;
+ const char *range_str =
+ ssm->plist_name ? ssm->plist_name : PIM_SSM_STANDARD_RANGE;
+
+ if (uj) {
+ json_object *json;
+
+ json = json_object_new_object();
+ json_object_string_add(json, "ssmGroups", range_str);
+ vty_json(vty, json);
+ } else
+ vty_out(vty, "SSM group range : %s\n", range_str);
+}
+
+struct pnc_cache_walk_data {
+ struct vty *vty;
+ struct pim_instance *pim;
+};
+
+static int pim_print_pnc_cache_walkcb(struct hash_bucket *bucket, void *arg)
+{
+ struct pim_nexthop_cache *pnc = bucket->data;
+ struct pnc_cache_walk_data *cwd = arg;
+ struct vty *vty = cwd->vty;
+ struct pim_instance *pim = cwd->pim;
+ struct nexthop *nh_node = NULL;
+ ifindex_t first_ifindex;
+ struct interface *ifp = NULL;
+ char buf[PREFIX_STRLEN];
+
+ for (nh_node = pnc->nexthop; nh_node; nh_node = nh_node->next) {
+ first_ifindex = nh_node->ifindex;
+ ifp = if_lookup_by_index(first_ifindex, pim->vrf->vrf_id);
+
+ vty_out(vty, "%-15s ",
+ inet_ntop(AF_INET, &pnc->rpf.rpf_addr.u.prefix4, buf,
+ sizeof(buf)));
+ vty_out(vty, "%-16s ", ifp ? ifp->name : "NULL");
+ vty_out(vty, "%pI4 ", &nh_node->gate.ipv4);
+ vty_out(vty, "\n");
+ }
+ return CMD_SUCCESS;
+}
+
+void pim_show_nexthop(struct pim_instance *pim, struct vty *vty)
+{
+ struct pnc_cache_walk_data cwd;
+
+ cwd.vty = vty;
+ cwd.pim = pim;
+ vty_out(vty, "Number of registered addresses: %lu\n",
+ pim->rpf_hash->count);
+ vty_out(vty, "Address Interface Nexthop\n");
+ vty_out(vty, "---------------------------------------------\n");
+
+ hash_walk(pim->rpf_hash, pim_print_pnc_cache_walkcb, &cwd);
+}
+
+void pim_show_neighbors_single(struct pim_instance *pim, struct vty *vty,
+ const char *neighbor, json_object *json)
+{
+ struct listnode *neighnode;
+ struct interface *ifp;
+ struct pim_interface *pim_ifp;
+ struct pim_neighbor *neigh;
+ time_t now;
+ int found_neighbor = 0;
+ int option_address_list;
+ int option_dr_priority;
+ int option_generation_id;
+ int option_holdtime;
+ int option_lan_prune_delay;
+ int option_t_bit;
+ char uptime[10];
+ char expire[10];
+ char neigh_src_str[PIM_ADDRSTRLEN];
+
+ json_object *json_ifp = NULL;
+ json_object *json_row = NULL;
+
+ now = pim_time_monotonic_sec();
+
+ FOR_ALL_INTERFACES (pim->vrf, ifp) {
+ pim_ifp = ifp->info;
+
+ if (!pim_ifp)
+ continue;
+
+ if (pim_ifp->pim_sock_fd < 0)
+ continue;
+
+ for (ALL_LIST_ELEMENTS_RO(pim_ifp->pim_neighbor_list, neighnode,
+ neigh)) {
+ snprintfrr(neigh_src_str, sizeof(neigh_src_str),
+ "%pPAs", &neigh->source_addr);
+
+ /*
+ * The user can specify either the interface name or the
+ * PIM neighbor IP.
+ * If this pim_ifp matches neither then skip.
+ */
+ if (strcmp(neighbor, "detail") &&
+ strcmp(neighbor, ifp->name) &&
+ strcmp(neighbor, neigh_src_str))
+ continue;
+
+ found_neighbor = 1;
+ pim_time_uptime(uptime, sizeof(uptime),
+ now - neigh->creation);
+ pim_time_timer_to_hhmmss(expire, sizeof(expire),
+ neigh->t_expire_timer);
+
+ option_address_list = 0;
+ option_dr_priority = 0;
+ option_generation_id = 0;
+ option_holdtime = 0;
+ option_lan_prune_delay = 0;
+ option_t_bit = 0;
+
+ if (PIM_OPTION_IS_SET(neigh->hello_options,
+ PIM_OPTION_MASK_ADDRESS_LIST))
+ option_address_list = 1;
+
+ if (PIM_OPTION_IS_SET(neigh->hello_options,
+ PIM_OPTION_MASK_DR_PRIORITY))
+ option_dr_priority = 1;
+
+ if (PIM_OPTION_IS_SET(neigh->hello_options,
+ PIM_OPTION_MASK_GENERATION_ID))
+ option_generation_id = 1;
+
+ if (PIM_OPTION_IS_SET(neigh->hello_options,
+ PIM_OPTION_MASK_HOLDTIME))
+ option_holdtime = 1;
+
+ if (PIM_OPTION_IS_SET(neigh->hello_options,
+ PIM_OPTION_MASK_LAN_PRUNE_DELAY))
+ option_lan_prune_delay = 1;
+
+ if (PIM_OPTION_IS_SET(
+ neigh->hello_options,
+ PIM_OPTION_MASK_CAN_DISABLE_JOIN_SUPPRESSION))
+ option_t_bit = 1;
+
+ if (json) {
+
+ /* Does this ifp live in json? If not create it
+ */
+ json_object_object_get_ex(json, ifp->name,
+ &json_ifp);
+
+ if (!json_ifp) {
+ json_ifp = json_object_new_object();
+ json_object_pim_ifp_add(json_ifp, ifp);
+ json_object_object_add(json, ifp->name,
+ json_ifp);
+ }
+
+ json_row = json_object_new_object();
+ json_object_string_add(json_row, "interface",
+ ifp->name);
+ json_object_string_add(json_row, "address",
+ neigh_src_str);
+ json_object_string_add(json_row, "upTime",
+ uptime);
+ json_object_string_add(json_row, "holdtime",
+ expire);
+ json_object_int_add(json_row, "drPriority",
+ neigh->dr_priority);
+ json_object_int_add(json_row, "generationId",
+ neigh->generation_id);
+
+ if (option_address_list)
+ json_object_boolean_true_add(
+ json_row,
+ "helloOptionAddressList");
+
+ if (option_dr_priority)
+ json_object_boolean_true_add(
+ json_row,
+ "helloOptionDrPriority");
+
+ if (option_generation_id)
+ json_object_boolean_true_add(
+ json_row,
+ "helloOptionGenerationId");
+
+ if (option_holdtime)
+ json_object_boolean_true_add(
+ json_row,
+ "helloOptionHoldtime");
+
+ if (option_lan_prune_delay)
+ json_object_boolean_true_add(
+ json_row,
+ "helloOptionLanPruneDelay");
+
+ if (option_t_bit)
+ json_object_boolean_true_add(
+ json_row, "helloOptionTBit");
+
+ json_object_object_add(json_ifp, neigh_src_str,
+ json_row);
+
+ } else {
+ vty_out(vty, "Interface : %s\n", ifp->name);
+ vty_out(vty, "Neighbor : %s\n", neigh_src_str);
+ vty_out(vty,
+ " Uptime : %s\n",
+ uptime);
+ vty_out(vty,
+ " Holdtime : %s\n",
+ expire);
+ vty_out(vty,
+ " DR Priority : %d\n",
+ neigh->dr_priority);
+ vty_out(vty,
+ " Generation ID : %08x\n",
+ neigh->generation_id);
+ vty_out(vty,
+ " Override Interval (msec) : %d\n",
+ neigh->override_interval_msec);
+ vty_out(vty,
+ " Propagation Delay (msec) : %d\n",
+ neigh->propagation_delay_msec);
+ vty_out(vty,
+ " Hello Option - Address List : %s\n",
+ option_address_list ? "yes" : "no");
+ vty_out(vty,
+ " Hello Option - DR Priority : %s\n",
+ option_dr_priority ? "yes" : "no");
+ vty_out(vty,
+ " Hello Option - Generation ID : %s\n",
+ option_generation_id ? "yes" : "no");
+ vty_out(vty,
+ " Hello Option - Holdtime : %s\n",
+ option_holdtime ? "yes" : "no");
+ vty_out(vty,
+ " Hello Option - LAN Prune Delay : %s\n",
+ option_lan_prune_delay ? "yes" : "no");
+ vty_out(vty,
+ " Hello Option - T-bit : %s\n",
+ option_t_bit ? "yes" : "no");
+ bfd_sess_show(vty, json_ifp,
+ neigh->bfd_session);
+ vty_out(vty, "\n");
+ }
+ }
+ }
+
+ if (!found_neighbor)
+ vty_out(vty, "%% No such interface or neighbor\n");
+}
+
+void pim_show_neighbors(struct pim_instance *pim, struct vty *vty,
+ json_object *json)
+{
+ struct listnode *neighnode;
+ struct interface *ifp;
+ struct pim_interface *pim_ifp;
+ struct pim_neighbor *neigh;
+ time_t now;
+ char uptime[10];
+ char expire[10];
+ char neigh_src_str[PIM_ADDRSTRLEN];
+ json_object *json_ifp_rows = NULL;
+ json_object *json_row = NULL;
+
+ now = pim_time_monotonic_sec();
+
+ if (!json) {
+ vty_out(vty,
+ "Interface Neighbor Uptime Holdtime DR Pri\n");
+ }
+
+ FOR_ALL_INTERFACES (pim->vrf, ifp) {
+ pim_ifp = ifp->info;
+
+ if (!pim_ifp)
+ continue;
+
+ if (pim_ifp->pim_sock_fd < 0)
+ continue;
+
+ if (json)
+ json_ifp_rows = json_object_new_object();
+
+ for (ALL_LIST_ELEMENTS_RO(pim_ifp->pim_neighbor_list, neighnode,
+ neigh)) {
+ snprintfrr(neigh_src_str, sizeof(neigh_src_str),
+ "%pPAs", &neigh->source_addr);
+ pim_time_uptime(uptime, sizeof(uptime),
+ now - neigh->creation);
+ pim_time_timer_to_hhmmss(expire, sizeof(expire),
+ neigh->t_expire_timer);
+
+ if (json) {
+ json_row = json_object_new_object();
+ json_object_string_add(json_row, "interface",
+ ifp->name);
+ json_object_string_add(json_row, "neighbor",
+ neigh_src_str);
+ json_object_string_add(json_row, "upTime",
+ uptime);
+ json_object_string_add(json_row, "holdTime",
+ expire);
+ json_object_int_add(json_row, "holdTimeMax",
+ neigh->holdtime);
+ json_object_int_add(json_row, "drPriority",
+ neigh->dr_priority);
+ json_object_object_add(json_ifp_rows,
+ neigh_src_str, json_row);
+
+ } else {
+ vty_out(vty, "%-16s %15s %8s %8s %6d\n",
+ ifp->name, neigh_src_str, uptime,
+ expire, neigh->dr_priority);
+ }
+ }
+
+ if (json) {
+ json_object_object_add(json, ifp->name, json_ifp_rows);
+ json_ifp_rows = NULL;
+ }
+ }
+}
diff --git a/pimd/pim_cmd_common.h b/pimd/pim_cmd_common.h
index b7e6b6ac80..00a9a56738 100644
--- a/pimd/pim_cmd_common.h
+++ b/pimd/pim_cmd_common.h
@@ -58,5 +58,48 @@ int pim_process_ip_mroute_cmd(struct vty *vty, const char *interface,
const char *group_str, const char *source_str);
int pim_process_no_ip_mroute_cmd(struct vty *vty, const char *interface,
const char *group_str, const char *src_str);
+void json_object_pim_upstream_add(json_object *json, struct pim_upstream *up);
+void pim_show_rpf(struct pim_instance *pim, struct vty *vty, json_object *json);
+void pim_show_neighbors_secondary(struct pim_instance *pim, struct vty *vty);
+void pim_show_state(struct pim_instance *pim, struct vty *vty,
+ const char *src_or_group, const char *group,
+ json_object *json);
+void pim_show_statistics(struct pim_instance *pim, struct vty *vty,
+ const char *ifname, bool uj);
+void pim_show_upstream(struct pim_instance *pim, struct vty *vty,
+ pim_sgaddr *sg, json_object *json);
+void pim_show_join_desired(struct pim_instance *pim, struct vty *vty, bool uj);
+void pim_show_upstream_rpf(struct pim_instance *pim, struct vty *vty, bool uj);
+void pim_show_rpf_refresh_stats(struct vty *vty, struct pim_instance *pim,
+ time_t now, json_object *json);
+bool pim_sgaddr_match(pim_sgaddr item, pim_sgaddr match);
+void json_object_pim_ifp_add(struct json_object *json, struct interface *ifp);
+void pim_print_ifp_flags(struct vty *vty, struct interface *ifp);
+void json_object_pim_upstream_add(json_object *json, struct pim_upstream *up);
+void pim_show_join(struct pim_instance *pim, struct vty *vty, pim_sgaddr *sg,
+ json_object *json);
+void pim_show_jp_agg_list(struct pim_instance *pim, struct vty *vty);
+void pim_show_membership(struct pim_instance *pim, struct vty *vty, bool uj);
+void pim_show_channel(struct pim_instance *pim, struct vty *vty, bool uj);
+void pim_show_interfaces(struct pim_instance *pim, struct vty *vty, bool mlag,
+ json_object *json);
+void pim_show_interfaces_single(struct pim_instance *pim, struct vty *vty,
+ const char *ifname, bool mlag,
+ json_object *json);
+void ip_pim_ssm_show_group_range(struct pim_instance *pim, struct vty *vty,
+ bool uj);
+void pim_show_nexthop(struct pim_instance *pim, struct vty *vty);
+void pim_show_neighbors_single(struct pim_instance *pim, struct vty *vty,
+ const char *neighbor, json_object *json);
+void pim_show_neighbors(struct pim_instance *pim, struct vty *vty,
+ json_object *json);
+/*
+ * Special Macro to allow us to get the correct pim_instance
+ */
+#define PIM_DECLVAR_CONTEXT(A, B) \
+ struct vrf *A = VTY_GET_CONTEXT(vrf); \
+ struct pim_instance *B = \
+ (vrf) ? vrf->info : pim_get_pim_instance(VRF_DEFAULT); \
+ vrf = (vrf) ? vrf : pim->vrf
#endif /* PIM_CMD_COMMON_H */
diff --git a/pimd/pim_iface.c b/pimd/pim_iface.c
index 4470d05663..a644d9cfec 100644
--- a/pimd/pim_iface.c
+++ b/pimd/pim_iface.c
@@ -150,13 +150,9 @@ struct pim_interface *pim_if_new(struct interface *ifp, bool igmp, bool pim,
assert(pim_ifp->gm_query_max_response_time_dsec <
pim_ifp->gm_default_query_interval);
- if (pim)
- PIM_IF_DO_PIM(pim_ifp->options);
+ pim_ifp->pim_enable = pim;
#if PIM_IPV == 4
- if (igmp)
- PIM_IF_DO_IGMP(pim_ifp->options);
-
- PIM_IF_DO_IGMP_LISTEN_ALLROUTERS(pim_ifp->options);
+ pim_ifp->igmp_enable = igmp;
#endif
pim_ifp->gm_join_list = NULL;
@@ -317,7 +313,7 @@ static int detect_primary_address_change(struct interface *ifp,
if (changed) {
/* Before updating pim_ifp send Hello time with 0 hold time */
- if (PIM_IF_TEST_PIM(pim_ifp->options)) {
+ if (pim_ifp->pim_enable) {
pim_hello_send(ifp, 0 /* zero-sec holdtime */);
}
pim_ifp->primary_address = new_prim_addr;
@@ -462,7 +458,7 @@ static void detect_address_change(struct interface *ifp, int force_prim_as_any,
if (changed) {
- if (!PIM_IF_TEST_PIM(pim_ifp->options)) {
+ if (!pim_ifp->pim_enable) {
return;
}
@@ -543,7 +539,7 @@ void pim_if_addr_add(struct connected *ifc)
#if PIM_IPV == 4
struct in_addr ifaddr = ifc->address->u.prefix4;
- if (PIM_IF_TEST_IGMP(pim_ifp->options)) {
+ if (pim_ifp->igmp_enable) {
struct gm_sock *igmp;
/* lookup IGMP socket */
@@ -610,7 +606,7 @@ void pim_if_addr_add(struct connected *ifc)
} /* igmp mtrace only */
#endif
- if (PIM_IF_TEST_PIM(pim_ifp->options)) {
+ if (pim_ifp->pim_enable) {
if (!pim_addr_is_any(pim_ifp->primary_address)) {
@@ -802,7 +798,7 @@ void pim_if_addr_add_all(struct interface *ifp)
}
if (!v4_addrs && v6_addrs && !if_is_loopback(ifp)) {
- if (PIM_IF_TEST_PIM(pim_ifp->options)) {
+ if (pim_ifp->pim_enable) {
/* Interface has a valid primary address ? */
if (!pim_addr_is_any(pim_ifp->primary_address)) {
@@ -1211,7 +1207,7 @@ long pim_if_t_suppressed_msec(struct interface *ifp)
assert(pim_ifp);
/* join suppression disabled ? */
- if (PIM_IF_TEST_PIM_CAN_DISABLE_JOIN_SUPPRESSION(pim_ifp->options))
+ if (pim_ifp->pim_can_disable_join_suppression)
return 0;
/* t_suppressed = t_periodic * rand(1.1, 1.4) */
diff --git a/pimd/pim_iface.h b/pimd/pim_iface.h
index bab73eae86..b0f7e52ac2 100644
--- a/pimd/pim_iface.h
+++ b/pimd/pim_iface.h
@@ -34,31 +34,8 @@
#include "bfd.h"
#include "pim_str.h"
-#define PIM_IF_MASK_PIM (1 << 0)
-#define PIM_IF_MASK_IGMP (1 << 1)
-#define PIM_IF_MASK_IGMP_LISTEN_ALLROUTERS (1 << 2)
-#define PIM_IF_MASK_PIM_CAN_DISABLE_JOIN_SUPPRESSION (1 << 3)
-
#define PIM_IF_IS_DELETED(ifp) ((ifp)->ifindex == IFINDEX_INTERNAL)
-#define PIM_IF_TEST_PIM(options) (PIM_IF_MASK_PIM & (options))
-#define PIM_IF_TEST_IGMP(options) (PIM_IF_MASK_IGMP & (options))
-#define PIM_IF_TEST_IGMP_LISTEN_ALLROUTERS(options) (PIM_IF_MASK_IGMP_LISTEN_ALLROUTERS & (options))
-#define PIM_IF_TEST_PIM_CAN_DISABLE_JOIN_SUPPRESSION(options) \
- (PIM_IF_MASK_PIM_CAN_DISABLE_JOIN_SUPPRESSION & (options))
-
-#define PIM_IF_DO_PIM(options) ((options) |= PIM_IF_MASK_PIM)
-#define PIM_IF_DO_IGMP(options) ((options) |= PIM_IF_MASK_IGMP)
-#define PIM_IF_DO_IGMP_LISTEN_ALLROUTERS(options) ((options) |= PIM_IF_MASK_IGMP_LISTEN_ALLROUTERS)
-#define PIM_IF_DO_PIM_CAN_DISABLE_JOIN_SUPPRESSION(options) \
- ((options) |= PIM_IF_MASK_PIM_CAN_DISABLE_JOIN_SUPPRESSION)
-
-#define PIM_IF_DONT_PIM(options) ((options) &= ~PIM_IF_MASK_PIM)
-#define PIM_IF_DONT_IGMP(options) ((options) &= ~PIM_IF_MASK_IGMP)
-#define PIM_IF_DONT_IGMP_LISTEN_ALLROUTERS(options) ((options) &= ~PIM_IF_MASK_IGMP_LISTEN_ALLROUTERS)
-#define PIM_IF_DONT_PIM_CAN_DISABLE_JOIN_SUPPRESSION(options) \
- ((options) &= ~PIM_IF_MASK_PIM_CAN_DISABLE_JOIN_SUPPRESSION)
-
#define PIM_I_am_DR(pim_ifp) \
!pim_addr_cmp((pim_ifp)->pim_dr_addr, (pim_ifp)->primary_address)
#define PIM_I_am_DualActive(pim_ifp) (pim_ifp)->activeactive == true
@@ -93,6 +70,11 @@ struct pim_secondary_addr {
};
struct pim_interface {
+ bool pim_enable : 1;
+ bool pim_can_disable_join_suppression : 1;
+
+ bool igmp_enable : 1;
+
uint32_t options; /* bit vector */
ifindex_t mroute_vif_index;
struct pim_instance *pim;
diff --git a/pimd/pim_ifchannel.c b/pimd/pim_ifchannel.c
index f9fb8cf094..54cd824f9e 100644
--- a/pimd/pim_ifchannel.c
+++ b/pimd/pim_ifchannel.c
@@ -1155,7 +1155,7 @@ int pim_ifchannel_local_membership_add(struct interface *ifp, pim_sgaddr *sg,
return 0;
}
- if (!PIM_IF_TEST_PIM(pim_ifp->options)) {
+ if (!pim_ifp->pim_enable) {
if (PIM_DEBUG_EVENTS)
zlog_debug("%s:%pSG PIM is not configured on this interface %s",
__func__, sg, ifp->name);
@@ -1249,7 +1249,7 @@ void pim_ifchannel_local_membership_del(struct interface *ifp, pim_sgaddr *sg)
pim_ifp = ifp->info;
if (!pim_ifp)
return;
- if (!PIM_IF_TEST_PIM(pim_ifp->options))
+ if (!pim_ifp->pim_enable)
return;
orig = ch = pim_ifchannel_find(ifp, sg);
diff --git a/pimd/pim_igmp.c b/pimd/pim_igmp.c
index 57c4cdc470..6dea9f38f1 100644
--- a/pimd/pim_igmp.c
+++ b/pimd/pim_igmp.c
@@ -72,42 +72,42 @@ void igmp_anysource_forward_stop(struct gm_group *group)
}
static void igmp_source_forward_reevaluate_one(struct pim_instance *pim,
- struct gm_source *source)
+ struct gm_source *source,
+ int is_grp_ssm)
{
pim_sgaddr sg;
struct gm_group *group = source->source_group;
- struct pim_ifchannel *ch;
-
- if ((source->source_addr.s_addr != INADDR_ANY) ||
- !IGMP_SOURCE_TEST_FORWARDING(source->source_flags))
- return;
memset(&sg, 0, sizeof(sg));
sg.src = source->source_addr;
sg.grp = group->group_addr;
- ch = pim_ifchannel_find(group->interface, &sg);
- if (pim_is_grp_ssm(pim, group->group_addr)) {
- /* If SSM group withdraw local membership */
- if (ch &&
- (ch->local_ifmembership == PIM_IFMEMBERSHIP_INCLUDE)) {
- if (PIM_DEBUG_PIM_EVENTS)
- zlog_debug(
- "local membership del for %pSG as G is now SSM",
- &sg);
- pim_ifchannel_local_membership_del(group->interface,
- &sg);
+ /** if there is no PIM state **/
+ if (IGMP_SOURCE_TEST_FORWARDING(source->source_flags)) {
+ if (pim_addr_is_any(source->source_addr)) {
+ if (is_grp_ssm) {
+ if (PIM_DEBUG_PIM_EVENTS)
+ zlog_debug(
+ "local membership del for %pSG as G is now SSM",
+ &sg);
+ igmp_source_forward_stop(source);
+ }
+ } else {
+ if (!is_grp_ssm) {
+ if (PIM_DEBUG_PIM_EVENTS)
+ zlog_debug(
+ "local membership del for %pSG as G is now ASM",
+ &sg);
+ igmp_source_forward_stop(source);
+ }
}
} else {
- /* If ASM group add local membership */
- if (!ch ||
- (ch->local_ifmembership == PIM_IFMEMBERSHIP_NOINFO)) {
+ if (!pim_addr_is_any(source->source_addr) && (is_grp_ssm)) {
if (PIM_DEBUG_PIM_EVENTS)
zlog_debug(
- "local membership add for %pSG as G is now ASM",
+ "local membership add for %pSG as G is now SSM",
&sg);
- pim_ifchannel_local_membership_add(
- group->interface, &sg, false /*is_vxlan*/);
+ igmp_source_forward_start(pim, source);
}
}
}
@@ -130,6 +130,7 @@ void igmp_source_forward_reevaluate_all(struct pim_instance *pim)
grp)) {
struct listnode *srcnode;
struct gm_source *src;
+ int is_grp_ssm;
/*
* RFC 4604
@@ -139,16 +140,16 @@ void igmp_source_forward_reevaluate_all(struct pim_instance *pim)
* MODE_IS_EXCLUDE and CHANGE_TO_EXCLUDE_MODE
* requests in the SSM range.
*/
- if (pim_is_grp_ssm(pim, grp->group_addr) &&
- grp->group_filtermode_isexcl) {
+ is_grp_ssm = pim_is_grp_ssm(pim, grp->group_addr);
+ if (is_grp_ssm && grp->group_filtermode_isexcl) {
igmp_group_delete(grp);
} else {
/* scan group sources */
for (ALL_LIST_ELEMENTS_RO(
grp->group_source_list, srcnode,
src)) {
- igmp_source_forward_reevaluate_one(pim,
- src);
+ igmp_source_forward_reevaluate_one(
+ pim, src, is_grp_ssm);
} /* scan group sources */
}
} /* scan igmp groups */
@@ -179,6 +180,18 @@ void igmp_source_forward_start(struct pim_instance *pim,
IGMP_SOURCE_TEST_FORWARDING(source->source_flags));
}
+ /*
+ * PIM state should not be allowed for ASM group with valid source
+ * address.
+ */
+ if ((!pim_is_grp_ssm(pim, source->source_group->group_addr)) &&
+ !pim_addr_is_any(source->source_addr)) {
+ zlog_warn(
+ "%s: (S,G)=%pSG ASM range having source address, not allowed to create PIM state",
+ __func__, &sg);
+ return;
+ }
+
/* Prevent IGMP interface from installing multicast route multiple
times */
if (IGMP_SOURCE_TEST_FORWARDING(source->source_flags)) {
@@ -193,8 +206,8 @@ void igmp_source_forward_start(struct pim_instance *pim,
}
/*
- igmp_source_forward_stop: stop fowarding, but keep the source
- igmp_source_delete: stop fowarding, and delete the source
+ igmp_source_forward_stop: stop forwarding, but keep the source
+ igmp_source_delete: stop forwarding, and delete the source
*/
void igmp_source_forward_stop(struct gm_source *source)
{
@@ -242,17 +255,14 @@ static int igmp_sock_open(struct in_addr ifaddr, struct interface *ifp,
if (fd < 0)
return -1;
- if (PIM_IF_TEST_IGMP_LISTEN_ALLROUTERS(pim_options)) {
- if (inet_aton(PIM_ALL_ROUTERS, &group)) {
- if (!pim_socket_join(fd, group, ifaddr, ifp->ifindex,
- pim_ifp))
- ++join;
- } else {
- zlog_warn(
- "%s %s: IGMP socket fd=%d interface %pI4: could not solve %s to group address: errno=%d: %s",
- __FILE__, __func__, fd, &ifaddr,
- PIM_ALL_ROUTERS, errno, safe_strerror(errno));
- }
+ if (inet_aton(PIM_ALL_ROUTERS, &group)) {
+ if (!pim_socket_join(fd, group, ifaddr, ifp->ifindex, pim_ifp))
+ ++join;
+ } else {
+ zlog_warn(
+ "%s %s: IGMP socket fd=%d interface %pI4: could not solve %s to group address: errno=%d: %s",
+ __FILE__, __func__, fd, &ifaddr, PIM_ALL_ROUTERS, errno,
+ safe_strerror(errno));
}
/*
diff --git a/pimd/pim_igmpv3.c b/pimd/pim_igmpv3.c
index b6114f9ead..fb9b385338 100644
--- a/pimd/pim_igmpv3.c
+++ b/pimd/pim_igmpv3.c
@@ -340,8 +340,8 @@ static void source_channel_oil_detach(struct gm_source *source)
}
/*
- igmp_source_delete: stop fowarding, and delete the source
- igmp_source_forward_stop: stop fowarding, but keep the source
+ igmp_source_delete: stop forwarding, and delete the source
+ igmp_source_forward_stop: stop forwarding, but keep the source
*/
void igmp_source_delete(struct gm_source *source)
{
diff --git a/pimd/pim_mroute.c b/pimd/pim_mroute.c
index 7fc4f12d27..3015c4a61b 100644
--- a/pimd/pim_mroute.c
+++ b/pimd/pim_mroute.c
@@ -437,6 +437,28 @@ int pim_mroute_msg_wrvifwhole(int fd, struct interface *ifp, const char *buf)
pim_ifp->primary_address,
up->upstream_register);
up->sptbit = PIM_UPSTREAM_SPTBIT_TRUE;
+ } else {
+ /*
+ * At this point pimd is connected to
+ * the source, it has a parent, we are not
+ * the RP and the SPTBIT should be set
+ * since we know *the* S,G is on the SPT.
+ * The first time this happens, let's cause
+ * an immediate join to go out so that
+ * the RP can trim this guy immediately
+ * if necessary, instead of waiting
+ * one join/prune send cycle
+ */
+ if (up->sptbit != PIM_UPSTREAM_SPTBIT_TRUE &&
+ up->parent &&
+ up->rpf.source_nexthop.interface !=
+ up->parent->rpf.source_nexthop
+ .interface) {
+ up->sptbit = PIM_UPSTREAM_SPTBIT_TRUE;
+ pim_jp_agg_single_upstream_send(
+ &up->parent->rpf, up->parent,
+ true);
+ }
}
pim_upstream_keep_alive_timer_start(
up, pim_ifp->pim->keep_alive_time);
diff --git a/pimd/pim_nb_config.c b/pimd/pim_nb_config.c
index 7fe7c0395f..0f59f1d61b 100644
--- a/pimd/pim_nb_config.c
+++ b/pimd/pim_nb_config.c
@@ -63,8 +63,7 @@ static void pim_if_membership_clear(struct interface *ifp)
pim_ifp = ifp->info;
assert(pim_ifp);
- if (PIM_IF_TEST_PIM(pim_ifp->options)
- && PIM_IF_TEST_IGMP(pim_ifp->options)) {
+ if (pim_ifp->pim_enable && pim_ifp->igmp_enable) {
return;
}
@@ -90,9 +89,9 @@ static void pim_if_membership_refresh(struct interface *ifp)
pim_ifp = ifp->info;
assert(pim_ifp);
- if (!PIM_IF_TEST_PIM(pim_ifp->options))
+ if (!pim_ifp->pim_enable)
return;
- if (!PIM_IF_TEST_IGMP(pim_ifp->options))
+ if (!pim_ifp->igmp_enable)
return;
/*
@@ -143,7 +142,7 @@ static int pim_cmd_interface_add(struct interface *ifp)
if (!pim_ifp)
pim_ifp = pim_if_new(ifp, false, true, false, false);
else
- PIM_IF_DO_PIM(pim_ifp->options);
+ pim_ifp->pim_enable = true;
pim_if_addr_add_all(ifp);
pim_if_membership_refresh(ifp);
@@ -159,7 +158,7 @@ static int pim_cmd_interface_delete(struct interface *ifp)
if (!pim_ifp)
return 1;
- PIM_IF_DONT_PIM(pim_ifp->options);
+ pim_ifp->pim_enable = false;
pim_if_membership_clear(ifp);
@@ -169,7 +168,7 @@ static int pim_cmd_interface_delete(struct interface *ifp)
*/
pim_sock_delete(ifp, "pim unconfigured on interface");
- if (!PIM_IF_TEST_IGMP(pim_ifp->options)) {
+ if (!pim_ifp->igmp_enable) {
pim_if_addr_del_all(ifp);
pim_if_delete(ifp);
}
@@ -360,8 +359,8 @@ static int pim_cmd_igmp_start(struct interface *ifp)
pim_ifp = pim_if_new(ifp, true, false, false, false);
need_startup = 1;
} else {
- if (!PIM_IF_TEST_IGMP(pim_ifp->options)) {
- PIM_IF_DO_IGMP(pim_ifp->options);
+ if (!pim_ifp->igmp_enable) {
+ pim_ifp->igmp_enable = true;
need_startup = 1;
}
}
@@ -2537,13 +2536,13 @@ int lib_interface_gmp_address_family_destroy(struct nb_cb_destroy_args *args)
if (!pim_ifp)
return NB_OK;
- PIM_IF_DONT_IGMP(pim_ifp->options);
+ pim_ifp->igmp_enable = false;
pim_if_membership_clear(ifp);
pim_if_addr_del_all_igmp(ifp);
- if (!PIM_IF_TEST_PIM(pim_ifp->options))
+ if (!pim_ifp->pim_enable)
pim_if_delete(ifp);
}
@@ -2594,13 +2593,13 @@ int lib_interface_gmp_address_family_enable_modify(
if (!pim_ifp)
return NB_ERR_INCONSISTENCY;
- PIM_IF_DONT_IGMP(pim_ifp->options);
+ pim_ifp->igmp_enable = false;
pim_if_membership_clear(ifp);
pim_if_addr_del_all_igmp(ifp);
- if (!PIM_IF_TEST_PIM(pim_ifp->options))
+ if (!pim_ifp->pim_enable)
pim_if_delete(ifp);
}
}
diff --git a/pimd/pim_nht.c b/pimd/pim_nht.c
index 94dcfb8265..106bce61db 100644
--- a/pimd/pim_nht.c
+++ b/pimd/pim_nht.c
@@ -696,9 +696,7 @@ int pim_parse_nexthop_update(ZAPI_CALLBACK_ARGS)
int i;
struct pim_rpf rpf;
struct pim_nexthop_cache *pnc = NULL;
- struct pim_neighbor *nbr = NULL;
struct interface *ifp = NULL;
- struct interface *ifp1 = NULL;
struct vrf *vrf = vrf_lookup_by_id(vrf_id);
struct pim_instance *pim;
struct zapi_route nhr;
@@ -739,11 +737,6 @@ int pim_parse_nexthop_update(ZAPI_CALLBACK_ARGS)
for (i = 0; i < nhr.nexthop_num; i++) {
nexthop = nexthop_from_zapi_nexthop(&nhr.nexthops[i]);
switch (nexthop->type) {
- case NEXTHOP_TYPE_IPV4:
- case NEXTHOP_TYPE_IPV4_IFINDEX:
- case NEXTHOP_TYPE_IPV6:
- case NEXTHOP_TYPE_BLACKHOLE:
- break;
case NEXTHOP_TYPE_IFINDEX:
/*
* Connected route (i.e. no nexthop), use
@@ -760,31 +753,44 @@ int pim_parse_nexthop_update(ZAPI_CALLBACK_ARGS)
pnc->rpf.rpf_addr.u.prefix6;
#endif
break;
- case NEXTHOP_TYPE_IPV6_IFINDEX:
+#if PIM_IPV == 4
+ /* RFC5549 IPv4-over-IPv6 nexthop handling:
+ * if we get an IPv6 nexthop in IPv4 PIM, hunt down a
+ * PIM neighbor and use that instead.
+ */
+ case NEXTHOP_TYPE_IPV6_IFINDEX: {
+ struct interface *ifp1 = NULL;
+ struct pim_neighbor *nbr = NULL;
+
ifp1 = if_lookup_by_index(nexthop->ifindex,
pim->vrf->vrf_id);
if (!ifp1)
nbr = NULL;
else
+ /* FIXME: should really use nbr's
+ * secondary address list here
+ */
nbr = pim_neighbor_find_if(ifp1);
+
/* Overwrite with Nbr address as NH addr */
if (nbr)
-#if PIM_IPV == 4
nexthop->gate.ipv4 = nbr->source_addr;
-#else
- nexthop->gate.ipv6 = nbr->source_addr;
-#endif
- else {
+ else
// Mark nexthop address to 0 until PIM
// Nbr is resolved.
-#if PIM_IPV == 4
nexthop->gate.ipv4 = PIMADDR_ANY;
+
+ break;
+ }
#else
- nexthop->gate.ipv6 = PIMADDR_ANY;
+ case NEXTHOP_TYPE_IPV6_IFINDEX:
#endif
- }
-
+ case NEXTHOP_TYPE_IPV6:
+ case NEXTHOP_TYPE_IPV4:
+ case NEXTHOP_TYPE_IPV4_IFINDEX:
+ case NEXTHOP_TYPE_BLACKHOLE:
+ /* nothing to do for the other nexthop types */
break;
}
@@ -804,13 +810,18 @@ int pim_parse_nexthop_update(ZAPI_CALLBACK_ARGS)
continue;
}
- if (PIM_DEBUG_PIM_NHT)
+ if (PIM_DEBUG_PIM_NHT) {
+#if PIM_IPV == 4
+ pim_addr nhaddr = nexthop->gate.ipv4;
+#else
+ pim_addr nhaddr = nexthop->gate.ipv6;
+#endif
zlog_debug(
- "%s: NHT addr %pFX(%s) %d-nhop via %pI4(%s) type %d distance:%u metric:%u ",
+ "%s: NHT addr %pFX(%s) %d-nhop via %pPA(%s) type %d distance:%u metric:%u ",
__func__, &match, pim->vrf->name, i + 1,
- &nexthop->gate.ipv4, ifp->name,
- nexthop->type, nhr.distance,
- nhr.metric);
+ &nhaddr, ifp->name, nexthop->type,
+ nhr.distance, nhr.metric);
+ }
if (!ifp->info) {
/*
diff --git a/pimd/pim_pim.c b/pimd/pim_pim.c
index 50bbc0fe18..1baa5c38ca 100644
--- a/pimd/pim_pim.c
+++ b/pimd/pim_pim.c
@@ -526,11 +526,8 @@ void pim_sock_reset(struct interface *ifp)
PIM_DEFAULT_PROPAGATION_DELAY_MSEC;
pim_ifp->pim_override_interval_msec =
PIM_DEFAULT_OVERRIDE_INTERVAL_MSEC;
- if (PIM_DEFAULT_CAN_DISABLE_JOIN_SUPPRESSION) {
- PIM_IF_DO_PIM_CAN_DISABLE_JOIN_SUPPRESSION(pim_ifp->options);
- } else {
- PIM_IF_DONT_PIM_CAN_DISABLE_JOIN_SUPPRESSION(pim_ifp->options);
- }
+ pim_ifp->pim_can_disable_join_suppression =
+ PIM_DEFAULT_CAN_DISABLE_JOIN_SUPPRESSION;
/* neighbors without lan_delay */
pim_ifp->pim_number_of_nonlandelay_neighbors = 0;
@@ -702,8 +699,7 @@ static int hello_send(struct interface *ifp, uint16_t holdtime)
__func__, &qpim_all_pim_routers_addr, ifp->name,
holdtime, pim_ifp->pim_propagation_delay_msec,
pim_ifp->pim_override_interval_msec,
- PIM_IF_TEST_PIM_CAN_DISABLE_JOIN_SUPPRESSION(
- pim_ifp->options),
+ pim_ifp->pim_can_disable_join_suppression,
pim_ifp->pim_dr_priority, pim_ifp->pim_generation_id,
listcount(ifp->connected));
@@ -713,7 +709,7 @@ static int hello_send(struct interface *ifp, uint16_t holdtime)
pim_ifp->pim_dr_priority, pim_ifp->pim_generation_id,
pim_ifp->pim_propagation_delay_msec,
pim_ifp->pim_override_interval_msec,
- PIM_IF_TEST_PIM_CAN_DISABLE_JOIN_SUPPRESSION(pim_ifp->options));
+ pim_ifp->pim_can_disable_join_suppression);
if (pim_tlv_size < 0) {
return -1;
}
diff --git a/pimd/pim_rp.c b/pimd/pim_rp.c
index a552e77823..730870fb33 100644
--- a/pimd/pim_rp.c
+++ b/pimd/pim_rp.c
@@ -1147,20 +1147,17 @@ int pim_rp_config_write(struct pim_instance *pim, struct vty *vty,
}
void pim_rp_show_information(struct pim_instance *pim, struct prefix *range,
- struct vty *vty, bool uj)
+ struct vty *vty, json_object *json)
{
struct rp_info *rp_info;
struct rp_info *prev_rp_info = NULL;
struct listnode *node;
char source[7];
- json_object *json = NULL;
json_object *json_rp_rows = NULL;
json_object *json_row = NULL;
- if (uj)
- json = json_object_new_object();
- else
+ if (!json)
vty_out(vty,
"RP address group/prefix-list OIF I am RP Source Group-Type\n");
for (ALL_LIST_ELEMENTS_RO(pim->rp_list, node, rp_info)) {
@@ -1184,7 +1181,7 @@ void pim_rp_show_information(struct pim_instance *pim, struct prefix *range,
strlcpy(source, "BSR", sizeof(source));
else
strlcpy(source, "None", sizeof(source));
- if (uj) {
+ if (json) {
/*
* If we have moved on to a new RP then add the
* entry for the previous RP
@@ -1257,12 +1254,10 @@ void pim_rp_show_information(struct pim_instance *pim, struct prefix *range,
prev_rp_info = rp_info;
}
- if (uj) {
+ if (json) {
if (prev_rp_info && json_rp_rows)
json_object_object_addf(json, json_rp_rows, "%pFXh",
&prev_rp_info->rp.rpf_addr);
-
- vty_json(vty, json);
}
}
diff --git a/pimd/pim_rp.h b/pimd/pim_rp.h
index 04faeb5f26..e1bc71a3dc 100644
--- a/pimd/pim_rp.h
+++ b/pimd/pim_rp.h
@@ -25,6 +25,7 @@
#include "vty.h"
#include "plist.h"
#include "pim_rpf.h"
+#include "lib/json.h"
struct pim_interface;
@@ -79,7 +80,7 @@ struct pim_rpf *pim_rp_g(struct pim_instance *pim, pim_addr group);
#define RP(P, G) pim_rp_g ((P), (G))
void pim_rp_show_information(struct pim_instance *pim, struct prefix *range,
- struct vty *vty, bool uj);
+ struct vty *vty, json_object *json);
void pim_resolve_rp_nh(struct pim_instance *pim, struct pim_neighbor *nbr);
int pim_rp_list_cmp(void *v1, void *v2);
struct rp_info *pim_rp_find_match_group(struct pim_instance *pim,
diff --git a/pimd/pim_upstream.c b/pimd/pim_upstream.c
index 571117ac0a..af1254f791 100644
--- a/pimd/pim_upstream.c
+++ b/pimd/pim_upstream.c
@@ -647,7 +647,7 @@ void pim_upstream_register_reevaluate(struct pim_instance *pim)
* 2. and along the RPT if SPTbit is not set
* If forwarding is hw accelerated i.e. control and dataplane components
* are separate you may not be able to reliably set SPT bit on intermediate
- * routers while still fowarding on the (S,G,rpt).
+ * routers while still forwarding on the (S,G,rpt).
*
* This macro is a slight deviation on the RFC and uses "traffic-agnostic"
* criteria to decide between using the RPT vs. SPT for forwarding.
diff --git a/pimd/pim_vty.c b/pimd/pim_vty.c
index a0dea63b79..b360181f43 100644
--- a/pimd/pim_vty.c
+++ b/pimd/pim_vty.c
@@ -289,7 +289,7 @@ static int pim_igmp_config_write(struct vty *vty, int writes,
struct pim_interface *pim_ifp)
{
/* IF ip igmp */
- if (PIM_IF_TEST_IGMP(pim_ifp->options)) {
+ if (pim_ifp->igmp_enable) {
vty_out(vty, " ip igmp\n");
++writes;
}
@@ -361,7 +361,7 @@ int pim_config_write(struct vty *vty, int writes, struct interface *ifp,
{
struct pim_interface *pim_ifp = ifp->info;
- if (PIM_IF_TEST_PIM(pim_ifp->options)) {
+ if (pim_ifp->pim_enable) {
vty_out(vty, " " PIM_AF_NAME " pim\n");
++writes;
}
diff --git a/pimd/pim_vxlan.c b/pimd/pim_vxlan.c
index 5e55b9f9c8..120293dbfd 100644
--- a/pimd/pim_vxlan.c
+++ b/pimd/pim_vxlan.c
@@ -880,6 +880,12 @@ void pim_vxlan_mlag_update(bool enable, bool peer_state, uint32_t role,
*/
pim = pim_get_pim_instance(VRF_DEFAULT);
+ if (!pim) {
+ if (PIM_DEBUG_VXLAN)
+ zlog_debug("%s: Unable to find pim instance", __func__);
+ return;
+ }
+
if (enable)
vxlan_mlag.flags |= PIM_VXLAN_MLAGF_ENABLED;
else
@@ -1137,7 +1143,7 @@ void pim_vxlan_add_term_dev(struct pim_instance *pim,
/* enable pim on the term ifp */
pim_ifp = (struct pim_interface *)ifp->info;
if (pim_ifp) {
- PIM_IF_DO_PIM(pim_ifp->options);
+ pim_ifp->pim_enable = true;
/* ifp is already oper up; activate it as a term dev */
if (pim_ifp->mroute_vif_index >= 0)
pim_vxlan_term_oif_update(pim, ifp);
@@ -1165,8 +1171,8 @@ void pim_vxlan_del_term_dev(struct pim_instance *pim)
pim_ifp = (struct pim_interface *)ifp->info;
if (pim_ifp) {
- PIM_IF_DONT_PIM(pim_ifp->options);
- if (!PIM_IF_TEST_IGMP(pim_ifp->options))
+ pim_ifp->pim_enable = false;
+ if (!pim_ifp->igmp_enable)
pim_if_delete(ifp);
}
}
diff --git a/pimd/pim_zebra.c b/pimd/pim_zebra.c
index 7f463715a5..4bed8d5b73 100644
--- a/pimd/pim_zebra.c
+++ b/pimd/pim_zebra.c
@@ -166,6 +166,13 @@ static int pim_zebra_if_address_add(ZAPI_CALLBACK_ARGS)
struct pim_instance *pim;
pim = pim_get_pim_instance(vrf_id);
+ if (!pim) {
+ if (PIM_DEBUG_ZEBRA)
+ zlog_debug("%s: Unable to find pim instance",
+ __func__);
+ return 0;
+ }
+
pim_ifp->pim = pim;
pim_rp_check_on_if_add(pim_ifp);
diff --git a/pimd/pim_zlookup.c b/pimd/pim_zlookup.c
index c487f995e7..5d99f131a8 100644
--- a/pimd/pim_zlookup.c
+++ b/pimd/pim_zlookup.c
@@ -388,6 +388,12 @@ void zclient_lookup_read_pipe(struct thread *thread)
struct pim_zlookup_nexthop nexthop_tab[10];
struct in_addr l = {.s_addr = INADDR_ANY};
+ if (!pim) {
+ if (PIM_DEBUG_PIM_NHT_DETAIL)
+ zlog_debug("%s: Unable to find pim instance", __func__);
+ return;
+ }
+
zclient_lookup_nexthop_once(pim, nexthop_tab, 10, l);
thread_add_timer(router->master, zclient_lookup_read_pipe, zlookup, 60,
&zlookup_read);
diff --git a/ripd/rip_interface.c b/ripd/rip_interface.c
index 1269f25b35..042c9713b2 100644
--- a/ripd/rip_interface.c
+++ b/ripd/rip_interface.c
@@ -311,7 +311,7 @@ int if_check_address(struct rip *rip, struct in_addr addr)
return 0;
}
-/* Inteface link down message processing. */
+/* Interface link down message processing. */
static int rip_ifp_down(struct interface *ifp)
{
rip_interface_sync(ifp);
@@ -327,7 +327,7 @@ static int rip_ifp_down(struct interface *ifp)
return 0;
}
-/* Inteface link up message processing */
+/* Interface link up message processing */
static int rip_ifp_up(struct interface *ifp)
{
if (IS_RIP_DEBUG_ZEBRA)
@@ -351,7 +351,7 @@ static int rip_ifp_up(struct interface *ifp)
return 0;
}
-/* Inteface addition message from zebra. */
+/* Interface addition message from zebra. */
static int rip_ifp_create(struct interface *ifp)
{
rip_interface_sync(ifp);
@@ -617,7 +617,7 @@ int rip_interface_address_delete(ZAPI_CALLBACK_ARGS)
hook_call(rip_ifaddr_del, ifc);
- /* Chech wether this prefix needs to be removed */
+ /* Chech whether this prefix needs to be removed */
rip_apply_address_del(ifc);
}
@@ -628,7 +628,7 @@ int rip_interface_address_delete(ZAPI_CALLBACK_ARGS)
}
/* Check interface is enabled by network statement. */
-/* Check wether the interface has at least a connected prefix that
+/* Check whether the interface has at least a connected prefix that
* is within the ripng_enable_network table. */
static int rip_enable_network_lookup_if(struct interface *ifp)
{
@@ -663,7 +663,7 @@ static int rip_enable_network_lookup_if(struct interface *ifp)
return -1;
}
-/* Check wether connected is within the ripng_enable_network table. */
+/* Check whether connected is within the ripng_enable_network table. */
static int rip_enable_network_lookup2(struct connected *connected)
{
struct rip_interface *ri = connected->ifp->info;
@@ -840,7 +840,7 @@ static void rip_connect_set(struct interface *ifp, int set)
nh.ifindex = connected->ifp->ifindex;
nh.type = NEXTHOP_TYPE_IFINDEX;
if (set) {
- /* Check once more wether this prefix is within a
+ /* Check once more whether this prefix is within a
* "network IF_OR_PREF" one */
if ((rip_enable_if_lookup(rip, connected->ifp->name)
>= 0)
diff --git a/ripd/rip_routemap.c b/ripd/rip_routemap.c
index 061cefec30..4da5f945fe 100644
--- a/ripd/rip_routemap.c
+++ b/ripd/rip_routemap.c
@@ -461,7 +461,7 @@ static const struct route_map_rule_cmd route_set_metric_cmd = {
/* `set ip next-hop IP_ADDRESS' */
-/* Set nexthop to object. ojbect must be pointer to struct attr. */
+/* Set nexthop to object. object must be pointer to struct attr. */
static enum route_map_cmd_result_t
route_set_ip_nexthop(void *rule, const struct prefix *prefix,
@@ -515,7 +515,7 @@ static const struct route_map_rule_cmd route_set_ip_nexthop_cmd = {
/* `set tag TAG' */
-/* Set tag to object. ojbect must be pointer to struct attr. */
+/* Set tag to object. object must be pointer to struct attr. */
static enum route_map_cmd_result_t
route_set_tag(void *rule, const struct prefix *prefix, void *object)
{
diff --git a/ripngd/ripng_interface.c b/ripngd/ripng_interface.c
index 57bc40f005..5159a9825b 100644
--- a/ripngd/ripng_interface.c
+++ b/ripngd/ripng_interface.c
@@ -198,7 +198,7 @@ static int ripng_if_down(struct interface *ifp)
return 0;
}
-/* Inteface link up message processing. */
+/* Interface link up message processing. */
static int ripng_ifp_up(struct interface *ifp)
{
if (IS_RIPNG_DEBUG_ZEBRA)
@@ -222,7 +222,7 @@ static int ripng_ifp_up(struct interface *ifp)
return 0;
}
-/* Inteface link down message processing. */
+/* Interface link down message processing. */
static int ripng_ifp_down(struct interface *ifp)
{
ripng_interface_sync(ifp);
@@ -238,7 +238,7 @@ static int ripng_ifp_down(struct interface *ifp)
return 0;
}
-/* Inteface addition message from zebra. */
+/* Interface addition message from zebra. */
static int ripng_ifp_create(struct interface *ifp)
{
ripng_interface_sync(ifp);
@@ -432,7 +432,7 @@ int ripng_interface_address_delete(ZAPI_CALLBACK_ARGS)
"RIPng connected address %pFX delete",
p);
- /* Check wether this prefix needs to be removed. */
+ /* Check whether this prefix needs to be removed. */
ripng_apply_address_del(ifc);
}
connected_free(&ifc);
@@ -442,7 +442,7 @@ int ripng_interface_address_delete(ZAPI_CALLBACK_ARGS)
}
/* Lookup RIPng enable network. */
-/* Check wether the interface has at least a connected prefix that
+/* Check whether the interface has at least a connected prefix that
* is within the ripng->enable_network table. */
static int ripng_enable_network_lookup_if(struct interface *ifp)
{
@@ -477,7 +477,7 @@ static int ripng_enable_network_lookup_if(struct interface *ifp)
return -1;
}
-/* Check wether connected is within the ripng->enable_network table. */
+/* Check whether connected is within the ripng->enable_network table. */
static int ripng_enable_network_lookup2(struct connected *connected)
{
struct ripng_interface *ri = connected->ifp->info;
@@ -647,7 +647,7 @@ static void ripng_connect_set(struct interface *ifp, int set)
apply_mask_ipv6(&address);
if (set) {
- /* Check once more wether this prefix is within a
+ /* Check once more whether this prefix is within a
* "network IF_OR_PREF" one */
if ((ripng_enable_if_lookup(ripng, connected->ifp->name)
>= 0)
diff --git a/ripngd/ripng_routemap.c b/ripngd/ripng_routemap.c
index 9aed8d6963..4f2f9e2101 100644
--- a/ripngd/ripng_routemap.c
+++ b/ripngd/ripng_routemap.c
@@ -254,7 +254,7 @@ static const struct route_map_rule_cmd route_set_metric_cmd = {
/* `set ipv6 next-hop local IP_ADDRESS' */
-/* Set nexthop to object. ojbect must be pointer to struct attr. */
+/* Set nexthop to object. object must be pointer to struct attr. */
static enum route_map_cmd_result_t
route_set_ipv6_nexthop_local(void *rule, const struct prefix *p, void *object)
{
@@ -307,7 +307,7 @@ static const struct route_map_rule_cmd
/* `set tag TAG' */
-/* Set tag to object. ojbect must be pointer to struct attr. */
+/* Set tag to object. object must be pointer to struct attr. */
static enum route_map_cmd_result_t
route_set_tag(void *rule, const struct prefix *prefix, void *object)
{
diff --git a/staticd/static_zebra.c b/staticd/static_zebra.c
index af153b4bc3..bf0e4e8ab9 100644
--- a/staticd/static_zebra.c
+++ b/staticd/static_zebra.c
@@ -87,7 +87,7 @@ static struct static_nht_hash_head static_nht_hash[1];
struct zclient *zclient;
uint32_t zebra_ecmp_count = MULTIPATH_NUM;
-/* Inteface addition message from zebra. */
+/* Interface addition message from zebra. */
static int static_ifp_create(struct interface *ifp)
{
static_ifindex_update(ifp, true);
diff --git a/tests/lib/test_frrlua.c b/tests/lib/test_frrlua.c
index a81446f9ca..fb6b77c0f8 100644
--- a/tests/lib/test_frrlua.c
+++ b/tests/lib/test_frrlua.c
@@ -61,7 +61,7 @@ static void test_encode_decode(void)
assert(strncmp(p_a_str, p_b_str, sizeof(p_b_str)) == 0);
assert(lua_gettop(L) == 0);
- struct interface ifp_a;
+ struct interface ifp_a = {};
struct interface ifp_b = ifp_a;
lua_pushinterface(L, &ifp_a);
@@ -79,7 +79,7 @@ static void test_encode_decode(void)
assert(ifp_a.ll_type == ifp_b.ll_type);
assert(lua_gettop(L) == 0);
- struct in_addr addr_a;
+ struct in_addr addr_a = {};
struct in_addr addr_b = addr_a;
lua_pushinaddr(L, &addr_a);
@@ -87,7 +87,7 @@ static void test_encode_decode(void)
assert(addr_a.s_addr == addr_b.s_addr);
assert(lua_gettop(L) == 0);
- struct in6_addr in6addr_a;
+ struct in6_addr in6addr_a = {};
struct in6_addr in6addr_b = in6addr_a;
lua_pushin6addr(L, &in6addr_a);
diff --git a/tests/lib/test_grpc.py b/tests/lib/test_grpc.py
index 2e292fadc9..7f722de422 100644
--- a/tests/lib/test_grpc.py
+++ b/tests/lib/test_grpc.py
@@ -13,6 +13,10 @@ class TestGRPC(object):
'S["GRPC_TRUE"]=""\n' not in open("../config.status").readlines(),
reason="GRPC not enabled",
)
+ @pytest.mark.skipif(
+ not os.path.isdir("/usr/share/yang"),
+ reason="YANG models aren't installed in /usr/share/yang",
+ )
def test_exits_cleanly(self):
basedir = os.path.dirname(inspect.getsourcefile(type(self)))
program = os.path.join(basedir, self.program)
diff --git a/tests/topotests/bgp_as_allow_in/test_bgp_as_allow_in.py b/tests/topotests/bgp_as_allow_in/test_bgp_as_allow_in.py
index 961d72bd15..ec66c8caef 100644
--- a/tests/topotests/bgp_as_allow_in/test_bgp_as_allow_in.py
+++ b/tests/topotests/bgp_as_allow_in/test_bgp_as_allow_in.py
@@ -122,7 +122,7 @@ def setup_module(mod):
# ... and here it calls Mininet initialization functions.
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen)
# Creating configuration from JSON
diff --git a/tests/topotests/bgp_basic_functionality_topo1/test_bgp_basic_functionality.py b/tests/topotests/bgp_basic_functionality_topo1/test_bgp_basic_functionality.py
index f416f3d2a4..600bf3adc0 100644
--- a/tests/topotests/bgp_basic_functionality_topo1/test_bgp_basic_functionality.py
+++ b/tests/topotests/bgp_basic_functionality_topo1/test_bgp_basic_functionality.py
@@ -137,7 +137,7 @@ def setup_module(mod):
# ... and here it calls Mininet initialization functions.
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen)
# Creating configuration from JSON
diff --git a/tests/topotests/bgp_communities_topo1/test_bgp_communities.py b/tests/topotests/bgp_communities_topo1/test_bgp_communities.py
index 123461caa9..e4c25ff5cb 100644
--- a/tests/topotests/bgp_communities_topo1/test_bgp_communities.py
+++ b/tests/topotests/bgp_communities_topo1/test_bgp_communities.py
@@ -99,7 +99,7 @@ def setup_module(mod):
# ... and here it calls Mininet initialization functions.
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen)
# Creating configuration from JSON
diff --git a/tests/topotests/bgp_communities_topo1/test_bgp_communities_topo2.py b/tests/topotests/bgp_communities_topo1/test_bgp_communities_topo2.py
index 947efa8f8a..f6ee9ea795 100644
--- a/tests/topotests/bgp_communities_topo1/test_bgp_communities_topo2.py
+++ b/tests/topotests/bgp_communities_topo1/test_bgp_communities_topo2.py
@@ -103,7 +103,7 @@ def setup_module(mod):
# ... and here it calls Mininet initialization functions.
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen)
# Creating configuration from JSON
diff --git a/tests/topotests/bgp_community_change_update/test_bgp_community_change_update.py b/tests/topotests/bgp_community_change_update/test_bgp_community_change_update.py
index 8a7192be29..31f033ae12 100644
--- a/tests/topotests/bgp_community_change_update/test_bgp_community_change_update.py
+++ b/tests/topotests/bgp_community_change_update/test_bgp_community_change_update.py
@@ -169,7 +169,7 @@ def test_bgp_community_update_path_change():
if (
len(
tgen.gears["c1"].run(
- 'grep "10.0.1.2 rcvd 192.168.255.254/32 IPv4 unicast...duplicate ignored" bgpd.log'
+ 'grep "10.0.1.2(x1) rcvd 192.168.255.254/32 IPv4 unicast...duplicate ignored" bgpd.log'
)
)
> 0
diff --git a/tests/topotests/bgp_ecmp_topo2/test_ebgp_ecmp_topo2.py b/tests/topotests/bgp_ecmp_topo2/test_ebgp_ecmp_topo2.py
index ad999a1aff..2784e956fa 100644
--- a/tests/topotests/bgp_ecmp_topo2/test_ebgp_ecmp_topo2.py
+++ b/tests/topotests/bgp_ecmp_topo2/test_ebgp_ecmp_topo2.py
@@ -29,7 +29,7 @@ Following tests are covered to test ecmp functionality on EBGP.
3. Verify BGP table and RIB in DUT after clear BGP routes and neighbors.
4. Verify routes are cleared from BGP and RIB table of DUT when
redistribute static configuration is removed.
-5. Shut BGP neigbors one by one and verify BGP and routing table updated
+5. Shut BGP neighbors one by one and verify BGP and routing table updated
accordingly in DUT
6. Delete static routes and verify routers are cleared from BGP table and RIB
of DUT.
@@ -105,7 +105,7 @@ def setup_module(mod):
topo = tgen.json_topo
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen)
# Creating configuration from JSON
@@ -475,7 +475,7 @@ def test_ecmp_remove_redistribute_static(request):
@pytest.mark.parametrize("test_type", ["redist_static", "advertise_nw"])
def test_ecmp_shut_bgp_neighbor(request, test_type):
- """Shut BGP neigbors one by one and verify BGP and routing table updated
+ """Shut BGP neighbors one by one and verify BGP and routing table updated
accordingly in DUT"""
tc_name = request.node.name
diff --git a/tests/topotests/bgp_ecmp_topo2/test_ibgp_ecmp_topo2.py b/tests/topotests/bgp_ecmp_topo2/test_ibgp_ecmp_topo2.py
index 28047424b4..704e8fdf04 100644
--- a/tests/topotests/bgp_ecmp_topo2/test_ibgp_ecmp_topo2.py
+++ b/tests/topotests/bgp_ecmp_topo2/test_ibgp_ecmp_topo2.py
@@ -29,7 +29,7 @@ Following tests are covered to test ecmp functionality on EBGP.
3. Verify BGP table and RIB in DUT after clear BGP routes and neighbors.
4. Verify routes are cleared from BGP and RIB table of DUT when
redistribute static configuration is removed.
-5. Shut BGP neigbors one by one and verify BGP and routing table updated
+5. Shut BGP neighbors one by one and verify BGP and routing table updated
accordingly in DUT
6. Delete static routes and verify routers are cleared from BGP table and RIB
of DUT.
@@ -105,7 +105,7 @@ def setup_module(mod):
topo = tgen.json_topo
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen)
# Creating configuration from JSON
@@ -476,7 +476,7 @@ def test_ecmp_remove_redistribute_static(request):
@pytest.mark.parametrize("test_type", ["redist_static", "advertise_nw"])
def test_ecmp_shut_bgp_neighbor(request, test_type):
- """Shut BGP neigbors one by one and verify BGP and routing table updated
+ """Shut BGP neighbors one by one and verify BGP and routing table updated
accordingly in DUT"""
tc_name = request.node.name
diff --git a/tests/topotests/bgp_evpn_overlay_index_gateway/test_bgp_evpn_overlay_index_gateway.py b/tests/topotests/bgp_evpn_overlay_index_gateway/test_bgp_evpn_overlay_index_gateway.py
index 17f5fb08b9..c594079d4f 100755
--- a/tests/topotests/bgp_evpn_overlay_index_gateway/test_bgp_evpn_overlay_index_gateway.py
+++ b/tests/topotests/bgp_evpn_overlay_index_gateway/test_bgp_evpn_overlay_index_gateway.py
@@ -135,7 +135,7 @@ def setup_module(mod):
l3mdev_accept = 0
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
tgen.start_topology()
# Configure MAC address for hosts as these MACs are advertised with EVPN type-2 routes
diff --git a/tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1-1.py b/tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1-1.py
index 290bf16fea..f155325502 100644
--- a/tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1-1.py
+++ b/tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1-1.py
@@ -20,7 +20,7 @@
#
"""
-Following tests are covered to test BGP Gracefull Restart functionality.
+Following tests are covered to test BGP Graceful Restart functionality.
Basic Common Test steps for all the test case below :
- Create topology (setup module)
Creating 2 routers topology, r1, r2 in IBGP
@@ -81,7 +81,7 @@ Basic Common Test steps for all the test case below :
Global Mode : GR Restart
PerPeer Mode : None
GR Mode effective : GR Restart
-23. Transition from Peer-level disbale to Global inherit helper
+23. Transition from Peer-level disable to Global inherit helper
Global Mode : None
PerPeer Mode : GR Disable
GR Mode effective : GR Disable
@@ -176,7 +176,7 @@ def setup_module(mod):
# ... and here it calls Mininet initialization functions.
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen)
# Creating configuration from JSON
diff --git a/tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1-2.py b/tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1-2.py
index 0647ad5d06..dda3bd4b30 100644
--- a/tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1-2.py
+++ b/tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1-2.py
@@ -20,7 +20,7 @@
#
"""
-Following tests are covered to test BGP Gracefull Restart functionality.
+Following tests are covered to test BGP Graceful Restart functionality.
Basic Common Test steps for all the test case below :
- Create topology (setup module)
Creating 2 routers topology, r1, r2 in IBGP
@@ -81,7 +81,7 @@ Basic Common Test steps for all the test case below :
Global Mode : GR Restart
PerPeer Mode : None
GR Mode effective : GR Restart
-23. Transition from Peer-level disbale to Global inherit helper
+23. Transition from Peer-level disable to Global inherit helper
Global Mode : None
PerPeer Mode : GR Disable
GR Mode effective : GR Disable
@@ -176,7 +176,7 @@ def setup_module(mod):
# ... and here it calls Mininet initialization functions.
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen)
# Creating configuration from JSON
diff --git a/tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1-3.py b/tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1-3.py
index 0c3ff6451e..e4b533b295 100644
--- a/tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1-3.py
+++ b/tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1-3.py
@@ -20,7 +20,7 @@
#
"""
-Following tests are covered to test BGP Gracefull Restart functionality.
+Following tests are covered to test BGP Graceful Restart functionality.
Basic Common Test steps for all the test case below :
- Create topology (setup module)
Creating 2 routers topology, r1, r2 in IBGP
@@ -81,7 +81,7 @@ Basic Common Test steps for all the test case below :
Global Mode : GR Restart
PerPeer Mode : None
GR Mode effective : GR Restart
-23. Transition from Peer-level disbale to Global inherit helper
+23. Transition from Peer-level disable to Global inherit helper
Global Mode : None
PerPeer Mode : GR Disable
GR Mode effective : GR Disable
@@ -176,7 +176,7 @@ def setup_module(mod):
# ... and here it calls Mininet initialization functions.
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen)
# Creating configuration from JSON
diff --git a/tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1-4.py b/tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1-4.py
index 791ca37eae..835ef41de1 100644
--- a/tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1-4.py
+++ b/tests/topotests/bgp_gr_functionality_topo1/test_bgp_gr_functionality_topo1-4.py
@@ -20,7 +20,7 @@
#
"""
-Following tests are covered to test BGP Gracefull Restart functionality.
+Following tests are covered to test BGP Graceful Restart functionality.
Basic Common Test steps for all the test case below :
- Create topology (setup module)
Creating 2 routers topology, r1, r2 in IBGP
@@ -81,7 +81,7 @@ Basic Common Test steps for all the test case below :
Global Mode : GR Restart
PerPeer Mode : None
GR Mode effective : GR Restart
-23. Transition from Peer-level disbale to Global inherit helper
+23. Transition from Peer-level disable to Global inherit helper
Global Mode : None
PerPeer Mode : GR Disable
GR Mode effective : GR Disable
@@ -176,7 +176,7 @@ def setup_module(mod):
# ... and here it calls Mininet initialization functions.
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen)
# Creating configuration from JSON
@@ -1418,7 +1418,7 @@ def test_BGP_GR_TC_49_p1(request):
def BGP_GR_TC_52_p1(request):
"""
- Test Objective : Transition from Peer-level disbale to Global inherit helper
+ Test Objective : Transition from Peer-level disable to Global inherit helper
Global Mode : None
PerPeer Mode : GR Disable
GR Mode effective : GR Disable
diff --git a/tests/topotests/bgp_gr_functionality_topo2/test_bgp_gr_functionality_topo2-1.py b/tests/topotests/bgp_gr_functionality_topo2/test_bgp_gr_functionality_topo2-1.py
index 064fde1633..3afe38857b 100644
--- a/tests/topotests/bgp_gr_functionality_topo2/test_bgp_gr_functionality_topo2-1.py
+++ b/tests/topotests/bgp_gr_functionality_topo2/test_bgp_gr_functionality_topo2-1.py
@@ -173,7 +173,7 @@ def setup_module(mod):
# ... and here it calls Mininet initialization functions.
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen)
# Creating configuration from JSON
diff --git a/tests/topotests/bgp_gr_functionality_topo2/test_bgp_gr_functionality_topo2-2.py b/tests/topotests/bgp_gr_functionality_topo2/test_bgp_gr_functionality_topo2-2.py
index 4356c4d591..535f272ef4 100644
--- a/tests/topotests/bgp_gr_functionality_topo2/test_bgp_gr_functionality_topo2-2.py
+++ b/tests/topotests/bgp_gr_functionality_topo2/test_bgp_gr_functionality_topo2-2.py
@@ -173,7 +173,7 @@ def setup_module(mod):
# ... and here it calls Mininet initialization functions.
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen)
# Creating configuration from JSON
diff --git a/tests/topotests/bgp_gr_functionality_topo2/test_bgp_gr_functionality_topo2-3.py b/tests/topotests/bgp_gr_functionality_topo2/test_bgp_gr_functionality_topo2-3.py
index 86d676dd8b..a5c833dc5d 100644
--- a/tests/topotests/bgp_gr_functionality_topo2/test_bgp_gr_functionality_topo2-3.py
+++ b/tests/topotests/bgp_gr_functionality_topo2/test_bgp_gr_functionality_topo2-3.py
@@ -173,7 +173,7 @@ def setup_module(mod):
# ... and here it calls Mininet initialization functions.
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen)
# Creating configuration from JSON
diff --git a/tests/topotests/bgp_gr_functionality_topo2/test_bgp_gr_functionality_topo2-4.py b/tests/topotests/bgp_gr_functionality_topo2/test_bgp_gr_functionality_topo2-4.py
index 889f47f377..8671a79323 100644
--- a/tests/topotests/bgp_gr_functionality_topo2/test_bgp_gr_functionality_topo2-4.py
+++ b/tests/topotests/bgp_gr_functionality_topo2/test_bgp_gr_functionality_topo2-4.py
@@ -175,7 +175,7 @@ def setup_module(mod):
# ... and here it calls Mininet initialization functions.
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen)
# Creating configuration from JSON
diff --git a/tests/topotests/bgp_gr_functionality_topo3/bgp_gr_functionality_topo3.py b/tests/topotests/bgp_gr_functionality_topo3/bgp_gr_functionality_topo3.py
index c19ee06bab..6bf8b96309 100644
--- a/tests/topotests/bgp_gr_functionality_topo3/bgp_gr_functionality_topo3.py
+++ b/tests/topotests/bgp_gr_functionality_topo3/bgp_gr_functionality_topo3.py
@@ -266,7 +266,7 @@ def setup_module(mod):
# ... and here it calls Mininet initialization functions.
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen)
# Creating configuration from JSON
diff --git a/tests/topotests/bgp_gshut_topo1/test_ebgp_gshut_topo1.py b/tests/topotests/bgp_gshut_topo1/test_ebgp_gshut_topo1.py
index 14b8055d97..58133c44a9 100644
--- a/tests/topotests/bgp_gshut_topo1/test_ebgp_gshut_topo1.py
+++ b/tests/topotests/bgp_gshut_topo1/test_ebgp_gshut_topo1.py
@@ -108,7 +108,7 @@ def setup_module(mod):
# ... and here it calls Mininet initialization functions.
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen)
# Creating configuration from JSON
diff --git a/tests/topotests/bgp_gshut_topo1/test_ibgp_gshut_topo1.py b/tests/topotests/bgp_gshut_topo1/test_ibgp_gshut_topo1.py
index e842e64ada..a79ce0e3a0 100644
--- a/tests/topotests/bgp_gshut_topo1/test_ibgp_gshut_topo1.py
+++ b/tests/topotests/bgp_gshut_topo1/test_ibgp_gshut_topo1.py
@@ -103,7 +103,7 @@ def setup_module(mod):
# ... and here it calls Mininet initialization functions.
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen)
# Creating configuration from JSON
diff --git a/tests/topotests/bgp_ipv4_over_ipv6/test_rfc5549_ebgp_ibgp_nbr.py b/tests/topotests/bgp_ipv4_over_ipv6/test_rfc5549_ebgp_ibgp_nbr.py
index e9de3a5e15..68436177d8 100644
--- a/tests/topotests/bgp_ipv4_over_ipv6/test_rfc5549_ebgp_ibgp_nbr.py
+++ b/tests/topotests/bgp_ipv4_over_ipv6/test_rfc5549_ebgp_ibgp_nbr.py
@@ -123,7 +123,7 @@ def setup_module(mod):
topo = tgen.json_topo
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen)
# Creating configuration from JSON
@@ -155,7 +155,7 @@ def teardown_module():
def get_llip(onrouter, intf):
"""
- API to get the link local ipv6 address of a perticular interface
+ API to get the link local ipv6 address of a particular interface
Parameters
----------
@@ -182,7 +182,7 @@ def get_llip(onrouter, intf):
def get_glipv6(onrouter, intf):
"""
- API to get the global ipv6 address of a perticular interface
+ API to get the global ipv6 address of a particular interface
Parameters
----------
diff --git a/tests/topotests/bgp_ipv4_over_ipv6/test_rfc5549_ebgp_nbr.py b/tests/topotests/bgp_ipv4_over_ipv6/test_rfc5549_ebgp_nbr.py
index b31c8499e8..1d424caa30 100644
--- a/tests/topotests/bgp_ipv4_over_ipv6/test_rfc5549_ebgp_nbr.py
+++ b/tests/topotests/bgp_ipv4_over_ipv6/test_rfc5549_ebgp_nbr.py
@@ -133,7 +133,7 @@ def setup_module(mod):
topo = tgen.json_topo
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen)
# Creating configuration from JSON
@@ -161,7 +161,7 @@ def teardown_module():
def get_llip(onrouter, intf):
"""
- API to get the link local ipv6 address of a perticular interface
+ API to get the link local ipv6 address of a particular interface
Parameters
----------
@@ -188,7 +188,7 @@ def get_llip(onrouter, intf):
def get_glipv6(onrouter, intf):
"""
- API to get the global ipv6 address of a perticular interface
+ API to get the global ipv6 address of a particular interface
Parameters
----------
diff --git a/tests/topotests/bgp_ipv4_over_ipv6/test_rfc5549_ebgp_unnumbered_nbr.py b/tests/topotests/bgp_ipv4_over_ipv6/test_rfc5549_ebgp_unnumbered_nbr.py
index bc5c4ddcd7..16d6b1993d 100644
--- a/tests/topotests/bgp_ipv4_over_ipv6/test_rfc5549_ebgp_unnumbered_nbr.py
+++ b/tests/topotests/bgp_ipv4_over_ipv6/test_rfc5549_ebgp_unnumbered_nbr.py
@@ -126,7 +126,7 @@ def setup_module(mod):
topo = tgen.json_topo
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen)
# Creating configuration from JSON
@@ -154,7 +154,7 @@ def teardown_module():
def get_llip(onrouter, intf):
"""
- API to get the link local ipv6 address of a perticular interface
+ API to get the link local ipv6 address of a particular interface
Parameters
----------
@@ -181,7 +181,7 @@ def get_llip(onrouter, intf):
def get_glipv6(onrouter, intf):
"""
- API to get the global ipv6 address of a perticular interface
+ API to get the global ipv6 address of a particular interface
Parameters
----------
diff --git a/tests/topotests/bgp_ipv4_over_ipv6/test_rfc5549_ibgp_nbr.py b/tests/topotests/bgp_ipv4_over_ipv6/test_rfc5549_ibgp_nbr.py
index 3ce0293ffe..862cae42e9 100644
--- a/tests/topotests/bgp_ipv4_over_ipv6/test_rfc5549_ibgp_nbr.py
+++ b/tests/topotests/bgp_ipv4_over_ipv6/test_rfc5549_ibgp_nbr.py
@@ -124,7 +124,7 @@ def setup_module(mod):
topo = tgen.json_topo
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen)
# Creating configuration from JSON
@@ -152,7 +152,7 @@ def teardown_module():
def get_llip(onrouter, intf):
"""
- API to get the link local ipv6 address of a perticular interface
+ API to get the link local ipv6 address of a particular interface
Parameters
----------
@@ -180,7 +180,7 @@ def get_llip(onrouter, intf):
def get_glipv6(onrouter, intf):
"""
- API to get the global ipv6 address of a perticular interface
+ API to get the global ipv6 address of a particular interface
Parameters
----------
diff --git a/tests/topotests/bgp_ipv4_over_ipv6/test_rfc5549_ibgp_unnumbered_nbr.py b/tests/topotests/bgp_ipv4_over_ipv6/test_rfc5549_ibgp_unnumbered_nbr.py
index a5a8b5fe68..1a91257f06 100644
--- a/tests/topotests/bgp_ipv4_over_ipv6/test_rfc5549_ibgp_unnumbered_nbr.py
+++ b/tests/topotests/bgp_ipv4_over_ipv6/test_rfc5549_ibgp_unnumbered_nbr.py
@@ -112,7 +112,7 @@ def setup_module(mod):
topo = tgen.json_topo
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen)
# Creating configuration from JSON
@@ -141,7 +141,7 @@ def teardown_module():
def get_llip(onrouter, intf):
"""
- API to get the link local ipv6 address of a perticular interface
+ API to get the link local ipv6 address of a particular interface
Parameters
----------
@@ -169,7 +169,7 @@ def get_llip(onrouter, intf):
def get_glipv6(onrouter, intf):
"""
- API to get the global ipv6 address of a perticular interface
+ API to get the global ipv6 address of a particular interface
Parameters
----------
diff --git a/tests/topotests/bgp_large_community/test_bgp_large_community_topo_1.py b/tests/topotests/bgp_large_community/test_bgp_large_community_topo_1.py
index fa3598ff8e..03cfded514 100644
--- a/tests/topotests/bgp_large_community/test_bgp_large_community_topo_1.py
+++ b/tests/topotests/bgp_large_community/test_bgp_large_community_topo_1.py
@@ -141,7 +141,7 @@ def setup_module(mod):
# ... and here it calls Mininet initialization functions.
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen)
# Creating configuration from JSON
diff --git a/tests/topotests/bgp_large_community/test_bgp_large_community_topo_2.py b/tests/topotests/bgp_large_community/test_bgp_large_community_topo_2.py
index 6b62b2c5ee..b11cda3cd0 100644
--- a/tests/topotests/bgp_large_community/test_bgp_large_community_topo_2.py
+++ b/tests/topotests/bgp_large_community/test_bgp_large_community_topo_2.py
@@ -130,7 +130,7 @@ def setup_module(mod):
# ... and here it calls Mininet initialization functions.
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen)
# Creating configuration from JSON
diff --git a/tests/topotests/bgp_multi_vrf_topo1/test_bgp_multi_vrf_topo1.py b/tests/topotests/bgp_multi_vrf_topo1/test_bgp_multi_vrf_topo1.py
index fbe1b038e3..7eb5bda2d8 100644
--- a/tests/topotests/bgp_multi_vrf_topo1/test_bgp_multi_vrf_topo1.py
+++ b/tests/topotests/bgp_multi_vrf_topo1/test_bgp_multi_vrf_topo1.py
@@ -204,7 +204,7 @@ def setup_module(mod):
# ... and here it calls Mininet initialization functions.
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen)
# Creating configuration from JSON
diff --git a/tests/topotests/bgp_multi_vrf_topo2/test_bgp_multi_vrf_topo2.py b/tests/topotests/bgp_multi_vrf_topo2/test_bgp_multi_vrf_topo2.py
index 05961b1104..35e81d1c62 100644
--- a/tests/topotests/bgp_multi_vrf_topo2/test_bgp_multi_vrf_topo2.py
+++ b/tests/topotests/bgp_multi_vrf_topo2/test_bgp_multi_vrf_topo2.py
@@ -157,7 +157,7 @@ def setup_module(mod):
# ... and here it calls Mininet initialization functions.
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen)
# Creating configuration from JSON
diff --git a/tests/topotests/bgp_path_attributes_topo1/test_bgp_path_attributes.py b/tests/topotests/bgp_path_attributes_topo1/test_bgp_path_attributes.py
index 1bd4c233d8..870c2f7a10 100644
--- a/tests/topotests/bgp_path_attributes_topo1/test_bgp_path_attributes.py
+++ b/tests/topotests/bgp_path_attributes_topo1/test_bgp_path_attributes.py
@@ -115,7 +115,7 @@ def setup_module(mod):
# ... and here it calls Mininet initialization functions.
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen)
# Creating configuration from JSON
diff --git a/tests/topotests/bgp_prefix_list_topo1/test_prefix_lists.py b/tests/topotests/bgp_prefix_list_topo1/test_prefix_lists.py
index 64093497cb..2dc95cee21 100644
--- a/tests/topotests/bgp_prefix_list_topo1/test_prefix_lists.py
+++ b/tests/topotests/bgp_prefix_list_topo1/test_prefix_lists.py
@@ -100,7 +100,7 @@ def setup_module(mod):
# ... and here it calls Mininet initialization functions.
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen)
# Creating configuration from JSON
diff --git a/tests/topotests/bgp_recursive_route_ebgp_multi_hop/test_bgp_recursive_route_ebgp_multi_hop.py b/tests/topotests/bgp_recursive_route_ebgp_multi_hop/test_bgp_recursive_route_ebgp_multi_hop.py
index e255b4e88c..04f866f35b 100644
--- a/tests/topotests/bgp_recursive_route_ebgp_multi_hop/test_bgp_recursive_route_ebgp_multi_hop.py
+++ b/tests/topotests/bgp_recursive_route_ebgp_multi_hop/test_bgp_recursive_route_ebgp_multi_hop.py
@@ -130,7 +130,7 @@ def setup_module(mod):
# ... and here it calls Mininet initialization functions.
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen)
# Creating configuration from JSON
diff --git a/tests/topotests/bgp_route_aggregation/test_bgp_aggregation.py b/tests/topotests/bgp_route_aggregation/test_bgp_aggregation.py
index 1367d77e55..8c9d2c9dbf 100644
--- a/tests/topotests/bgp_route_aggregation/test_bgp_aggregation.py
+++ b/tests/topotests/bgp_route_aggregation/test_bgp_aggregation.py
@@ -119,7 +119,7 @@ def setup_module(mod):
# ... and here it calls Mininet initialization functions.
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen)
# Creating configuration from JSON
diff --git a/tests/topotests/bgp_route_map/test_route_map_topo1.py b/tests/topotests/bgp_route_map/test_route_map_topo1.py
index 6556c050bb..655a3dc899 100644
--- a/tests/topotests/bgp_route_map/test_route_map_topo1.py
+++ b/tests/topotests/bgp_route_map/test_route_map_topo1.py
@@ -131,7 +131,7 @@ def setup_module(mod):
# ... and here it calls Mininet initialization functions.
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen)
# Creating configuration from JSON
diff --git a/tests/topotests/bgp_route_map/test_route_map_topo2.py b/tests/topotests/bgp_route_map/test_route_map_topo2.py
index eccb2c1bf2..4da7eeb2ff 100644
--- a/tests/topotests/bgp_route_map/test_route_map_topo2.py
+++ b/tests/topotests/bgp_route_map/test_route_map_topo2.py
@@ -176,7 +176,7 @@ def setup_module(mod):
# ... and here it calls Mininet initialization functions.
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen)
# Creating configuration from JSON
diff --git a/tests/topotests/bgp_tcp_mss/test_bgp_vrf_tcp_mss.py b/tests/topotests/bgp_tcp_mss/test_bgp_vrf_tcp_mss.py
index c48bd8a439..7094c2805d 100644
--- a/tests/topotests/bgp_tcp_mss/test_bgp_vrf_tcp_mss.py
+++ b/tests/topotests/bgp_tcp_mss/test_bgp_vrf_tcp_mss.py
@@ -126,7 +126,7 @@ def setup_module(mod):
topo = tgen.json_topo
# ... and here it calls Mininet initialization functions.
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen)
# Creating configuration from JSON
build_config_from_json(tgen, topo)
diff --git a/tests/topotests/bgp_vrf_dynamic_route_leak/test_bgp_vrf_dynamic_route_leak_topo1.py b/tests/topotests/bgp_vrf_dynamic_route_leak/test_bgp_vrf_dynamic_route_leak_topo1.py
index 07ba0964d4..7d71ef761e 100644
--- a/tests/topotests/bgp_vrf_dynamic_route_leak/test_bgp_vrf_dynamic_route_leak_topo1.py
+++ b/tests/topotests/bgp_vrf_dynamic_route_leak/test_bgp_vrf_dynamic_route_leak_topo1.py
@@ -131,7 +131,7 @@ def setup_module(mod):
# ... and here it calls Mininet initialization functions.
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen)
# Run these tests for kernel version 4.19 or above
diff --git a/tests/topotests/bgp_vrf_dynamic_route_leak/test_bgp_vrf_dynamic_route_leak_topo2.py b/tests/topotests/bgp_vrf_dynamic_route_leak/test_bgp_vrf_dynamic_route_leak_topo2.py
index 8ba96ef7a0..391c272dbc 100644
--- a/tests/topotests/bgp_vrf_dynamic_route_leak/test_bgp_vrf_dynamic_route_leak_topo2.py
+++ b/tests/topotests/bgp_vrf_dynamic_route_leak/test_bgp_vrf_dynamic_route_leak_topo2.py
@@ -118,7 +118,7 @@ def setup_module(mod):
# ... and here it calls Mininet initialization functions.
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen)
# Run these tests for kernel version 4.19 or above
diff --git a/tests/topotests/bgp_vrf_dynamic_route_leak_topo3/test_bgp_vrf_dynamic_route_leak_topo3.py b/tests/topotests/bgp_vrf_dynamic_route_leak_topo3/test_bgp_vrf_dynamic_route_leak_topo3.py
index 1cf1b29097..a9aefc5003 100644
--- a/tests/topotests/bgp_vrf_dynamic_route_leak_topo3/test_bgp_vrf_dynamic_route_leak_topo3.py
+++ b/tests/topotests/bgp_vrf_dynamic_route_leak_topo3/test_bgp_vrf_dynamic_route_leak_topo3.py
@@ -126,7 +126,7 @@ def setup_module(mod):
# ... and here it calls Mininet initialization functions.
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen)
# Run these tests for kernel version 4.19 or above
diff --git a/tests/topotests/bgp_vrf_dynamic_route_leak_topo4/test_bgp_vrf_dynamic_route_leak_topo4.py b/tests/topotests/bgp_vrf_dynamic_route_leak_topo4/test_bgp_vrf_dynamic_route_leak_topo4.py
index 82daf08e18..97016caa75 100644
--- a/tests/topotests/bgp_vrf_dynamic_route_leak_topo4/test_bgp_vrf_dynamic_route_leak_topo4.py
+++ b/tests/topotests/bgp_vrf_dynamic_route_leak_topo4/test_bgp_vrf_dynamic_route_leak_topo4.py
@@ -127,7 +127,7 @@ def setup_module(mod):
# ... and here it calls Mininet initialization functions.
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen)
# Run these tests for kernel version 4.19 or above
diff --git a/tests/topotests/bgp_vrf_lite_best_path_test/test_bgp_vrf_lite_best_path_topo1.py b/tests/topotests/bgp_vrf_lite_best_path_test/test_bgp_vrf_lite_best_path_topo1.py
index d9d4f4f8b2..b95e71c2eb 100644
--- a/tests/topotests/bgp_vrf_lite_best_path_test/test_bgp_vrf_lite_best_path_topo1.py
+++ b/tests/topotests/bgp_vrf_lite_best_path_test/test_bgp_vrf_lite_best_path_topo1.py
@@ -129,7 +129,7 @@ def setup_module(mod):
# ... and here it calls Mininet initialization functions.
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen)
# Run these tests for kernel version 4.19 or above
diff --git a/tests/topotests/bgp_vrf_lite_best_path_test/test_bgp_vrf_lite_best_path_topo2.py b/tests/topotests/bgp_vrf_lite_best_path_test/test_bgp_vrf_lite_best_path_topo2.py
index e930b62706..9291fbd966 100644
--- a/tests/topotests/bgp_vrf_lite_best_path_test/test_bgp_vrf_lite_best_path_topo2.py
+++ b/tests/topotests/bgp_vrf_lite_best_path_test/test_bgp_vrf_lite_best_path_topo2.py
@@ -123,7 +123,7 @@ def setup_module(mod):
# ... and here it calls Mininet initialization functions.
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen)
# Run these tests for kernel version 4.19 or above
diff --git a/tests/topotests/evpn_type5_test_topo1/test_evpn_type5_chaos_topo1.py b/tests/topotests/evpn_type5_test_topo1/test_evpn_type5_chaos_topo1.py
index 72d1251d25..332ffdf6d5 100644
--- a/tests/topotests/evpn_type5_test_topo1/test_evpn_type5_chaos_topo1.py
+++ b/tests/topotests/evpn_type5_test_topo1/test_evpn_type5_chaos_topo1.py
@@ -141,7 +141,7 @@ def setup_module(mod):
# ... and here it calls Mininet initialization functions.
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen)
# Creating configuration from JSON
diff --git a/tests/topotests/evpn_type5_test_topo1/test_evpn_type5_topo1.py b/tests/topotests/evpn_type5_test_topo1/test_evpn_type5_topo1.py
index b3ff9d79ca..a641fec584 100644
--- a/tests/topotests/evpn_type5_test_topo1/test_evpn_type5_topo1.py
+++ b/tests/topotests/evpn_type5_test_topo1/test_evpn_type5_topo1.py
@@ -158,7 +158,7 @@ def setup_module(mod):
# ... and here it calls Mininet initialization functions.
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen)
# Creating configuration from JSON
diff --git a/tests/topotests/example_topojson_test/test_topo_json_multiple_links/test_example_topojson_multiple_links.py b/tests/topotests/example_topojson_test/test_topo_json_multiple_links/test_example_topojson_multiple_links.py
index 107b5e9624..fe4a256484 100755
--- a/tests/topotests/example_topojson_test/test_topo_json_multiple_links/test_example_topojson_multiple_links.py
+++ b/tests/topotests/example_topojson_test/test_topo_json_multiple_links/test_example_topojson_multiple_links.py
@@ -110,7 +110,7 @@ def setup_module(mod):
# ... and here it calls Mininet initialization functions.
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen)
# This function only purpose is to create configuration
diff --git a/tests/topotests/example_topojson_test/test_topo_json_single_link/test_example_topojson.py b/tests/topotests/example_topojson_test/test_topo_json_single_link/test_example_topojson.py
index b03215d21c..8bc28528dc 100755
--- a/tests/topotests/example_topojson_test/test_topo_json_single_link/test_example_topojson.py
+++ b/tests/topotests/example_topojson_test/test_topo_json_single_link/test_example_topojson.py
@@ -111,7 +111,7 @@ def setup_module(mod):
# ... and here it calls Mininet initialization functions.
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen)
# This function only purpose is to create configuration
diff --git a/tests/topotests/example_topojson_test/test_topo_json_single_link_loopback/test_example_topojson.py b/tests/topotests/example_topojson_test/test_topo_json_single_link_loopback/test_example_topojson.py
index 594b156f8b..caf0a7c138 100755
--- a/tests/topotests/example_topojson_test/test_topo_json_single_link_loopback/test_example_topojson.py
+++ b/tests/topotests/example_topojson_test/test_topo_json_single_link_loopback/test_example_topojson.py
@@ -112,7 +112,7 @@ def setup_module(mod):
# ... and here it calls Mininet initialization functions.
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen)
# This function only purpose is to create configuration
diff --git a/tests/topotests/lib/common_config.py b/tests/topotests/lib/common_config.py
index 0b97637c1e..564571c929 100644
--- a/tests/topotests/lib/common_config.py
+++ b/tests/topotests/lib/common_config.py
@@ -2928,7 +2928,7 @@ def addKernelRoute(
Parameters:
-----------
* `tgen` : Topogen object
- * `router`: router for which kernal routes needs to be added
+ * `router`: router for which kernel routes needs to be added
* `intf`: interface name, for which kernel routes needs to be added
* `bindToAddress`: bind to <host>, an interface or multicast
address
@@ -2969,7 +2969,7 @@ def addKernelRoute(
output = rnode.run(cmd)
def check_in_kernel(rnode, verify_cmd, grp_addr, router):
- # Verifying if ip route added to kernal
+ # Verifying if ip route added to kernel
errormsg = None
result = rnode.run(verify_cmd)
logger.debug("{}\n{}".format(verify_cmd, result))
@@ -4207,7 +4207,7 @@ def verify_bgp_community(tgen, addr_type, router, network, input_dict=None):
def get_ipv6_linklocal_address(topo, node, intf):
"""
- API to get the link local ipv6 address of a perticular interface
+ API to get the link local ipv6 address of a particular interface
Parameters
----------
diff --git a/tests/topotests/lib/pim.py b/tests/topotests/lib/pim.py
index 1f723eab93..b4a6358389 100644
--- a/tests/topotests/lib/pim.py
+++ b/tests/topotests/lib/pim.py
@@ -602,7 +602,7 @@ def verify_pim_neighbors(tgen, topo, dut=None, iface=None, nbr_ip=None, expected
return True
-@retry(retry_timeout=40)
+@retry(retry_timeout=40, diag_pct=0)
def verify_igmp_groups(tgen, dut, interface, group_addresses, expected=True):
"""
Verify IGMP groups are received from an intended interface
@@ -676,7 +676,7 @@ def verify_igmp_groups(tgen, dut, interface, group_addresses, expected=True):
return True
-@retry(retry_timeout=60)
+@retry(retry_timeout=60, diag_pct=0)
def verify_upstream_iif(
tgen,
dut,
@@ -959,7 +959,7 @@ def verify_join_state_and_timer(
return True
-@retry(retry_timeout=120)
+@retry(retry_timeout=120, diag_pct=0)
def verify_ip_mroutes(
tgen,
dut,
@@ -1164,7 +1164,7 @@ def verify_ip_mroutes(
return True if return_uptime == False else uptime_dict
-@retry(retry_timeout=60)
+@retry(retry_timeout=60, diag_pct=0)
def verify_pim_rp_info(
tgen,
topo,
@@ -1329,7 +1329,7 @@ def verify_pim_rp_info(
return True
-@retry(retry_timeout=60)
+@retry(retry_timeout=60, diag_pct=0)
def verify_pim_state(
tgen,
dut,
@@ -1516,7 +1516,7 @@ def get_pim_interface_traffic(tgen, input_dict):
return output_dict
-@retry(retry_timeout=40)
+@retry(retry_timeout=40, diag_pct=0)
def verify_pim_interface(
tgen, topo, dut, interface=None, interface_ip=None, expected=True
):
@@ -2295,7 +2295,7 @@ def verify_pim_grp_rp_source(
return errormsg
-@retry(retry_timeout=60)
+@retry(retry_timeout=60, diag_pct=0)
def verify_pim_bsr(tgen, topo, dut, bsr_ip, expected=True):
"""
Verify all PIM interface are up and running, config is verified
@@ -2351,7 +2351,7 @@ def verify_pim_bsr(tgen, topo, dut, bsr_ip, expected=True):
return True
-@retry(retry_timeout=60)
+@retry(retry_timeout=60, diag_pct=0)
def verify_ip_pim_upstream_rpf(
tgen, topo, dut, interface, group_addresses, rp=None, expected=True
):
@@ -2551,7 +2551,7 @@ def enable_disable_pim_bsm(tgen, router, intf, enable=True):
return result
-@retry(retry_timeout=60)
+@retry(retry_timeout=60, diag_pct=0)
def verify_ip_pim_join(
tgen, topo, dut, interface, group_addresses, src_address=None, expected=True
):
@@ -2644,7 +2644,7 @@ def verify_ip_pim_join(
return True
-@retry(retry_timeout=60)
+@retry(retry_timeout=60, diag_pct=0)
def verify_igmp_config(tgen, input_dict, stats_return=False, expected=True):
"""
Verify igmp interface details, verifying following configs:
@@ -2934,7 +2934,7 @@ def verify_igmp_config(tgen, input_dict, stats_return=False, expected=True):
return True if stats_return == False else igmp_stats
-@retry(retry_timeout=60)
+@retry(retry_timeout=60, diag_pct=0)
def verify_pim_config(tgen, input_dict, expected=True):
"""
Verify pim interface details, verifying following configs:
@@ -3060,7 +3060,7 @@ def verify_pim_config(tgen, input_dict, expected=True):
return True
-@retry(retry_timeout=40)
+@retry(retry_timeout=20, diag_pct=0)
def verify_multicast_traffic(tgen, input_dict, return_traffic=False, expected=True):
"""
Verify multicast traffic by running
@@ -3303,7 +3303,7 @@ def get_refCount_for_mroute(tgen, dut, iif, src_address, group_addresses):
return refCount
-@retry(retry_timeout=40)
+@retry(retry_timeout=40, diag_pct=0)
def verify_multicast_flag_state(
tgen, dut, src_address, group_addresses, flag, expected=True
):
@@ -3400,7 +3400,7 @@ def verify_multicast_flag_state(
return True
-@retry(retry_timeout=40)
+@retry(retry_timeout=40, diag_pct=0)
def verify_igmp_interface(tgen, topo, dut, igmp_iface, interface_ip, expected=True):
"""
Verify all IGMP interface are up and running, config is verified
diff --git a/tests/topotests/multicast_pim_bsm_topo1/test_mcast_pim_bsmp_01.py b/tests/topotests/multicast_pim_bsm_topo1/test_mcast_pim_bsmp_01.py
index 4ab160b52e..1a55d6d9f1 100644
--- a/tests/topotests/multicast_pim_bsm_topo1/test_mcast_pim_bsmp_01.py
+++ b/tests/topotests/multicast_pim_bsm_topo1/test_mcast_pim_bsmp_01.py
@@ -170,7 +170,7 @@ def setup_module(mod):
daemons = topo_daemons(tgen, topo)
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen, daemons)
# Don"t run this test if we have any failure.
@@ -313,7 +313,7 @@ def pre_config_to_bsm(tgen, topo, tc_name, bsr, sender, receiver, fhr, rp, lhr,
result = add_rp_interfaces_and_pim_config(tgen, topo, "lo", rp, rp_mapping)
assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result)
- # Add kernal routes to sender and receiver
+ # Add kernel routes to sender and receiver
for group, rp_list in rp_mapping.items():
mask = group.split("/")[1]
if int(mask) == 32:
diff --git a/tests/topotests/multicast_pim_bsm_topo2/test_mcast_pim_bsmp_02.py b/tests/topotests/multicast_pim_bsm_topo2/test_mcast_pim_bsmp_02.py
index 5f641b5286..31cd8f9858 100644
--- a/tests/topotests/multicast_pim_bsm_topo2/test_mcast_pim_bsmp_02.py
+++ b/tests/topotests/multicast_pim_bsm_topo2/test_mcast_pim_bsmp_02.py
@@ -150,7 +150,7 @@ def setup_module(mod):
daemons = topo_daemons(tgen, topo)
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen, daemons)
# Don"t run this test if we have any failure.
@@ -247,7 +247,7 @@ def pre_config_to_bsm(tgen, topo, tc_name, bsr, sender, receiver, fhr, rp, lhr,
result = create_static_routes(tgen, input_dict)
assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result)
- # Add kernal route for source
+ # Add kernel route for source
group = topo["routers"][bsr]["bsm"]["bsr_packets"][packet]["pkt_dst"]
bsr_interface = topo["routers"][bsr]["links"][fhr]["interface"]
result = addKernelRoute(tgen, bsr, bsr_interface, group)
@@ -260,18 +260,18 @@ def pre_config_to_bsm(tgen, topo, tc_name, bsr, sender, receiver, fhr, rp, lhr,
result = add_rp_interfaces_and_pim_config(tgen, topo, "lo", rp, rp_mapping)
assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result)
- # Add kernal routes to sender and receiver
+ # Add kernel routes to sender and receiver
for group, rp_list in rp_mapping.items():
mask = group.split("/")[1]
if int(mask) == 32:
group = group.split("/")[0]
- # Add kernal routes for sender
+ # Add kernel routes for sender
s_interface = topo["routers"][sender]["links"][fhr]["interface"]
result = addKernelRoute(tgen, sender, s_interface, group)
assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result)
- # Add kernal routes for receiver
+ # Add kernel routes for receiver
r_interface = topo["routers"][receiver]["links"][lhr]["interface"]
result = addKernelRoute(tgen, receiver, r_interface, group)
assert result is True, "Testcase {} :Failed \n Error {}".format(tc_name, result)
diff --git a/tests/topotests/multicast_pim_sm_topo1/test_multicast_pim_sm_topo1.py b/tests/topotests/multicast_pim_sm_topo1/test_multicast_pim_sm_topo1.py
index 9929f4b3c7..75fae6bb59 100755
--- a/tests/topotests/multicast_pim_sm_topo1/test_multicast_pim_sm_topo1.py
+++ b/tests/topotests/multicast_pim_sm_topo1/test_multicast_pim_sm_topo1.py
@@ -179,7 +179,7 @@ def setup_module(mod):
daemons = topo_daemons(tgen, tgen.json_topo)
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen, daemons)
# Don"t run this test if we have any failure.
diff --git a/tests/topotests/multicast_pim_sm_topo2/test_multicast_pim_sm_topo2.py b/tests/topotests/multicast_pim_sm_topo2/test_multicast_pim_sm_topo2.py
index 57561c78eb..c2128cbad6 100755
--- a/tests/topotests/multicast_pim_sm_topo2/test_multicast_pim_sm_topo2.py
+++ b/tests/topotests/multicast_pim_sm_topo2/test_multicast_pim_sm_topo2.py
@@ -176,7 +176,7 @@ def setup_module(mod):
daemons = topo_daemons(tgen, topo)
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen, daemons)
# Don"t run this test if we have any failure.
diff --git a/tests/topotests/multicast_pim_sm_topo3/test_multicast_pim_sm_topo3.py b/tests/topotests/multicast_pim_sm_topo3/test_multicast_pim_sm_topo3.py
index 907c75e9ee..304128e44c 100755
--- a/tests/topotests/multicast_pim_sm_topo3/test_multicast_pim_sm_topo3.py
+++ b/tests/topotests/multicast_pim_sm_topo3/test_multicast_pim_sm_topo3.py
@@ -188,7 +188,7 @@ def setup_module(mod):
daemons = topo_daemons(tgen, topo)
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen, daemons)
# Don"t run this test if we have any failure.
diff --git a/tests/topotests/multicast_pim_sm_topo3/test_multicast_pim_sm_topo4.py b/tests/topotests/multicast_pim_sm_topo3/test_multicast_pim_sm_topo4.py
index 1b7158d597..b255bddcef 100755
--- a/tests/topotests/multicast_pim_sm_topo3/test_multicast_pim_sm_topo4.py
+++ b/tests/topotests/multicast_pim_sm_topo3/test_multicast_pim_sm_topo4.py
@@ -155,7 +155,7 @@ def setup_module(mod):
daemons = topo_daemons(tgen, topo)
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen, daemons)
# Don"t run this test if we have any failure.
diff --git a/tests/topotests/multicast_pim_static_rp_topo1/test_multicast_pim_static_rp.py b/tests/topotests/multicast_pim_static_rp_topo1/test_multicast_pim_static_rp.py
index a5cec93813..210f960b60 100755
--- a/tests/topotests/multicast_pim_static_rp_topo1/test_multicast_pim_static_rp.py
+++ b/tests/topotests/multicast_pim_static_rp_topo1/test_multicast_pim_static_rp.py
@@ -227,7 +227,7 @@ def setup_module(mod):
daemons = topo_daemons(tgen, TOPO)
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen, daemons)
# Don"t run this test if we have any failure.
diff --git a/tests/topotests/ospf_basic_functionality/test_ospf_asbr_summary_topo1.py b/tests/topotests/ospf_basic_functionality/test_ospf_asbr_summary_topo1.py
index f9fa55e275..f42bc47d46 100644
--- a/tests/topotests/ospf_basic_functionality/test_ospf_asbr_summary_topo1.py
+++ b/tests/topotests/ospf_basic_functionality/test_ospf_asbr_summary_topo1.py
@@ -146,7 +146,7 @@ def setup_module(mod):
daemons = topo_daemons(tgen, topo)
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen, daemons)
# Creating configuration from JSON
diff --git a/tests/topotests/ospf_basic_functionality/test_ospf_asbr_summary_type7_lsa.py b/tests/topotests/ospf_basic_functionality/test_ospf_asbr_summary_type7_lsa.py
index e63f59e846..2c9959c499 100644
--- a/tests/topotests/ospf_basic_functionality/test_ospf_asbr_summary_type7_lsa.py
+++ b/tests/topotests/ospf_basic_functionality/test_ospf_asbr_summary_type7_lsa.py
@@ -138,7 +138,7 @@ def setup_module(mod):
daemons = topo_daemons(tgen, topo)
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen, daemons)
# Creating configuration from JSON
diff --git a/tests/topotests/ospf_basic_functionality/test_ospf_authentication.py b/tests/topotests/ospf_basic_functionality/test_ospf_authentication.py
index 030b77c609..252481799c 100644
--- a/tests/topotests/ospf_basic_functionality/test_ospf_authentication.py
+++ b/tests/topotests/ospf_basic_functionality/test_ospf_authentication.py
@@ -106,7 +106,7 @@ def setup_module(mod):
daemons = topo_daemons(tgen, topo)
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen, daemons)
# Creating configuration from JSON
diff --git a/tests/topotests/ospf_basic_functionality/test_ospf_chaos.py b/tests/topotests/ospf_basic_functionality/test_ospf_chaos.py
index 86f3213fce..a0ab828717 100644
--- a/tests/topotests/ospf_basic_functionality/test_ospf_chaos.py
+++ b/tests/topotests/ospf_basic_functionality/test_ospf_chaos.py
@@ -117,7 +117,7 @@ def setup_module(mod):
daemons = topo_daemons(tgen, topo)
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen, daemons)
# Creating configuration from JSON
diff --git a/tests/topotests/ospf_basic_functionality/test_ospf_ecmp.py b/tests/topotests/ospf_basic_functionality/test_ospf_ecmp.py
index a578272e21..2b479db3c2 100644
--- a/tests/topotests/ospf_basic_functionality/test_ospf_ecmp.py
+++ b/tests/topotests/ospf_basic_functionality/test_ospf_ecmp.py
@@ -120,7 +120,7 @@ def setup_module(mod):
daemons = topo_daemons(tgen, topo)
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen, daemons)
# Creating configuration from JSON
diff --git a/tests/topotests/ospf_basic_functionality/test_ospf_ecmp_lan.py b/tests/topotests/ospf_basic_functionality/test_ospf_ecmp_lan.py
index 4a5660f42f..00feefc4d0 100644
--- a/tests/topotests/ospf_basic_functionality/test_ospf_ecmp_lan.py
+++ b/tests/topotests/ospf_basic_functionality/test_ospf_ecmp_lan.py
@@ -121,7 +121,7 @@ def setup_module(mod):
daemons = topo_daemons(tgen, topo)
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen, daemons)
# Creating configuration from JSON
diff --git a/tests/topotests/ospf_basic_functionality/test_ospf_lan.py b/tests/topotests/ospf_basic_functionality/test_ospf_lan.py
index b32483f7ad..497a8b900b 100644
--- a/tests/topotests/ospf_basic_functionality/test_ospf_lan.py
+++ b/tests/topotests/ospf_basic_functionality/test_ospf_lan.py
@@ -120,7 +120,7 @@ def setup_module(mod):
daemons = topo_daemons(tgen, topo)
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen, daemons)
# Creating configuration from JSON
diff --git a/tests/topotests/ospf_basic_functionality/test_ospf_nssa.py b/tests/topotests/ospf_basic_functionality/test_ospf_nssa.py
index aa34208acb..1917bd42f5 100644
--- a/tests/topotests/ospf_basic_functionality/test_ospf_nssa.py
+++ b/tests/topotests/ospf_basic_functionality/test_ospf_nssa.py
@@ -118,7 +118,7 @@ def setup_module(mod):
daemons = topo_daemons(tgen, topo)
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen, daemons)
# Creating configuration from JSON
diff --git a/tests/topotests/ospf_basic_functionality/test_ospf_p2mp.py b/tests/topotests/ospf_basic_functionality/test_ospf_p2mp.py
index 7c09e71ef8..3b84a99cdf 100644
--- a/tests/topotests/ospf_basic_functionality/test_ospf_p2mp.py
+++ b/tests/topotests/ospf_basic_functionality/test_ospf_p2mp.py
@@ -107,7 +107,7 @@ def setup_module(mod):
daemons = topo_daemons(tgen, topo)
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen, daemons)
# Creating configuration from JSON
diff --git a/tests/topotests/ospf_basic_functionality/test_ospf_routemaps.py b/tests/topotests/ospf_basic_functionality/test_ospf_routemaps.py
index adc1b2cf3a..22d768d9f6 100644
--- a/tests/topotests/ospf_basic_functionality/test_ospf_routemaps.py
+++ b/tests/topotests/ospf_basic_functionality/test_ospf_routemaps.py
@@ -133,7 +133,7 @@ def setup_module(mod):
daemons = topo_daemons(tgen, topo)
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen, daemons)
# Creating configuration from JSON
diff --git a/tests/topotests/ospf_basic_functionality/test_ospf_rte_calc.py b/tests/topotests/ospf_basic_functionality/test_ospf_rte_calc.py
index 88c87dcecd..8bd81a3854 100644
--- a/tests/topotests/ospf_basic_functionality/test_ospf_rte_calc.py
+++ b/tests/topotests/ospf_basic_functionality/test_ospf_rte_calc.py
@@ -129,7 +129,7 @@ def setup_module(mod):
daemons = topo_daemons(tgen, topo)
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen, daemons)
# Creating configuration from JSON
diff --git a/tests/topotests/ospf_basic_functionality/test_ospf_single_area.py b/tests/topotests/ospf_basic_functionality/test_ospf_single_area.py
index 73193582a6..c7ee723b3e 100644
--- a/tests/topotests/ospf_basic_functionality/test_ospf_single_area.py
+++ b/tests/topotests/ospf_basic_functionality/test_ospf_single_area.py
@@ -114,7 +114,7 @@ def setup_module(mod):
daemons = topo_daemons(tgen, topo)
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen, daemons)
# Creating configuration from JSON
diff --git a/tests/topotests/ospf_gr_helper/test_ospf_gr_helper.py b/tests/topotests/ospf_gr_helper/test_ospf_gr_helper.py
index 2c7c6df37e..ff182be66f 100644
--- a/tests/topotests/ospf_gr_helper/test_ospf_gr_helper.py
+++ b/tests/topotests/ospf_gr_helper/test_ospf_gr_helper.py
@@ -123,7 +123,7 @@ def setup_module(mod):
daemons = topo_daemons(tgen, topo)
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen, daemons)
# Creating configuration from JSON
diff --git a/tests/topotests/ospfv3_basic_functionality/test_ospfv3_asbr_summary_topo1.py b/tests/topotests/ospfv3_basic_functionality/test_ospfv3_asbr_summary_topo1.py
index 36cde06c3e..3967f5f42a 100644
--- a/tests/topotests/ospfv3_basic_functionality/test_ospfv3_asbr_summary_topo1.py
+++ b/tests/topotests/ospfv3_basic_functionality/test_ospfv3_asbr_summary_topo1.py
@@ -161,7 +161,7 @@ def setup_module(mod):
daemons = topo_daemons(tgen, topo)
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen, daemons)
# Creating configuration from JSON
diff --git a/tests/topotests/ospfv3_basic_functionality/test_ospfv3_authentication.py b/tests/topotests/ospfv3_basic_functionality/test_ospfv3_authentication.py
index baa0071f9c..d32a05a88e 100644
--- a/tests/topotests/ospfv3_basic_functionality/test_ospfv3_authentication.py
+++ b/tests/topotests/ospfv3_basic_functionality/test_ospfv3_authentication.py
@@ -116,7 +116,7 @@ def setup_module(mod):
daemons = topo_daemons(tgen, topo)
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen, daemons)
# Creating configuration from JSON
diff --git a/tests/topotests/ospfv3_basic_functionality/test_ospfv3_ecmp.py b/tests/topotests/ospfv3_basic_functionality/test_ospfv3_ecmp.py
index 9353cd923b..75be0928ab 100644
--- a/tests/topotests/ospfv3_basic_functionality/test_ospfv3_ecmp.py
+++ b/tests/topotests/ospfv3_basic_functionality/test_ospfv3_ecmp.py
@@ -121,7 +121,7 @@ def setup_module(mod):
daemons = topo_daemons(tgen, topo)
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen, daemons)
# Creating configuration from JSON
@@ -195,7 +195,7 @@ def red_connected(dut, config=True):
def get_llip(onrouter, intf):
"""
- API to get the link local ipv6 address of a perticular interface
+ API to get the link local ipv6 address of a particular interface
Parameters
----------
@@ -222,7 +222,7 @@ def get_llip(onrouter, intf):
def get_glipv6(onrouter, intf):
"""
- API to get the global ipv6 address of a perticular interface
+ API to get the global ipv6 address of a particular interface
Parameters
----------
diff --git a/tests/topotests/ospfv3_basic_functionality/test_ospfv3_ecmp_lan.py b/tests/topotests/ospfv3_basic_functionality/test_ospfv3_ecmp_lan.py
index fe8be0a4b3..ce880b413b 100644
--- a/tests/topotests/ospfv3_basic_functionality/test_ospfv3_ecmp_lan.py
+++ b/tests/topotests/ospfv3_basic_functionality/test_ospfv3_ecmp_lan.py
@@ -134,7 +134,7 @@ def setup_module(mod):
daemons = topo_daemons(tgen, topo)
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen, daemons)
# Creating configuration from JSON
@@ -218,7 +218,7 @@ def red_connected(dut, config=True):
def get_llip(onrouter, intf):
"""
- API to get the link local ipv6 address of a perticular interface
+ API to get the link local ipv6 address of a particular interface
Parameters
----------
@@ -245,7 +245,7 @@ def get_llip(onrouter, intf):
def get_glipv6(onrouter, intf):
"""
- API to get the global ipv6 address of a perticular interface
+ API to get the global ipv6 address of a particular interface
Parameters
----------
diff --git a/tests/topotests/ospfv3_basic_functionality/test_ospfv3_nssa.py b/tests/topotests/ospfv3_basic_functionality/test_ospfv3_nssa.py
index 64a067cd1a..bdc4c139f7 100644
--- a/tests/topotests/ospfv3_basic_functionality/test_ospfv3_nssa.py
+++ b/tests/topotests/ospfv3_basic_functionality/test_ospfv3_nssa.py
@@ -66,7 +66,7 @@ def setup_module(mod):
daemons = topo_daemons(tgen, topo)
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen, daemons)
# Creating configuration from JSON
diff --git a/tests/topotests/ospfv3_basic_functionality/test_ospfv3_nssa2.py b/tests/topotests/ospfv3_basic_functionality/test_ospfv3_nssa2.py
index dc3b915d49..7b41c80ce3 100644
--- a/tests/topotests/ospfv3_basic_functionality/test_ospfv3_nssa2.py
+++ b/tests/topotests/ospfv3_basic_functionality/test_ospfv3_nssa2.py
@@ -143,7 +143,7 @@ def setup_module(mod):
daemons = topo_daemons(tgen, topo)
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen, daemons)
# Creating configuration from JSON
diff --git a/tests/topotests/ospfv3_basic_functionality/test_ospfv3_routemaps.py b/tests/topotests/ospfv3_basic_functionality/test_ospfv3_routemaps.py
index d7cf951c5f..0c9457b39e 100644
--- a/tests/topotests/ospfv3_basic_functionality/test_ospfv3_routemaps.py
+++ b/tests/topotests/ospfv3_basic_functionality/test_ospfv3_routemaps.py
@@ -135,7 +135,7 @@ def setup_module(mod):
daemons = topo_daemons(tgen, topo)
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen, daemons)
# Creating configuration from JSON
diff --git a/tests/topotests/ospfv3_basic_functionality/test_ospfv3_rte_calc.py b/tests/topotests/ospfv3_basic_functionality/test_ospfv3_rte_calc.py
index 21d03fadfb..df3a0249ea 100644
--- a/tests/topotests/ospfv3_basic_functionality/test_ospfv3_rte_calc.py
+++ b/tests/topotests/ospfv3_basic_functionality/test_ospfv3_rte_calc.py
@@ -126,7 +126,7 @@ def setup_module(mod):
daemons = topo_daemons(tgen, topo)
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen, daemons)
# Creating configuration from JSON
@@ -166,7 +166,7 @@ def teardown_module(mod):
def get_llip(onrouter, intf):
"""
- API to get the link local ipv6 address of a perticular interface
+ API to get the link local ipv6 address of a particular interface
Parameters
----------
@@ -193,7 +193,7 @@ def get_llip(onrouter, intf):
def get_glipv6(onrouter, intf):
"""
- API to get the global ipv6 address of a perticular interface
+ API to get the global ipv6 address of a particular interface
Parameters
----------
diff --git a/tests/topotests/ospfv3_basic_functionality/test_ospfv3_single_area.py b/tests/topotests/ospfv3_basic_functionality/test_ospfv3_single_area.py
index 9ec06ec36b..c9824e79c5 100644
--- a/tests/topotests/ospfv3_basic_functionality/test_ospfv3_single_area.py
+++ b/tests/topotests/ospfv3_basic_functionality/test_ospfv3_single_area.py
@@ -120,7 +120,7 @@ def setup_module(mod):
daemons = topo_daemons(tgen, topo)
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen, daemons)
# Creating configuration from JSON
diff --git a/tests/topotests/static_routing_with_ebgp/test_static_routes_topo1_ebgp.py b/tests/topotests/static_routing_with_ebgp/test_static_routes_topo1_ebgp.py
index 809a0a3240..abfba029f4 100644
--- a/tests/topotests/static_routing_with_ebgp/test_static_routes_topo1_ebgp.py
+++ b/tests/topotests/static_routing_with_ebgp/test_static_routes_topo1_ebgp.py
@@ -94,7 +94,7 @@ def setup_module(mod):
# ... and here it calls Mininet initialization functions.
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen)
# Creating configuration from JSON
diff --git a/tests/topotests/static_routing_with_ebgp/test_static_routes_topo2_ebgp.py b/tests/topotests/static_routing_with_ebgp/test_static_routes_topo2_ebgp.py
index b85aa43ca4..f04279a081 100644
--- a/tests/topotests/static_routing_with_ebgp/test_static_routes_topo2_ebgp.py
+++ b/tests/topotests/static_routing_with_ebgp/test_static_routes_topo2_ebgp.py
@@ -135,7 +135,7 @@ def setup_module(mod):
# ... and here it calls Mininet initialization functions.
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen)
# Creating configuration from JSON
diff --git a/tests/topotests/static_routing_with_ebgp/test_static_routes_topo3_ebgp.py b/tests/topotests/static_routing_with_ebgp/test_static_routes_topo3_ebgp.py
index 0e6ab6183c..6c76c928ec 100644
--- a/tests/topotests/static_routing_with_ebgp/test_static_routes_topo3_ebgp.py
+++ b/tests/topotests/static_routing_with_ebgp/test_static_routes_topo3_ebgp.py
@@ -118,7 +118,7 @@ def setup_module(mod):
# ... and here it calls Mininet initialization functions.
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen)
# Creating configuration from JSON
diff --git a/tests/topotests/static_routing_with_ebgp/test_static_routes_topo4_ebgp.py b/tests/topotests/static_routing_with_ebgp/test_static_routes_topo4_ebgp.py
index 7a7c5d63a7..3f49ced7ca 100644
--- a/tests/topotests/static_routing_with_ebgp/test_static_routes_topo4_ebgp.py
+++ b/tests/topotests/static_routing_with_ebgp/test_static_routes_topo4_ebgp.py
@@ -101,7 +101,7 @@ def setup_module(mod):
# ... and here it calls Mininet initialization functions.
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen)
# Creating configuration from JSON
diff --git a/tests/topotests/static_routing_with_ibgp/test_static_routes_topo1_ibgp.py b/tests/topotests/static_routing_with_ibgp/test_static_routes_topo1_ibgp.py
index e06d0fca3c..6b7b2adfd9 100644
--- a/tests/topotests/static_routing_with_ibgp/test_static_routes_topo1_ibgp.py
+++ b/tests/topotests/static_routing_with_ibgp/test_static_routes_topo1_ibgp.py
@@ -94,7 +94,7 @@ def setup_module(mod):
# ... and here it calls Mininet initialization functions.
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen)
# Creating configuration from JSON
diff --git a/tests/topotests/static_routing_with_ibgp/test_static_routes_topo2_ibgp.py b/tests/topotests/static_routing_with_ibgp/test_static_routes_topo2_ibgp.py
index cb6c879459..350a117b94 100644
--- a/tests/topotests/static_routing_with_ibgp/test_static_routes_topo2_ibgp.py
+++ b/tests/topotests/static_routing_with_ibgp/test_static_routes_topo2_ibgp.py
@@ -135,7 +135,7 @@ def setup_module(mod):
# ... and here it calls Mininet initialization functions.
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen)
# Creating configuration from JSON
diff --git a/tests/topotests/static_routing_with_ibgp/test_static_routes_topo3_ibgp.py b/tests/topotests/static_routing_with_ibgp/test_static_routes_topo3_ibgp.py
index 1ac91e1f5f..1861d9ad49 100644
--- a/tests/topotests/static_routing_with_ibgp/test_static_routes_topo3_ibgp.py
+++ b/tests/topotests/static_routing_with_ibgp/test_static_routes_topo3_ibgp.py
@@ -117,7 +117,7 @@ def setup_module(mod):
# ... and here it calls Mininet initialization functions.
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen)
# Creating configuration from JSON
diff --git a/tests/topotests/static_routing_with_ibgp/test_static_routes_topo4_ibgp.py b/tests/topotests/static_routing_with_ibgp/test_static_routes_topo4_ibgp.py
index 42d86f22da..8c97d6cb7e 100644
--- a/tests/topotests/static_routing_with_ibgp/test_static_routes_topo4_ibgp.py
+++ b/tests/topotests/static_routing_with_ibgp/test_static_routes_topo4_ibgp.py
@@ -96,7 +96,7 @@ def setup_module(mod):
# ... and here it calls Mininet initialization functions.
# Starting topology, create tmp files which are loaded to routers
- # to start deamons and then start routers
+ # to start daemons and then start routers
start_topology(tgen)
# Creating configuration from JSON
diff --git a/tools/frrcommon.sh.in b/tools/frrcommon.sh.in
index d95f2d4be7..52f5277d25 100644
--- a/tools/frrcommon.sh.in
+++ b/tools/frrcommon.sh.in
@@ -253,11 +253,11 @@ all_start() {
all_stop() {
local pids reversed
- daemon_list daemons disabled
- [ "$1" = "--reallyall" ] && daemons="$daemons $disabled"
+ daemon_list enabled_daemons disabled_daemons
+ [ "$1" = "--reallyall" ] && enabled_daemons="$enabled_daemons $disabled_daemons"
reversed=""
- for dmninst in $daemons; do
+ for dmninst in $enabled_daemons; do
reversed="$dmninst $reversed"
done
diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c
index 9e8f73b101..e3e61d1229 100644
--- a/vtysh/vtysh.c
+++ b/vtysh/vtysh.c
@@ -3401,7 +3401,7 @@ DEFUN (vtysh_write_memory,
vty_out(vty, "Note: this version of vtysh never writes vtysh.conf\n");
- /* If integrated frr.conf explicitely set. */
+ /* If integrated frr.conf explicitly set. */
if (want_config_integrated()) {
ret = CMD_WARNING_CONFIG_FAILED;
diff --git a/yang/frr-bgp-bmp.yang b/yang/frr-bgp-bmp.yang
index cf945cabef..8c3de839b6 100644
--- a/yang/frr-bgp-bmp.yang
+++ b/yang/frr-bgp-bmp.yang
@@ -86,7 +86,7 @@ submodule frr-bgp-bmp {
type uint32 {
range "100..86400000";
}
- units "miliseconds";
+ units "milliseconds";
default "30000";
description
"Minimum connection retry interval.";
@@ -96,7 +96,7 @@ submodule frr-bgp-bmp {
type uint32 {
range "100..86400000";
}
- units "miliseconds";
+ units "milliseconds";
default "720000";
description
"Maximum connection retry interval.";
@@ -170,7 +170,7 @@ submodule frr-bgp-bmp {
type uint32 {
range "100..86400000";
}
- units "miliseconds";
+ units "milliseconds";
description
"Interval to send BMP Stats.";
}
diff --git a/yang/frr-bgp-common-structure.yang b/yang/frr-bgp-common-structure.yang
index 3378c10c03..4c12b956c4 100644
--- a/yang/frr-bgp-common-structure.yang
+++ b/yang/frr-bgp-common-structure.yang
@@ -159,7 +159,7 @@ submodule frr-bgp-common-structure {
type uint16 {
range "50..60000";
}
- units "miliseconds";
+ units "milliseconds";
default "300";
description
"Required min receive interval.";
@@ -170,7 +170,7 @@ submodule frr-bgp-common-structure {
type uint16 {
range "50..60000";
}
- units "miliseconds";
+ units "milliseconds";
default "300";
description
"Desired min transmit interval.";
diff --git a/yang/frr-bgp-common.yang b/yang/frr-bgp-common.yang
index 157e4cd614..2b1babdd28 100644
--- a/yang/frr-bgp-common.yang
+++ b/yang/frr-bgp-common.yang
@@ -444,7 +444,7 @@ submodule frr-bgp-common {
type uint32 {
range "0..4294967295";
}
- units "miliseconds";
+ units "milliseconds";
default "1000";
description
"Configures the Subgroup coalesce timer.";
diff --git a/zebra/rtadv.c b/zebra/rtadv.c
index 2ce5072945..ca833999cb 100644
--- a/zebra/rtadv.c
+++ b/zebra/rtadv.c
@@ -490,9 +490,11 @@ static void rtadv_timer(struct thread *thread)
RB_FOREACH (vrf, vrf_id_head, &vrfs_by_id)
FOR_ALL_INTERFACES (vrf, ifp) {
- if (if_is_loopback(ifp) || !if_is_operative(ifp)
- || (vrf_is_backend_netns()
- && ifp->vrf->vrf_id != zvrf->vrf->vrf_id))
+ if (if_is_loopback(ifp) || !if_is_operative(ifp) ||
+ IS_ZEBRA_IF_BRIDGE_SLAVE(ifp) ||
+ !connected_get_linklocal(ifp) ||
+ (vrf_is_backend_netns() &&
+ ifp->vrf->vrf_id != zvrf->vrf->vrf_id))
continue;
zif = ifp->info;
diff --git a/zebra/zebra_evpn_mac.c b/zebra/zebra_evpn_mac.c
index 46d789bc34..128d233969 100644
--- a/zebra/zebra_evpn_mac.c
+++ b/zebra/zebra_evpn_mac.c
@@ -1872,7 +1872,7 @@ struct zebra_mac *zebra_evpn_proc_sync_mac_update(
return mac;
}
-/* update local fowarding info. return true if a dest-ES change
+/* update local forwarding info. return true if a dest-ES change
* is detected
*/
static bool zebra_evpn_local_mac_update_fwd_info(struct zebra_mac *mac,
diff --git a/zebra/zebra_srv6_vty.c b/zebra/zebra_srv6_vty.c
index ebe0fffcb2..62ce17326c 100644
--- a/zebra/zebra_srv6_vty.c
+++ b/zebra/zebra_srv6_vty.c
@@ -354,8 +354,12 @@ static int zebra_sr_config(struct vty *vty)
inet_ntop(AF_INET6, &locator->prefix.prefix,
str, sizeof(str));
vty_out(vty, " locator %s\n", locator->name);
- vty_out(vty, " prefix %s/%u\n", str,
+ vty_out(vty, " prefix %s/%u", str,
locator->prefix.prefixlen);
+ if (locator->function_bits_length)
+ vty_out(vty, " func-bits %u",
+ locator->function_bits_length);
+ vty_out(vty, "\n");
vty_out(vty, " exit\n");
vty_out(vty, " !\n");
}
diff --git a/zebra/zebra_vxlan.c b/zebra/zebra_vxlan.c
index f32a4c6010..fc7eb8c87a 100644
--- a/zebra/zebra_vxlan.c
+++ b/zebra/zebra_vxlan.c
@@ -5124,8 +5124,13 @@ int zebra_vxlan_if_update(struct interface *ifp, uint16_t chgflags)
zevpn_vxlan_if_set(zevpn, ifp, true /* set */);
vlan_if = zvni_map_to_svi(vxl->access_vlan,
zif->brslave_info.br_if);
- if (vlan_if)
+ if (vlan_if) {
zevpn->svi_if = vlan_if;
+ zevpn->vrf_id = vlan_if->vrf->vrf_id;
+ zl3vni = zl3vni_from_vrf(vlan_if->vrf->vrf_id);
+ if (zl3vni)
+ listnode_add_sort_nodup(zl3vni->l2vnis, zevpn);
+ }
/* Take further actions needed.
* Note that if we are here, there is a change of interest.
diff --git a/zebra/zserv.c b/zebra/zserv.c
index 630c76c989..403f6c0d99 100644
--- a/zebra/zserv.c
+++ b/zebra/zserv.c
@@ -172,7 +172,7 @@ void zserv_log_message(const char *errmsg, struct stream *msg,
}
/*
- * Gracefully shut down a client connection.
+ * Gracefuly shut down a client connection.
*
* Cancel any pending tasks for the client's thread. Then schedule a task on
* the main thread to shut down the calling thread.
@@ -568,7 +568,7 @@ DEFINE_KOOH(zserv_client_close, (struct zserv *client), (client));
* Deinitialize zebra client.
*
* - Deregister and deinitialize related internal resources
- * - Gracefully close socket
+ * - Gracefuly close socket
* - Free associated resources
* - Free client structure
*