diff options
| -rw-r--r-- | bgpd/bgp_evpn.c | 2 | ||||
| -rw-r--r-- | bgpd/bgp_zebra.c | 26 | ||||
| -rw-r--r-- | doc/user/pim.rst | 6 | ||||
| -rw-r--r-- | pimd/pim_cmd.c | 93 | ||||
| -rw-r--r-- | zebra/zebra_dplane.c | 21 | ||||
| -rw-r--r-- | zebra/zebra_dplane.h | 3 |
6 files changed, 144 insertions, 7 deletions
diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c index 112e4b836c..c4b2a606c5 100644 --- a/bgpd/bgp_evpn.c +++ b/bgpd/bgp_evpn.c @@ -2472,7 +2472,7 @@ static int install_evpn_route_entry_in_vrf(struct bgp *bgp_vrf, if (bgp_debug_zebra(NULL)) { zlog_debug( - "installing evpn prefix %s as ip prefix %s in vrf %s", + "import evpn prefix %s as ip prefix %s in vrf %s", prefix2str(evp, buf, sizeof(buf)), prefix2str(pp, buf1, sizeof(buf)), vrf_id_to_name(bgp_vrf->vrf_id)); diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index a45480fdc2..013a23bde3 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -1435,15 +1435,29 @@ void bgp_zebra_announce(struct bgp_node *rn, struct prefix *p, for (i = 0; i < api.nexthop_num; i++) { api_nh = &api.nexthops[i]; - if (api_nh->type == NEXTHOP_TYPE_IFINDEX) + switch (api_nh->type) { + case NEXTHOP_TYPE_IFINDEX: nh_buf[0] = '\0'; - else { - if (api_nh->type == NEXTHOP_TYPE_IPV4) - nh_family = AF_INET; - else - nh_family = AF_INET6; + break; + case NEXTHOP_TYPE_IPV4: + case NEXTHOP_TYPE_IPV4_IFINDEX: + nh_family = AF_INET; inet_ntop(nh_family, &api_nh->gate, nh_buf, sizeof(nh_buf)); + break; + case NEXTHOP_TYPE_IPV6: + case NEXTHOP_TYPE_IPV6_IFINDEX: + nh_family = AF_INET6; + inet_ntop(nh_family, &api_nh->gate, nh_buf, + sizeof(nh_buf)); + break; + case NEXTHOP_TYPE_BLACKHOLE: + strlcpy(nh_buf, "blackhole", sizeof(nh_buf)); + break; + default: + /* Note: add new nexthop case */ + assert(0); + break; } label_buf[0] = '\0'; diff --git a/doc/user/pim.rst b/doc/user/pim.rst index 414423ae7c..d05127059b 100644 --- a/doc/user/pim.rst +++ b/doc/user/pim.rst @@ -322,6 +322,12 @@ cause great confusion. Display information about installed into the kernel S,G mroutes and in addition display data about packet flow for the mroutes. +.. index:: show ip mroute summary +.. clicmd:: show ip mroute summary + + Display total number of S,G mroutes and number of S,G mroutes installed + into the kernel. + .. index:: show ip pim assert .. clicmd:: show ip pim assert diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c index 881c7a107e..e6e9c2d0c8 100644 --- a/pimd/pim_cmd.c +++ b/pimd/pim_cmd.c @@ -5705,6 +5705,97 @@ DEFUN (show_ip_mroute_count_vrf_all, return CMD_SUCCESS; } +static void show_mroute_summary(struct pim_instance *pim, struct vty *vty) +{ + struct listnode *node; + struct channel_oil *c_oil; + struct static_route *s_route; + uint32_t starg_sw_mroute_cnt = 0; + uint32_t sg_sw_mroute_cnt = 0; + uint32_t starg_hw_mroute_cnt = 0; + uint32_t sg_hw_mroute_cnt = 0; + + vty_out(vty, "Mroute Type Installed/Total\n"); + + for (ALL_LIST_ELEMENTS_RO(pim->channel_oil_list, node, c_oil)) { + if (!c_oil->installed) { + if (c_oil->oil.mfcc_origin.s_addr == INADDR_ANY) + starg_sw_mroute_cnt++; + else + sg_sw_mroute_cnt++; + } else { + if (c_oil->oil.mfcc_origin.s_addr == INADDR_ANY) + starg_hw_mroute_cnt++; + else + sg_hw_mroute_cnt++; + } + } + + for (ALL_LIST_ELEMENTS_RO(pim->static_routes, node, s_route)) { + if (!s_route->c_oil.installed) { + if (s_route->c_oil.oil.mfcc_origin.s_addr == INADDR_ANY) + starg_sw_mroute_cnt++; + else + sg_sw_mroute_cnt++; + } else { + if (s_route->c_oil.oil.mfcc_origin.s_addr == INADDR_ANY) + starg_hw_mroute_cnt++; + else + sg_hw_mroute_cnt++; + } + } + + vty_out(vty, "%-20s %d/%d\n", "(*, G)", starg_hw_mroute_cnt, + starg_sw_mroute_cnt + starg_hw_mroute_cnt); + vty_out(vty, "%-20s %d/%d\n", "(S, G)", sg_hw_mroute_cnt, + sg_sw_mroute_cnt + sg_hw_mroute_cnt); + vty_out(vty, "------\n"); + vty_out(vty, "%-20s %d/%d\n", "Total", + (starg_hw_mroute_cnt + sg_hw_mroute_cnt), + (starg_sw_mroute_cnt + + starg_hw_mroute_cnt + + sg_sw_mroute_cnt + + sg_hw_mroute_cnt)); +} + +DEFUN (show_ip_mroute_summary, + show_ip_mroute_summary_cmd, + "show ip mroute [vrf NAME] summary", + SHOW_STR + IP_STR + MROUTE_STR + VRF_CMD_HELP_STR + "Summary of all mroutes\n") +{ + int idx = 2; + struct vrf *vrf = pim_cmd_lookup_vrf(vty, argv, argc, &idx); + + if (!vrf) + return CMD_WARNING; + + show_mroute_summary(vrf->info, vty); + return CMD_SUCCESS; +} + +DEFUN (show_ip_mroute_summary_vrf_all, + show_ip_mroute_summary_vrf_all_cmd, + "show ip mroute vrf all summary", + SHOW_STR + IP_STR + MROUTE_STR + VRF_CMD_HELP_STR + "Summary of all mroutes\n") +{ + struct vrf *vrf; + + RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) { + vty_out(vty, "VRF: %s\n", vrf->name); + show_mroute_summary(vrf->info, vty); + } + + return CMD_SUCCESS; +} + DEFUN (show_ip_rib, show_ip_rib_cmd, "show ip rib [vrf NAME] A.B.C.D", @@ -10085,6 +10176,8 @@ void pim_cmd_init(void) install_element(VIEW_NODE, &show_ip_mroute_vrf_all_cmd); install_element(VIEW_NODE, &show_ip_mroute_count_cmd); install_element(VIEW_NODE, &show_ip_mroute_count_vrf_all_cmd); + install_element(VIEW_NODE, &show_ip_mroute_summary_cmd); + install_element(VIEW_NODE, &show_ip_mroute_summary_vrf_all_cmd); install_element(VIEW_NODE, &show_ip_rib_cmd); install_element(VIEW_NODE, &show_ip_ssmpingd_cmd); install_element(VIEW_NODE, &show_debugging_pim_cmd); diff --git a/zebra/zebra_dplane.c b/zebra/zebra_dplane.c index c7f0b26b31..1707d3a68b 100644 --- a/zebra/zebra_dplane.c +++ b/zebra/zebra_dplane.c @@ -811,6 +811,13 @@ route_tag_t dplane_ctx_get_tag(const struct zebra_dplane_ctx *ctx) return ctx->u.rinfo.zd_tag; } +void dplane_ctx_set_tag(struct zebra_dplane_ctx *ctx, route_tag_t tag) +{ + DPLANE_CTX_VALID(ctx); + + ctx->u.rinfo.zd_tag = tag; +} + route_tag_t dplane_ctx_get_old_tag(const struct zebra_dplane_ctx *ctx) { DPLANE_CTX_VALID(ctx); @@ -825,6 +832,13 @@ uint16_t dplane_ctx_get_instance(const struct zebra_dplane_ctx *ctx) return ctx->u.rinfo.zd_instance; } +void dplane_ctx_set_instance(struct zebra_dplane_ctx *ctx, uint16_t instance) +{ + DPLANE_CTX_VALID(ctx); + + ctx->u.rinfo.zd_instance = instance; +} + uint16_t dplane_ctx_get_old_instance(const struct zebra_dplane_ctx *ctx) { DPLANE_CTX_VALID(ctx); @@ -867,6 +881,13 @@ uint8_t dplane_ctx_get_distance(const struct zebra_dplane_ctx *ctx) return ctx->u.rinfo.zd_distance; } +void dplane_ctx_set_distance(struct zebra_dplane_ctx *ctx, uint8_t distance) +{ + DPLANE_CTX_VALID(ctx); + + ctx->u.rinfo.zd_distance = distance; +} + uint8_t dplane_ctx_get_old_distance(const struct zebra_dplane_ctx *ctx) { DPLANE_CTX_VALID(ctx); diff --git a/zebra/zebra_dplane.h b/zebra/zebra_dplane.h index b3fbb3672d..6238026bcf 100644 --- a/zebra/zebra_dplane.h +++ b/zebra/zebra_dplane.h @@ -218,14 +218,17 @@ safi_t dplane_ctx_get_safi(const struct zebra_dplane_ctx *ctx); void dplane_ctx_set_table(struct zebra_dplane_ctx *ctx, uint32_t table); uint32_t dplane_ctx_get_table(const struct zebra_dplane_ctx *ctx); route_tag_t dplane_ctx_get_tag(const struct zebra_dplane_ctx *ctx); +void dplane_ctx_set_tag(struct zebra_dplane_ctx *ctx, route_tag_t tag); route_tag_t dplane_ctx_get_old_tag(const struct zebra_dplane_ctx *ctx); uint16_t dplane_ctx_get_instance(const struct zebra_dplane_ctx *ctx); +void dplane_ctx_set_instance(struct zebra_dplane_ctx *ctx, uint16_t instance); uint16_t dplane_ctx_get_old_instance(const struct zebra_dplane_ctx *ctx); uint32_t dplane_ctx_get_metric(const struct zebra_dplane_ctx *ctx); uint32_t dplane_ctx_get_old_metric(const struct zebra_dplane_ctx *ctx); uint32_t dplane_ctx_get_mtu(const struct zebra_dplane_ctx *ctx); uint32_t dplane_ctx_get_nh_mtu(const struct zebra_dplane_ctx *ctx); uint8_t dplane_ctx_get_distance(const struct zebra_dplane_ctx *ctx); +void dplane_ctx_set_distance(struct zebra_dplane_ctx *ctx, uint8_t distance); uint8_t dplane_ctx_get_old_distance(const struct zebra_dplane_ctx *ctx); void dplane_ctx_set_nexthops(struct zebra_dplane_ctx *ctx, struct nexthop *nh); |
