diff options
Diffstat (limited to 'pimd')
-rw-r--r-- | pimd/mtracebis.c | 4 | ||||
-rw-r--r-- | pimd/pim_cmd.c | 190 | ||||
-rw-r--r-- | pimd/pim_igmp.c | 2 | ||||
-rw-r--r-- | pimd/pim_igmp.h | 1 | ||||
-rw-r--r-- | pimd/pim_mroute.c | 12 | ||||
-rw-r--r-- | pimd/pim_nht.c | 2 | ||||
-rw-r--r-- | pimd/pim_oil.h | 11 | ||||
-rw-r--r-- | pimd/pim_rp.c | 2 | ||||
-rw-r--r-- | pimd/pim_rpf.c | 11 | ||||
-rw-r--r-- | pimd/pim_rpf.h | 4 | ||||
-rw-r--r-- | pimd/pim_upstream.c | 4 | ||||
-rw-r--r-- | pimd/pim_vxlan.c | 2 | ||||
-rw-r--r-- | pimd/pim_zlookup.c | 19 | ||||
-rw-r--r-- | pimd/pimd.h | 13 |
14 files changed, 164 insertions, 113 deletions
diff --git a/pimd/mtracebis.c b/pimd/mtracebis.c index 65c495eff..dd9576275 100644 --- a/pimd/mtracebis.c +++ b/pimd/mtracebis.c @@ -17,9 +17,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif +#include <zebra.h> #ifdef __linux__ diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c index 8cbacf53a..18e84fef2 100644 --- a/pimd/pim_cmd.c +++ b/pimd/pim_cmd.c @@ -1536,7 +1536,7 @@ static void pim_show_interface_traffic(struct pim_instance *pim, json_object_object_add(json, ifp->name, json_row); } else { vty_out(vty, - "%-16s %8u/%-8u %7u/%-7u %7u/%-7u %7u/%-7u %7u/%-7u %7u/%-7u %7lu/%-7lu \n", + "%-16s %8u/%-8u %7u/%-7u %7u/%-7u %7u/%-7u %7u/%-7u %7u/%-7u %7" PRIu64 "/%-7" PRIu64 "\n", ifp->name, pim_ifp->pim_ifstat_hello_recv, pim_ifp->pim_ifstat_hello_sent, pim_ifp->pim_ifstat_join_recv, @@ -1629,7 +1629,7 @@ static void pim_show_interface_traffic_single(struct pim_instance *pim, json_object_object_add(json, ifp->name, json_row); } else { vty_out(vty, - "%-16s %8u/%-8u %7u/%-7u %7u/%-7u %7u/%-7u %7u/%-7u %7u/%-7u %7lu/%-7lu \n", + "%-16s %8u/%-8u %7u/%-7u %7u/%-7u %7u/%-7u %7u/%-7u %7u/%-7u %7" PRIu64 "/%-7" PRIu64 "\n", ifp->name, pim_ifp->pim_ifstat_hello_recv, pim_ifp->pim_ifstat_hello_sent, pim_ifp->pim_ifstat_join_recv, @@ -2117,7 +2117,7 @@ static void pim_show_state(struct pim_instance *pim, struct vty *vty, } else { if (first_oif) { first_oif = 0; - vty_out(vty, "%s(%c%c%c%c%c)", out_ifname, + vty_out(vty, "%s(%c%c%c%c)", out_ifname, (c_oil->oif_flags[oif_vif_index] & PIM_OIF_FLAG_PROTO_IGMP) ? 'I' @@ -2131,15 +2131,11 @@ static void pim_show_state(struct pim_instance *pim, struct vty *vty, ? 'V' : ' ', (c_oil->oif_flags[oif_vif_index] - & PIM_OIF_FLAG_PROTO_SOURCE) - ? 'S' - : ' ', - (c_oil->oif_flags[oif_vif_index] & PIM_OIF_FLAG_PROTO_STAR) ? '*' : ' '); } else - vty_out(vty, ", %s(%c%c%c%c%c)", + vty_out(vty, ", %s(%c%c%c%c)", out_ifname, (c_oil->oif_flags[oif_vif_index] & PIM_OIF_FLAG_PROTO_IGMP) @@ -2154,10 +2150,6 @@ static void pim_show_state(struct pim_instance *pim, struct vty *vty, ? 'V' : ' ', (c_oil->oif_flags[oif_vif_index] - & PIM_OIF_FLAG_PROTO_SOURCE) - ? 'S' - : ' ', - (c_oil->oif_flags[oif_vif_index] & PIM_OIF_FLAG_PROTO_STAR) ? '*' : ' '); @@ -3082,7 +3074,7 @@ static void pim_show_group_rp_mappings_info(struct pim_instance *pim, json_object *json_row = NULL; if (pim->global_scope.current_bsr.s_addr == INADDR_ANY) - strncpy(bsr_str, "0.0.0.0", sizeof(bsr_str)); + strlcpy(bsr_str, "0.0.0.0", sizeof(bsr_str)); else pim_inet4_dump("<bsr?>", pim->global_scope.current_bsr, bsr_str, @@ -3238,9 +3230,11 @@ static void pim_show_statistics(struct pim_instance *pim, struct vty *vty, } else { vty_out(vty, "BSM Statistics :\n"); vty_out(vty, "----------------\n"); - vty_out(vty, "Number of Received BSMs : %ld\n", pim->bsm_rcvd); - vty_out(vty, "Number of Forwared BSMs : %ld\n", pim->bsm_sent); - vty_out(vty, "Number of Dropped BSMs : %ld\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); } @@ -3650,7 +3644,7 @@ static void pim_show_bsr(struct pim_instance *pim, vty_out(vty, "PIMv2 Bootstrap information\n"); if (pim->global_scope.current_bsr.s_addr == INADDR_ANY) { - strncpy(bsr_str, "0.0.0.0", sizeof(bsr_str)); + strlcpy(bsr_str, "0.0.0.0", sizeof(bsr_str)); pim_time_uptime(uptime, sizeof(uptime), pim->global_scope.current_bsr_first_ts); pim_time_uptime(last_bsm_seen, sizeof(last_bsm_seen), @@ -3669,16 +3663,16 @@ static void pim_show_bsr(struct pim_instance *pim, switch (pim->global_scope.state) { case NO_INFO: - strncpy(bsr_state, "NO_INFO", sizeof(bsr_state)); + strlcpy(bsr_state, "NO_INFO", sizeof(bsr_state)); break; case ACCEPT_ANY: - strncpy(bsr_state, "ACCEPT_ANY", sizeof(bsr_state)); + strlcpy(bsr_state, "ACCEPT_ANY", sizeof(bsr_state)); break; case ACCEPT_PREFERRED: - strncpy(bsr_state, "ACCEPT_PREFERRED", sizeof(bsr_state)); + strlcpy(bsr_state, "ACCEPT_PREFERRED", sizeof(bsr_state)); break; default: - strncpy(bsr_state, "", sizeof(bsr_state)); + strlcpy(bsr_state, "", sizeof(bsr_state)); } if (uj) { @@ -3806,44 +3800,51 @@ DEFUN (clear_ip_pim_statistics, return CMD_SUCCESS; } -static void mroute_add_all(struct pim_instance *pim) +static void clear_mroute(struct pim_instance *pim) { - struct listnode *node; - struct channel_oil *c_oil; + struct pim_upstream *up; + struct interface *ifp; - for (ALL_LIST_ELEMENTS_RO(pim->channel_oil_list, node, c_oil)) { - if (pim_mroute_add(c_oil, __PRETTY_FUNCTION__)) { - /* just log warning */ - char source_str[INET_ADDRSTRLEN]; - char group_str[INET_ADDRSTRLEN]; - pim_inet4_dump("<source?>", c_oil->oil.mfcc_origin, - source_str, sizeof(source_str)); - pim_inet4_dump("<group?>", c_oil->oil.mfcc_mcastgrp, - group_str, sizeof(group_str)); - zlog_warn("%s %s: (S,G)=(%s,%s) failure writing MFC", - __FILE__, __PRETTY_FUNCTION__, source_str, - group_str); + /* scan interfaces */ + FOR_ALL_INTERFACES (pim->vrf, ifp) { + struct pim_interface *pim_ifp = ifp->info; + struct listnode *sock_node; + struct igmp_sock *igmp; + struct pim_ifchannel *ch; + + if (!pim_ifp) + continue; + + /* deleting all ifchannels */ + while (!RB_EMPTY(pim_ifchannel_rb, &pim_ifp->ifchannel_rb)) { + ch = RB_ROOT(pim_ifchannel_rb, &pim_ifp->ifchannel_rb); + + pim_ifchannel_delete(ch); } - } -} -static void mroute_del_all(struct pim_instance *pim) -{ - struct listnode *node; - struct channel_oil *c_oil; + /* clean up all igmp groups */ + /* scan igmp sockets */ + for (ALL_LIST_ELEMENTS_RO(pim_ifp->igmp_socket_list, sock_node, + igmp)) { - for (ALL_LIST_ELEMENTS_RO(pim->channel_oil_list, node, c_oil)) { - if (pim_mroute_del(c_oil, __PRETTY_FUNCTION__)) { - /* just log warning */ - char source_str[INET_ADDRSTRLEN]; - char group_str[INET_ADDRSTRLEN]; - pim_inet4_dump("<source?>", c_oil->oil.mfcc_origin, - source_str, sizeof(source_str)); - pim_inet4_dump("<group?>", c_oil->oil.mfcc_mcastgrp, - group_str, sizeof(group_str)); - zlog_warn("%s %s: (S,G)=(%s,%s) failure clearing MFC", - __FILE__, __PRETTY_FUNCTION__, source_str, - group_str); + struct igmp_group *grp; + + if (igmp->igmp_group_list) { + while (igmp->igmp_group_list->count) { + grp = listnode_head( + igmp->igmp_group_list); + igmp_group_delete(grp); + } + } + + } + } + + /* clean up all upstreams*/ + if (pim->upstream_list) { + while (pim->upstream_list->count) { + up = listnode_head(pim->upstream_list); + pim_upstream_del(pim, up, __PRETTY_FUNCTION__); } } } @@ -3862,8 +3863,7 @@ DEFUN (clear_ip_mroute, if (!vrf) return CMD_WARNING; - mroute_del_all(vrf->info); - mroute_add_all(vrf->info); + clear_mroute(vrf->info); return CMD_SUCCESS; } @@ -5326,11 +5326,6 @@ static void show_mroute(struct pim_instance *pim, struct vty *vty, json_ifp_out, "protocolVxlan"); if (c_oil->oif_flags[oif_vif_index] - & PIM_OIF_FLAG_PROTO_SOURCE) - json_object_boolean_true_add( - json_ifp_out, "protocolSource"); - - if (c_oil->oif_flags[oif_vif_index] & PIM_OIF_FLAG_PROTO_STAR) json_object_boolean_true_add( json_ifp_out, @@ -5373,11 +5368,6 @@ static void show_mroute(struct pim_instance *pim, struct vty *vty, } if (c_oil->oif_flags[oif_vif_index] - & PIM_OIF_FLAG_PROTO_SOURCE) { - strlcpy(proto, "SRC", sizeof(proto)); - } - - if (c_oil->oif_flags[oif_vif_index] & PIM_OIF_FLAG_PROTO_STAR) { strlcpy(proto, "STAR", sizeof(proto)); } @@ -5610,11 +5600,54 @@ DEFUN (show_ip_mroute_vrf_all, return CMD_SUCCESS; } +DEFUN (clear_ip_mroute_count, + clear_ip_mroute_count_cmd, + "clear ip mroute [vrf NAME] count", + CLEAR_STR + IP_STR + MROUTE_STR + VRF_CMD_HELP_STR + "Route and packet count data\n") +{ + int idx = 2; + struct listnode *node; + struct channel_oil *c_oil; + struct static_route *sr; + struct vrf *vrf = pim_cmd_lookup_vrf(vty, argv, argc, &idx); + struct pim_instance *pim; + + if (!vrf) + return CMD_WARNING; + + pim = vrf->info; + for (ALL_LIST_ELEMENTS_RO(pim->channel_oil_list, node, c_oil)) { + if (!c_oil->installed) + continue; + + pim_mroute_update_counters(c_oil); + c_oil->cc.origpktcnt = c_oil->cc.pktcnt; + c_oil->cc.origbytecnt = c_oil->cc.bytecnt; + c_oil->cc.origwrong_if = c_oil->cc.wrong_if; + } + + for (ALL_LIST_ELEMENTS_RO(pim->static_routes, node, sr)) { + if (!sr->c_oil.installed) + continue; + + pim_mroute_update_counters(&sr->c_oil); + + sr->c_oil.cc.origpktcnt = sr->c_oil.cc.pktcnt; + sr->c_oil.cc.origbytecnt = sr->c_oil.cc.bytecnt; + sr->c_oil.cc.origwrong_if = sr->c_oil.cc.wrong_if; + } + return CMD_SUCCESS; +} + static void show_mroute_count(struct pim_instance *pim, struct vty *vty) { struct listnode *node; struct channel_oil *c_oil; - struct static_route *s_route; + struct static_route *sr; vty_out(vty, "\n"); @@ -5638,28 +5671,30 @@ static void show_mroute_count(struct pim_instance *pim, struct vty *vty) vty_out(vty, "%-15s %-15s %-8llu %-7ld %-10ld %-7ld\n", source_str, group_str, c_oil->cc.lastused / 100, - c_oil->cc.pktcnt, c_oil->cc.bytecnt, - c_oil->cc.wrong_if); + c_oil->cc.pktcnt - c_oil->cc.origpktcnt, + c_oil->cc.bytecnt - c_oil->cc.origbytecnt, + c_oil->cc.wrong_if - c_oil->cc.origwrong_if); } - for (ALL_LIST_ELEMENTS_RO(pim->static_routes, node, s_route)) { + for (ALL_LIST_ELEMENTS_RO(pim->static_routes, node, sr)) { char group_str[INET_ADDRSTRLEN]; char source_str[INET_ADDRSTRLEN]; - if (!s_route->c_oil.installed) + if (!sr->c_oil.installed) continue; - pim_mroute_update_counters(&s_route->c_oil); + pim_mroute_update_counters(&sr->c_oil); - pim_inet4_dump("<group?>", s_route->c_oil.oil.mfcc_mcastgrp, + pim_inet4_dump("<group?>", sr->c_oil.oil.mfcc_mcastgrp, group_str, sizeof(group_str)); - pim_inet4_dump("<source?>", s_route->c_oil.oil.mfcc_origin, + pim_inet4_dump("<source?>", sr->c_oil.oil.mfcc_origin, source_str, sizeof(source_str)); vty_out(vty, "%-15s %-15s %-8llu %-7ld %-10ld %-7ld\n", - source_str, group_str, s_route->c_oil.cc.lastused, - s_route->c_oil.cc.pktcnt, s_route->c_oil.cc.bytecnt, - s_route->c_oil.cc.wrong_if); + source_str, group_str, sr->c_oil.cc.lastused, + sr->c_oil.cc.pktcnt - sr->c_oil.cc.origpktcnt, + sr->c_oil.cc.bytecnt - sr->c_oil.cc.origbytecnt, + sr->c_oil.cc.wrong_if - sr->c_oil.cc.origwrong_if); } } @@ -10303,6 +10338,7 @@ void pim_cmd_init(void) install_element(VIEW_NODE, &show_ip_pim_bsm_db_cmd); install_element(VIEW_NODE, &show_ip_pim_statistics_cmd); + install_element(ENABLE_NODE, &clear_ip_mroute_count_cmd); install_element(ENABLE_NODE, &clear_ip_interfaces_cmd); install_element(ENABLE_NODE, &clear_ip_igmp_interfaces_cmd); install_element(ENABLE_NODE, &clear_ip_mroute_cmd); diff --git a/pimd/pim_igmp.c b/pimd/pim_igmp.c index 213ca48bb..4ae6f69d3 100644 --- a/pimd/pim_igmp.c +++ b/pimd/pim_igmp.c @@ -741,7 +741,7 @@ static void igmp_group_free(struct igmp_group *group) XFREE(MTYPE_PIM_IGMP_GROUP, group); } -static void igmp_group_delete(struct igmp_group *group) +void igmp_group_delete(struct igmp_group *group) { struct listnode *src_node; struct listnode *src_nextnode; diff --git a/pimd/pim_igmp.h b/pimd/pim_igmp.h index c8b880ddd..7db568dcf 100644 --- a/pimd/pim_igmp.h +++ b/pimd/pim_igmp.h @@ -197,4 +197,5 @@ void igmp_send_query(int igmp_version, struct igmp_group *group, int fd, int query_max_response_time_dsec, uint8_t s_flag, uint8_t querier_robustness_variable, uint16_t querier_query_interval); +void igmp_group_delete(struct igmp_group *group); #endif /* PIM_IGMP_H */ diff --git a/pimd/pim_mroute.c b/pimd/pim_mroute.c index 866a19fc9..ca0582434 100644 --- a/pimd/pim_mroute.c +++ b/pimd/pim_mroute.c @@ -897,11 +897,11 @@ int pim_mroute_add(struct channel_oil *c_oil, const char *name) int err; int orig = 0; int orig_iif_vif = 0; - struct pim_interface *pim_reg_ifp; - int orig_pimreg_ttl; + struct pim_interface *pim_reg_ifp = NULL; + int orig_pimreg_ttl = 0; bool pimreg_ttl_reset = false; - struct pim_interface *vxlan_ifp; - int orig_term_ttl; + struct pim_interface *vxlan_ifp = NULL; + int orig_term_ttl = 0; bool orig_term_ttl_reset = false; pim->mroute_add_last = pim_time_monotonic_sec(); @@ -985,9 +985,11 @@ int pim_mroute_add(struct channel_oil *c_oil, const char *name) if (c_oil->oil.mfcc_origin.s_addr == INADDR_ANY) c_oil->oil.mfcc_ttls[c_oil->oil.mfcc_parent] = orig; - if (pimreg_ttl_reset) + if (pimreg_ttl_reset) { + assert(pim_reg_ifp); c_oil->oil.mfcc_ttls[pim_reg_ifp->mroute_vif_index] = orig_pimreg_ttl; + } if (orig_term_ttl_reset) c_oil->oil.mfcc_ttls[vxlan_ifp->mroute_vif_index] = diff --git a/pimd/pim_nht.c b/pimd/pim_nht.c index 1a2f45152..65ea858cb 100644 --- a/pimd/pim_nht.c +++ b/pimd/pim_nht.c @@ -447,7 +447,7 @@ static int pim_update_upstream_nh_helper(struct hash_bucket *bucket, void *arg) struct pim_rpf old; old.source_nexthop.interface = up->rpf.source_nexthop.interface; - rpf_result = pim_rpf_update(pim, up, &old, 0); + rpf_result = pim_rpf_update(pim, up, &old); if (rpf_result == PIM_RPF_FAILURE) { pim_upstream_rpf_clear(pim, up); return HASHWALK_CONTINUE; diff --git a/pimd/pim_oil.h b/pimd/pim_oil.h index c5106d01c..d097da6b3 100644 --- a/pimd/pim_oil.h +++ b/pimd/pim_oil.h @@ -32,13 +32,11 @@ */ #define PIM_OIF_FLAG_PROTO_IGMP (1 << 0) #define PIM_OIF_FLAG_PROTO_PIM (1 << 1) -#define PIM_OIF_FLAG_PROTO_SOURCE (1 << 2) -#define PIM_OIF_FLAG_PROTO_STAR (1 << 3) -#define PIM_OIF_FLAG_PROTO_VXLAN (1 << 4) +#define PIM_OIF_FLAG_PROTO_STAR (1 << 2) +#define PIM_OIF_FLAG_PROTO_VXLAN (1 << 3) #define PIM_OIF_FLAG_PROTO_ANY \ (PIM_OIF_FLAG_PROTO_IGMP | PIM_OIF_FLAG_PROTO_PIM \ - | PIM_OIF_FLAG_PROTO_SOURCE | PIM_OIF_FLAG_PROTO_STAR \ - | PIM_OIF_FLAG_PROTO_VXLAN) + | PIM_OIF_FLAG_PROTO_STAR | PIM_OIF_FLAG_PROTO_VXLAN) /* * We need a pimreg vif id from the kernel. @@ -53,10 +51,13 @@ struct channel_counts { unsigned long long lastused; + unsigned long origpktcnt; unsigned long pktcnt; unsigned long oldpktcnt; + unsigned long origbytecnt; unsigned long bytecnt; unsigned long oldbytecnt; + unsigned long origwrong_if; unsigned long wrong_if; unsigned long oldwrong_if; }; diff --git a/pimd/pim_rp.c b/pimd/pim_rp.c index ca865d28c..35c040c64 100644 --- a/pimd/pim_rp.c +++ b/pimd/pim_rp.c @@ -381,7 +381,7 @@ void pim_upstream_update(struct pim_instance *pim, struct pim_upstream *up) old_rpf.source_nexthop.interface = up->rpf.source_nexthop.interface; - rpf_result = pim_rpf_update(pim, up, &old_rpf, 1); + rpf_result = pim_rpf_update(pim, up, &old_rpf); if (rpf_result == PIM_RPF_FAILURE) pim_mroute_del(up->channel_oil, __PRETTY_FUNCTION__); diff --git a/pimd/pim_rpf.c b/pimd/pim_rpf.c index d38880245..b1a2e717d 100644 --- a/pimd/pim_rpf.c +++ b/pimd/pim_rpf.c @@ -195,8 +195,7 @@ static int nexthop_mismatch(const struct pim_nexthop *nh1, } enum pim_rpf_result pim_rpf_update(struct pim_instance *pim, - struct pim_upstream *up, struct pim_rpf *old, - uint8_t is_new) + struct pim_upstream *up, struct pim_rpf *old) { struct pim_rpf *rpf = &up->rpf; struct pim_rpf saved; @@ -216,14 +215,6 @@ enum pim_rpf_result pim_rpf_update(struct pim_instance *pim, saved.source_nexthop = rpf->source_nexthop; saved.rpf_addr = rpf->rpf_addr; - if (is_new && PIM_DEBUG_ZEBRA) { - char source_str[INET_ADDRSTRLEN]; - pim_inet4_dump("<source?>", up->upstream_addr, source_str, - sizeof(source_str)); - zlog_debug("%s: NHT Register upstream %s addr %s with Zebra.", - __PRETTY_FUNCTION__, up->sg_str, source_str); - } - /* Register addr with Zebra NHT */ nht_p.family = AF_INET; nht_p.prefixlen = IPV4_MAX_BITLEN; nht_p.u.prefix4.s_addr = up->upstream_addr.s_addr; diff --git a/pimd/pim_rpf.h b/pimd/pim_rpf.h index 1172acb4b..df7b24928 100644 --- a/pimd/pim_rpf.h +++ b/pimd/pim_rpf.h @@ -62,8 +62,8 @@ bool pim_rpf_equal(const void *arg1, const void *arg2); bool pim_nexthop_lookup(struct pim_instance *pim, struct pim_nexthop *nexthop, struct in_addr addr, int neighbor_needed); enum pim_rpf_result pim_rpf_update(struct pim_instance *pim, - struct pim_upstream *up, struct pim_rpf *old, - uint8_t is_new); + struct pim_upstream *up, + struct pim_rpf *old); void pim_upstream_rpf_clear(struct pim_instance *pim, struct pim_upstream *up); int pim_rpf_addr_is_inaddr_none(struct pim_rpf *rpf); diff --git a/pimd/pim_upstream.c b/pimd/pim_upstream.c index 44b8ecbfe..50c68c66b 100644 --- a/pimd/pim_upstream.c +++ b/pimd/pim_upstream.c @@ -749,7 +749,7 @@ static struct pim_upstream *pim_upstream_new(struct pim_instance *pim, up->channel_oil = pim_channel_oil_add(pim, &up->sg, MAXVIFS); } else { - rpf_result = pim_rpf_update(pim, up, NULL, 1); + rpf_result = pim_rpf_update(pim, up, NULL); if (rpf_result == PIM_RPF_FAILURE) { if (PIM_DEBUG_TRACE) zlog_debug( @@ -1625,7 +1625,7 @@ void pim_upstream_find_new_rpf(struct pim_instance *pim) zlog_debug( "%s: Upstream %s without a path to send join, checking", __PRETTY_FUNCTION__, up->sg_str); - pim_rpf_update(pim, up, NULL, 1); + pim_rpf_update(pim, up, NULL); } } } diff --git a/pimd/pim_vxlan.c b/pimd/pim_vxlan.c index 09669e206..d2648fad5 100644 --- a/pimd/pim_vxlan.c +++ b/pimd/pim_vxlan.c @@ -245,7 +245,7 @@ static void pim_vxlan_orig_mr_up_del(struct pim_vxlan_sg *vxlan_sg) * for nht */ if (up) - pim_rpf_update(vxlan_sg->pim, up, NULL, 1 /* is_new */); + pim_rpf_update(vxlan_sg->pim, up, NULL); } } diff --git a/pimd/pim_zlookup.c b/pimd/pim_zlookup.c index 6d93a40b9..77526281d 100644 --- a/pimd/pim_zlookup.c +++ b/pimd/pim_zlookup.c @@ -37,8 +37,10 @@ #include "pim_zlookup.h" static struct zclient *zlookup = NULL; +struct thread *zlookup_read; static void zclient_lookup_sched(struct zclient *zlookup, int delay); +static int zclient_lookup_read_pipe(struct thread *thread); /* Connect to zebra for nexthop lookup. */ static int zclient_lookup_connect(struct thread *t) @@ -65,6 +67,8 @@ static int zclient_lookup_connect(struct thread *t) return -1; } + thread_add_timer(router->master, zclient_lookup_read_pipe, zlookup, 60, + &zlookup_read); return 0; } @@ -113,6 +117,7 @@ static void zclient_lookup_failed(struct zclient *zlookup) void zclient_lookup_free(void) { + thread_cancel(zlookup_read); zclient_stop(zlookup); zclient_free(zlookup); zlookup = NULL; @@ -357,6 +362,20 @@ static int zclient_lookup_nexthop_once(struct pim_instance *pim, return zclient_read_nexthop(pim, zlookup, nexthop_tab, tab_size, addr); } +int zclient_lookup_read_pipe(struct thread *thread) +{ + struct zclient *zlookup = THREAD_ARG(thread); + struct pim_instance *pim = pim_get_pim_instance(VRF_DEFAULT); + struct pim_zlookup_nexthop nexthop_tab[10]; + struct in_addr l = {.s_addr = INADDR_ANY}; + + zclient_lookup_nexthop_once(pim, nexthop_tab, 10, l); + thread_add_timer(router->master, zclient_lookup_read_pipe, zlookup, 60, + &zlookup_read); + + return 1; +} + int zclient_lookup_nexthop(struct pim_instance *pim, struct pim_zlookup_nexthop nexthop_tab[], const int tab_size, struct in_addr addr, diff --git a/pimd/pimd.h b/pimd/pimd.h index cdeaed397..175936e0a 100644 --- a/pimd/pimd.h +++ b/pimd/pimd.h @@ -154,23 +154,25 @@ extern uint8_t qpim_ecmp_rebalance_enable; #define PIM_DEBUG_PIM_EVENTS (router->debugs & PIM_MASK_PIM_EVENTS) #define PIM_DEBUG_PIM_EVENTS_DETAIL \ - (router->debugs & PIM_MASK_PIM_EVENTS_DETAIL) + (router->debugs & (PIM_MASK_PIM_EVENTS_DETAIL | PIM_MASK_PIM_EVENTS)) #define PIM_DEBUG_PIM_PACKETS (router->debugs & PIM_MASK_PIM_PACKETS) #define PIM_DEBUG_PIM_PACKETDUMP_SEND \ (router->debugs & PIM_MASK_PIM_PACKETDUMP_SEND) #define PIM_DEBUG_PIM_PACKETDUMP_RECV \ (router->debugs & PIM_MASK_PIM_PACKETDUMP_RECV) #define PIM_DEBUG_PIM_TRACE (router->debugs & PIM_MASK_PIM_TRACE) -#define PIM_DEBUG_PIM_TRACE_DETAIL (router->debugs & PIM_MASK_PIM_TRACE_DETAIL) +#define PIM_DEBUG_PIM_TRACE_DETAIL \ + (router->debugs & (PIM_MASK_PIM_TRACE_DETAIL | PIM_MASK_PIM_TRACE)) #define PIM_DEBUG_IGMP_EVENTS (router->debugs & PIM_MASK_IGMP_EVENTS) #define PIM_DEBUG_IGMP_PACKETS (router->debugs & PIM_MASK_IGMP_PACKETS) #define PIM_DEBUG_IGMP_TRACE (router->debugs & PIM_MASK_IGMP_TRACE) #define PIM_DEBUG_IGMP_TRACE_DETAIL \ - (router->debugs & PIM_MASK_IGMP_TRACE_DETAIL) + (router->debugs & (PIM_MASK_IGMP_TRACE_DETAIL | PIM_MASK_IGMP_TRACE)) #define PIM_DEBUG_ZEBRA (router->debugs & PIM_MASK_ZEBRA) #define PIM_DEBUG_SSMPINGD (router->debugs & PIM_MASK_SSMPINGD) #define PIM_DEBUG_MROUTE (router->debugs & PIM_MASK_MROUTE) -#define PIM_DEBUG_MROUTE_DETAIL (router->debugs & PIM_MASK_MROUTE_DETAIL) +#define PIM_DEBUG_MROUTE_DETAIL \ + (router->debugs & (PIM_MASK_MROUTE_DETAIL | PIM_MASK_MROUTE)) #define PIM_DEBUG_PIM_HELLO (router->debugs & PIM_MASK_PIM_HELLO) #define PIM_DEBUG_PIM_J_P (router->debugs & PIM_MASK_PIM_J_P) #define PIM_DEBUG_PIM_REG (router->debugs & PIM_MASK_PIM_REG) @@ -179,7 +181,8 @@ extern uint8_t qpim_ecmp_rebalance_enable; #define PIM_DEBUG_MSDP_PACKETS (router->debugs & PIM_MASK_MSDP_PACKETS) #define PIM_DEBUG_MSDP_INTERNAL (router->debugs & PIM_MASK_MSDP_INTERNAL) #define PIM_DEBUG_PIM_NHT (router->debugs & PIM_MASK_PIM_NHT) -#define PIM_DEBUG_PIM_NHT_DETAIL (router->debugs & PIM_MASK_PIM_NHT_DETAIL) +#define PIM_DEBUG_PIM_NHT_DETAIL \ + (router->debugs & (PIM_MASK_PIM_NHT_DETAIL | PIM_MASK_PIM_NHT)) #define PIM_DEBUG_PIM_NHT_RP (router->debugs & PIM_MASK_PIM_NHT_RP) #define PIM_DEBUG_MTRACE (router->debugs & PIM_MASK_MTRACE) #define PIM_DEBUG_VXLAN (router->debugs & PIM_MASK_VXLAN) |