]> git.proxmox.com Git - mirror_frr.git/commitdiff
Merge pull request #4074 from qlyoung/remove-event-counter
authorRenato Westphal <renato@openbsd.org>
Thu, 4 Apr 2019 15:03:12 +0000 (12:03 -0300)
committerGitHub <noreply@github.com>
Thu, 4 Apr 2019 15:03:12 +0000 (12:03 -0300)
lib: remove event_counter.[ch]

32 files changed:
bgpd/bgp_nht.c
bgpd/rfapi/vnc_debug.c
lib/bfd.c
lib/distribute.c
lib/ferr.c
lib/grammar_sandbox.c
lib/hash.c
lib/if.c
lib/if_rmap.c
lib/imsg.c
lib/keychain.c
lib/log.c
lib/nexthop_group.c
lib/prefix.h
lib/sigevent.c
lib/thread.c
lib/vrf.c
lib/vty.c
lib/vty.h
lib/zclient.c
pbrd/pbr_zebra.c
pimd/pim_cmd.c
pimd/pim_igmp_mtrace.c
pimd/pim_mroute.c
pimd/pim_neighbor.c
pimd/pim_nht.c
pimd/pim_nht.h
pimd/pim_rp.c
pimd/pim_rp.h
pimd/pim_rpf.c
pimd/pim_rpf.h
zebra/kernel_socket.c

index 2b4ad22b9392441d4b8909c01fb751b85acd99db..6e85abc8dfc8f260f1883b14bba0ecaede288940 100644 (file)
@@ -243,8 +243,10 @@ int bgp_find_or_add_nexthop(struct bgp *bgp_route, struct bgp *bgp_nexthop,
        if (bgp_route->inst_type == BGP_INSTANCE_TYPE_VIEW) {
                SET_FLAG(bnc->flags, BGP_NEXTHOP_REGISTERED);
                SET_FLAG(bnc->flags, BGP_NEXTHOP_VALID);
-       } else if (!CHECK_FLAG(bnc->flags, BGP_NEXTHOP_REGISTERED))
+       } else if (!CHECK_FLAG(bnc->flags, BGP_NEXTHOP_REGISTERED) &&
+                  !is_default_host_route(&bnc->node->p))
                register_zebra_rnh(bnc, is_bgp_static_route);
+
        if (pi && pi->nexthop != bnc) {
                /* Unlink from existing nexthop cache, if any. This will also
                 * free
index cb9799870b5ed3ff80923f69e6998698f80ba89c..7cac7ac7a16680036a4caf1a30dbf30fff02598c 100644 (file)
@@ -114,21 +114,6 @@ DEFUN (no_debug_bgp_vnc,
        return CMD_WARNING_CONFIG_FAILED;
 }
 
-#if CONFDATE > 20190402
-CPP_NOTICE("bgpd: time to remove undebug commands")
-#endif
-ALIAS_HIDDEN(no_debug_bgp_vnc,
-             undebug_bgp_vnc_cmd,
-            "undebug bgp vnc <rfapi-query|import-bi-attach|import-del-remote|verbose>",
-             "Undebug\n"
-             BGP_STR
-             VNC_STR
-             "rfapi query handling\n"
-             "import BI atachment\n"
-             "import delete remote routes\n"
-             "verbose logging\n")
-
-
 /***********************************************************************
  *     no debug bgp vnc all
  ***********************************************************************/
@@ -148,17 +133,6 @@ DEFUN (no_debug_bgp_vnc_all,
        return CMD_SUCCESS;
 }
 
-#if CONFDATE > 20190402
-CPP_NOTICE("bgpd: time to remove undebug commands")
-#endif
-ALIAS_HIDDEN (no_debug_bgp_vnc_all,
-              undebug_bgp_vnc_all_cmd,
-              "undebug all bgp vnc",
-              "Undebug\n"
-              "Disable all VNC debugging\n"
-              BGP_STR
-              VNC_STR)
-
 /***********************************************************************
  *     show/save
  ***********************************************************************/
@@ -210,11 +184,7 @@ void vnc_debug_init(void)
        install_element(CONFIG_NODE, &debug_bgp_vnc_cmd);
        install_element(ENABLE_NODE, &no_debug_bgp_vnc_cmd);
        install_element(CONFIG_NODE, &no_debug_bgp_vnc_cmd);
-       install_element(ENABLE_NODE, &undebug_bgp_vnc_cmd);
-       install_element(CONFIG_NODE, &undebug_bgp_vnc_cmd);
 
        install_element(ENABLE_NODE, &no_debug_bgp_vnc_all_cmd);
        install_element(CONFIG_NODE, &no_debug_bgp_vnc_all_cmd);
-       install_element(ENABLE_NODE, &undebug_bgp_vnc_all_cmd);
-       install_element(CONFIG_NODE, &undebug_bgp_vnc_all_cmd);
 }
index 178c203f5e9f64ca66fdcbe617a95e8723ef570f..7e27a64de7bcc20f490b61e3240d0fc945977065 100644 (file)
--- a/lib/bfd.c
+++ b/lib/bfd.c
@@ -34,8 +34,8 @@
 
 DEFINE_MTYPE_STATIC(LIB, BFD_INFO, "BFD info")
 
-int bfd_debug = 0;
-struct bfd_gbl bfd_gbl;
+static int bfd_debug = 0;
+static struct bfd_gbl bfd_gbl;
 
 /*
  * bfd_gbl_init - Initialize the BFD global structure
index fa8ac5242ed6aa13584b898cc8e7eb792c54fec5..be40bd2603d5acf78b16e0632aca5e53279d417e 100644 (file)
@@ -32,7 +32,7 @@ DEFINE_MTYPE_STATIC(LIB, DISTRIBUTE, "Distribute list")
 DEFINE_MTYPE_STATIC(LIB, DISTRIBUTE_IFNAME, "Dist-list ifname")
 DEFINE_MTYPE_STATIC(LIB, DISTRIBUTE_NAME, "Dist-list name")
 
-struct list *dist_ctx_list;
+static struct list *dist_ctx_list;
 
 static struct distribute *distribute_new(void)
 {
index e18597afb07c0a92537c26909516b1b4faa47983..d7fa1a84f8955960e010cb7a673368262103dc9b 100644 (file)
@@ -61,7 +61,7 @@ static void err_key_fini(void)
 /*
  * Global shared hash table holding reference text for all defined errors.
  */
-pthread_mutex_t refs_mtx = PTHREAD_MUTEX_INITIALIZER;
+static pthread_mutex_t refs_mtx = PTHREAD_MUTEX_INITIALIZER;
 struct hash *refs;
 
 static bool ferr_hash_cmp(const void *a, const void *b)
index 20d5879c67784278225635c000c540bc00ccf3d7..c6fd3c04adece80ad9f8930e56f15a5e62935a12 100644 (file)
@@ -44,7 +44,7 @@ void pretty_print_graph(struct vty *vty, struct graph_node *, int, int,
 void init_cmdgraph(struct vty *, struct graph **);
 
 /** shim interface commands **/
-struct graph *nodegraph = NULL, *nodegraph_free = NULL;
+static struct graph *nodegraph = NULL, *nodegraph_free = NULL;
 
 #define check_nodegraph()                                                      \
        do {                                                                   \
index c02b81814cc0b509ed1d52da6c727b11b6dda70d..884c8f22af72baabc740bc0af1f758bded705f05 100644 (file)
@@ -33,7 +33,7 @@ DEFINE_MTYPE(LIB, HASH, "Hash")
 DEFINE_MTYPE(LIB, HASH_BACKET, "Hash Bucket")
 DEFINE_MTYPE_STATIC(LIB, HASH_INDEX, "Hash Index")
 
-pthread_mutex_t _hashes_mtx = PTHREAD_MUTEX_INITIALIZER;
+static pthread_mutex_t _hashes_mtx = PTHREAD_MUTEX_INITIALIZER;
 static struct list *_hashes;
 
 struct hash *hash_create_size(unsigned int size,
index 5b1473af40907408fb9ed1d29afce6fe66838313..5fdeb4540bb2598d3bf85b390d3859900ff020d2 100644 (file)
--- a/lib/if.c
+++ b/lib/if.c
@@ -56,9 +56,6 @@ DEFINE_QOBJ_TYPE(interface)
 DEFINE_HOOK(if_add, (struct interface * ifp), (ifp))
 DEFINE_KOOH(if_del, (struct interface * ifp), (ifp))
 
-/* List of interfaces in only the default VRF */
-int ptm_enable = 0;
-
 /* Compare interface names, returning an integer greater than, equal to, or
  * less than 0, (following the strcmp convention), according to the
  * relationship between ifp1 and ifp2.  Interface names consist of an
index 955c1417c4f47680480c04862e7e4572c1347cfb..d8236b6b255e3829c446dea3ad6d27b9da18111d 100644 (file)
@@ -31,7 +31,7 @@ DEFINE_MTYPE_STATIC(LIB, IF_RMAP_CTX_NAME, "Interface route map container name")
 DEFINE_MTYPE_STATIC(LIB, IF_RMAP, "Interface route map")
 DEFINE_MTYPE_STATIC(LIB, IF_RMAP_NAME, "I.f. route map name")
 
-struct list *if_rmap_ctx_list;
+static struct list *if_rmap_ctx_list;
 
 static struct if_rmap *if_rmap_new(void)
 {
index 57e70617d27849497d45d566112fcbf43ae884ae..f07c56f0a64500b009fe6fa9766bc1f4b51b9abf 100644 (file)
@@ -22,9 +22,9 @@
 #include "queue.h"
 #include "imsg.h"
 
-int imsg_fd_overhead = 0;
+static int imsg_fd_overhead = 0;
 
-int imsg_get_fd(struct imsgbuf *);
+static int imsg_get_fd(struct imsgbuf *);
 
 #ifndef __OpenBSD__
 /*
index 0a96c4cf0e2115894bbf74a9c6adb89670b64db4..fc9f0f9cfa95f811a2fef15ab96860babb8edd82 100644 (file)
@@ -32,7 +32,7 @@ DEFINE_QOBJ_TYPE(keychain)
 DEFINE_QOBJ_TYPE(key)
 
 /* Master list of key chain. */
-struct list *keychain_list;
+static struct list *keychain_list;
 
 static struct keychain *keychain_new(void)
 {
index cf623a4c19bbdfbfb946df5efd8356dfadb3d6db..8724e0db9349b64618b58568869ce1519a961a7d 100644 (file)
--- a/lib/log.c
+++ b/lib/log.c
@@ -57,7 +57,7 @@ struct zlog *zlog_default = NULL;
 bool zlog_startup_stderr = true;
 
 /* lock protecting zlog_default for mt-safe zlog */
-pthread_mutex_t loglock = PTHREAD_MUTEX_INITIALIZER;
+static pthread_mutex_t loglock = PTHREAD_MUTEX_INITIALIZER;
 
 const char *zlog_priority[] = {
        "emergencies",   "alerts",      "critical",  "errors", "warnings",
index 27ab04279c1cc3617dca745fd3b19c2f54def98c..dbc333778593ca02d3fde497ade6082944400af6 100644 (file)
@@ -49,7 +49,7 @@ nexthop_group_cmd_compare(const struct nexthop_group_cmd *nhgc1,
 RB_GENERATE(nhgc_entry_head, nexthop_group_cmd, nhgc_entry,
            nexthop_group_cmd_compare)
 
-struct nhgc_entry_head nhgc_entries;
+static struct nhgc_entry_head nhgc_entries;
 
 static inline int
 nexthop_group_cmd_compare(const struct nexthop_group_cmd *nhgc1,
index ae931288c02527736a18a039d3876f8d459aebcf..a1c2086b8db4e6727a6f6d1401ec1d2b4d5c0e28 100644 (file)
@@ -511,6 +511,19 @@ static inline int is_host_route(struct prefix *p)
        return 0;
 }
 
+static inline int is_default_host_route(struct prefix *p)
+{
+       if (p->family == AF_INET) {
+               return (p->u.prefix4.s_addr == INADDR_ANY &&
+                       p->prefixlen == IPV4_MAX_BITLEN);
+       } else if (p->family == AF_INET6) {
+               return ((!memcmp(&p->u.prefix6, &in6addr_any,
+                                sizeof(struct in6_addr))) &&
+                       p->prefixlen == IPV6_MAX_BITLEN);
+       }
+       return 0;
+}
+
 #ifdef __cplusplus
 }
 #endif
index 57b41503e1c142d5c4c6b7b8f18da96c80ae8225..f00ff4921e59ecd1757b2eaf7517034a55e8061b 100644 (file)
@@ -38,7 +38,7 @@
 
 
 /* master signals descriptor struct */
-struct quagga_sigevent_master_t {
+static struct quagga_sigevent_master_t {
        struct thread *t;
 
        struct quagga_signal_t *signals;
index 19ab409439945c415e86913b9d98779780bc2520..2760b83fb3c4aadd4d3f31cda56e654d8c7f3288 100644 (file)
@@ -52,10 +52,10 @@ DEFINE_MTYPE_STATIC(LIB, THREAD_STATS, "Thread stats")
        } while (0);
 
 /* control variable for initializer */
-pthread_once_t init_once = PTHREAD_ONCE_INIT;
+static pthread_once_t init_once = PTHREAD_ONCE_INIT;
 pthread_key_t thread_current;
 
-pthread_mutex_t masters_mtx = PTHREAD_MUTEX_INITIALIZER;
+static pthread_mutex_t masters_mtx = PTHREAD_MUTEX_INITIALIZER;
 static struct list *masters;
 
 static void thread_free(struct thread_master *master, struct thread *thread);
@@ -93,10 +93,9 @@ static void cpu_record_hash_free(void *a)
 static void vty_out_cpu_thread_history(struct vty *vty,
                                       struct cpu_thread_history *a)
 {
-       vty_out(vty, "%5"PRIdFAST32" %10lu.%03lu %9"PRIuFAST32
-               " %8lu %9lu %8lu %9lu", a->total_active,
-               a->cpu.total / 1000, a->cpu.total % 1000, a->total_calls,
-               a->cpu.total / a->total_calls, a->cpu.max,
+       vty_out(vty, "%5zu %10zu.%03lu %9zu %8zu %9zu %8lu %9lu",
+               a->total_active, a->cpu.total / 1000, a->cpu.total % 1000,
+               a->total_calls, a->cpu.total / a->total_calls, a->cpu.max,
                a->real.total / a->total_calls, a->real.max);
        vty_out(vty, " %c%c%c%c%c %s\n",
                a->types & (1 << THREAD_READ) ? 'R' : ' ',
index dd87ed63e810b7cf5a7107ac2330f42f2445ad4b..bc289be9c0c2481b45da71bad39f8cbf5fde8f9f 100644 (file)
--- a/lib/vrf.c
+++ b/lib/vrf.c
@@ -64,7 +64,7 @@ static char vrf_default_name[VRF_NAMSIZ] = VRF_DEFAULT_NAME_INTERNAL;
  * Turn on/off debug code
  * for vrf.
  */
-int debug_vrf = 0;
+static int debug_vrf = 0;
 
 /* Holding VRF hooks  */
 struct vrf_master {
index 0bcee6a80141d7b1407895586d27ff6b44ee0ec9..dae8e825993ba84356c3ef5797bc2221400a2d00 100644 (file)
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -93,7 +93,7 @@ struct vty *vty_exclusive_lock;
 static int no_password_check = 0;
 
 /* Integrated configuration file path */
-char integrate_default[] = SYSCONFDIR INTEGRATE_DEFAULT_CONFIG;
+static char integrate_default[] = SYSCONFDIR INTEGRATE_DEFAULT_CONFIG;
 
 static int do_log_commands = 0;
 
index ca5a2003c46402940ec7fae86c2159cffd1e2d6f..9c2653e1ac0ded45a43a604adbb9f5a63a5bcf69 100644 (file)
--- a/lib/vty.h
+++ b/lib/vty.h
@@ -290,7 +290,6 @@ struct vty_arg {
 #endif
 
 /* Exported variables */
-extern char integrate_default[];
 extern struct vty *vty_exclusive_lock;
 
 /* Prototypes. */
index 3e26cd9e6c42cc512ce821b03610901e449b17b6..92a9d5ef3153923b31bf6340d4575826e55b5406 100644 (file)
@@ -49,13 +49,13 @@ enum event { ZCLIENT_SCHEDULE, ZCLIENT_READ, ZCLIENT_CONNECT };
 /* Prototype for event manager. */
 static void zclient_event(enum event, struct zclient *);
 
+struct zclient_options zclient_options_default = {.receive_notify = false};
+
 struct sockaddr_storage zclient_addr;
 socklen_t zclient_addr_len;
 
 /* This file local debug flag. */
-int zclient_debug = 0;
-
-struct zclient_options zclient_options_default = {.receive_notify = false};
+static int zclient_debug;
 
 /* Allocate zclient structure. */
 struct zclient *zclient_new(struct thread_master *master,
index 44c8daa97b90c214759dfaa701ac0dd3f60e0bf2..4f8f50556bb5d616a422a5d0bbe4d934e72797bb 100644 (file)
@@ -240,18 +240,19 @@ static int rule_notify_owner(int command, struct zclient *zclient,
        switch (note) {
        case ZAPI_RULE_FAIL_INSTALL:
                pbrms->installed &= ~installed;
-               DEBUGD(&pbr_dbg_zebra, "%s: Received RULE_FAIL_INSTALL: %lu",
+               DEBUGD(&pbr_dbg_zebra,
+                      "%s: Received RULE_FAIL_INSTALL: %" PRIu64,
                       __PRETTY_FUNCTION__, pbrms->installed);
                break;
        case ZAPI_RULE_INSTALLED:
                pbrms->installed |= installed;
-               DEBUGD(&pbr_dbg_zebra, "%s: Received RULE_INSTALLED: %lu",
+               DEBUGD(&pbr_dbg_zebra, "%s: Received RULE_INSTALLED: %" PRIu64,
                       __PRETTY_FUNCTION__, pbrms->installed);
                break;
        case ZAPI_RULE_FAIL_REMOVE:
        case ZAPI_RULE_REMOVED:
                pbrms->installed &= ~installed;
-               DEBUGD(&pbr_dbg_zebra, "%s: Received RULE REMOVED: %lu",
+               DEBUGD(&pbr_dbg_zebra, "%s: Received RULE REMOVED: %" PRIu64,
                       __PRETTY_FUNCTION__, pbrms->installed);
                break;
        }
index 70b3ae10e58ff2c6222912ef89e016345e68b606..1a30904e21c82ff094e97e4cf29856638c0625d1 100644 (file)
@@ -5026,7 +5026,7 @@ DEFUN (show_ip_rib,
                return CMD_WARNING;
        }
 
-       if (pim_nexthop_lookup(vrf->info, &nexthop, addr, 0)) {
+       if (!pim_nexthop_lookup(vrf->info, &nexthop, addr, 0)) {
                vty_out(vty,
                        "Failure querying RIB nexthop for unicast address %s\n",
                        addr_str);
@@ -7414,14 +7414,6 @@ DEFUN (no_debug_msdp,
        return CMD_SUCCESS;
 }
 
-#if CONFDATE > 20190402
-CPP_NOTICE("bgpd: time to remove undebug commands")
-#endif
-ALIAS_HIDDEN (no_debug_msdp,
-              undebug_msdp_cmd,
-              "undebug msdp",
-              UNDEBUG_STR DEBUG_MSDP_STR)
-
 DEFUN (debug_msdp_events,
        debug_msdp_events_cmd,
        "debug msdp events",
@@ -7445,16 +7437,6 @@ DEFUN (no_debug_msdp_events,
        return CMD_SUCCESS;
 }
 
-#if CONFDATE > 20190402
-CPP_NOTICE("bgpd: time to remove undebug commands")
-#endif
-ALIAS_HIDDEN (no_debug_msdp_events,
-              undebug_msdp_events_cmd,
-              "undebug msdp events",
-              UNDEBUG_STR
-              DEBUG_MSDP_STR
-              DEBUG_MSDP_EVENTS_STR)
-
 DEFUN (debug_msdp_packets,
        debug_msdp_packets_cmd,
        "debug msdp packets",
@@ -7478,16 +7460,6 @@ DEFUN (no_debug_msdp_packets,
        return CMD_SUCCESS;
 }
 
-#if CONFDATE > 20190402
-CPP_NOTICE("bgpd: time to remove undebug commands")
-#endif
-ALIAS_HIDDEN (no_debug_msdp_packets,
-              undebug_msdp_packets_cmd,
-              "undebug msdp packets",
-              UNDEBUG_STR
-              DEBUG_MSDP_STR
-              DEBUG_MSDP_PACKETS_STR)
-
 DEFUN (debug_mtrace,
        debug_mtrace_cmd,
        "debug mtrace",
@@ -8921,13 +8893,10 @@ void pim_cmd_init(void)
        install_element(ENABLE_NODE, &no_debug_pim_zebra_cmd);
        install_element(ENABLE_NODE, &debug_msdp_cmd);
        install_element(ENABLE_NODE, &no_debug_msdp_cmd);
-       install_element(ENABLE_NODE, &undebug_msdp_cmd);
        install_element(ENABLE_NODE, &debug_msdp_events_cmd);
        install_element(ENABLE_NODE, &no_debug_msdp_events_cmd);
-       install_element(ENABLE_NODE, &undebug_msdp_events_cmd);
        install_element(ENABLE_NODE, &debug_msdp_packets_cmd);
        install_element(ENABLE_NODE, &no_debug_msdp_packets_cmd);
-       install_element(ENABLE_NODE, &undebug_msdp_packets_cmd);
        install_element(ENABLE_NODE, &debug_mtrace_cmd);
        install_element(ENABLE_NODE, &no_debug_mtrace_cmd);
 
@@ -8965,13 +8934,10 @@ void pim_cmd_init(void)
        install_element(CONFIG_NODE, &no_debug_pim_zebra_cmd);
        install_element(CONFIG_NODE, &debug_msdp_cmd);
        install_element(CONFIG_NODE, &no_debug_msdp_cmd);
-       install_element(CONFIG_NODE, &undebug_msdp_cmd);
        install_element(CONFIG_NODE, &debug_msdp_events_cmd);
        install_element(CONFIG_NODE, &no_debug_msdp_events_cmd);
-       install_element(CONFIG_NODE, &undebug_msdp_events_cmd);
        install_element(CONFIG_NODE, &debug_msdp_packets_cmd);
        install_element(CONFIG_NODE, &no_debug_msdp_packets_cmd);
-       install_element(CONFIG_NODE, &undebug_msdp_packets_cmd);
        install_element(CONFIG_NODE, &debug_mtrace_cmd);
        install_element(CONFIG_NODE, &no_debug_mtrace_cmd);
 
index f51e0c0d2f1a1e2be1a3c6df3032a89a17ee7766..0758e2f784eb6c7ddec8300fe0b7b1d39e1fd701 100644 (file)
@@ -66,16 +66,13 @@ static bool mtrace_fwd_info_weak(struct pim_instance *pim,
        struct pim_nexthop nexthop;
        struct interface *ifp_in;
        struct in_addr nh_addr;
-       int ret;
        char nexthop_str[INET_ADDRSTRLEN];
 
        nh_addr.s_addr = 0;
 
        memset(&nexthop, 0, sizeof(nexthop));
 
-       ret = pim_nexthop_lookup(pim, &nexthop, mtracep->src_addr, 1);
-
-       if (ret != 0) {
+       if (!pim_nexthop_lookup(pim, &nexthop, mtracep->src_addr, 1)) {
                if (PIM_DEBUG_MTRACE)
                        zlog_debug("mtrace not found neighbor");
                return false;
@@ -418,9 +415,7 @@ static int mtrace_un_forward_packet(struct pim_instance *pim, struct ip *ip_hdr,
 
        if (interface == NULL) {
                memset(&nexthop, 0, sizeof(nexthop));
-               ret = pim_nexthop_lookup(pim, &nexthop, ip_hdr->ip_dst, 0);
-
-               if (ret != 0) {
+               if (!pim_nexthop_lookup(pim, &nexthop, ip_hdr->ip_dst, 0)) {
                        close(fd);
                        if (PIM_DEBUG_MTRACE)
                                zlog_warn(
@@ -568,7 +563,6 @@ static int mtrace_send_response(struct pim_instance *pim,
                                struct igmp_mtrace *mtracep, size_t mtrace_len)
 {
        struct pim_nexthop nexthop;
-       int ret;
 
        mtracep->type = PIM_IGMP_MTRACE_RESPONSE;
 
@@ -599,9 +593,7 @@ static int mtrace_send_response(struct pim_instance *pim,
        } else {
                memset(&nexthop, 0, sizeof(nexthop));
                /* TODO: should use unicast rib lookup */
-               ret = pim_nexthop_lookup(pim, &nexthop, mtracep->rsp_addr, 1);
-
-               if (ret != 0) {
+               if (!pim_nexthop_lookup(pim, &nexthop, mtracep->rsp_addr, 1)) {
                        if (PIM_DEBUG_MTRACE)
                                zlog_warn(
                                        "Dropped response qid=%ud, no route to "
index 999a1eb5806bc03dd5d86b682ac299a838b8ef14..a2d50aba5159c5b8f5d7b3360ee2122914836303 100644 (file)
@@ -513,8 +513,7 @@ static int pim_mroute_msg_wrvifwhole(int fd, struct interface *ifp,
                if (!PIM_UPSTREAM_FLAG_TEST_FHR(up->flags)) {
                        // No if channel, but upstream we are at the RP.
                        if (pim_nexthop_lookup(pim_ifp->pim, &source,
-                                              up->upstream_register, 0)
-                           == 0) {
+                                              up->upstream_register, 0)) {
                                pim_register_stop_send(source.interface, &sg,
                                                       pim_ifp->primary_address,
                                                       up->upstream_register);
@@ -531,8 +530,8 @@ static int pim_mroute_msg_wrvifwhole(int fd, struct interface *ifp,
                } else {
                        if (I_am_RP(pim_ifp->pim, up->sg.grp)) {
                                if (pim_nexthop_lookup(pim_ifp->pim, &source,
-                                                      up->upstream_register, 0)
-                                   == 0)
+                                                      up->upstream_register,
+                                                      0))
                                        pim_register_stop_send(
                                                source.interface, &sg,
                                                pim_ifp->primary_address,
index 436f2dec277e723e1fc748546289e61c688b7789..a63b09fc1f9a05b4119bb85eefda954224788010 100644 (file)
@@ -540,7 +540,7 @@ pim_neighbor_add(struct interface *ifp, struct in_addr source_addr,
           Upon PIM neighbor UP, iterate all RPs and update
           nexthop cache with this neighbor.
         */
-       pim_resolve_rp_nh(pim_ifp->pim);
+       pim_resolve_rp_nh(pim_ifp->pim, neigh);
 
        pim_rp_setup(pim_ifp->pim);
 
index 9b5379384c9905a6baa96dff4e51c32c33aa2641..5e550dfe853558084cd8c2c0528623d6963436d5 100644 (file)
@@ -264,45 +264,6 @@ static void pim_update_rp_nh(struct pim_instance *pim,
        }
 }
 
-/* This API is used to traverse nexthop cache of RPF addr
-   of upstream entry whose IPv4 nexthop address is in
-   unresolved state and due to event like pim neighbor
-   UP event if it can be resolved.
-*/
-void pim_resolve_upstream_nh(struct pim_instance *pim, struct prefix *nht_p)
-{
-       struct nexthop *nh_node = NULL;
-       struct pim_nexthop_cache pnc;
-       struct pim_neighbor *nbr = NULL;
-
-       memset(&pnc, 0, sizeof(struct pim_nexthop_cache));
-       if (!pim_find_or_track_nexthop(pim, nht_p, NULL, NULL, &pnc))
-               return;
-
-       for (nh_node = pnc.nexthop; nh_node; nh_node = nh_node->next) {
-               if (nh_node->gate.ipv4.s_addr != 0)
-                       continue;
-
-               struct interface *ifp1 =
-                       if_lookup_by_index(nh_node->ifindex, pim->vrf_id);
-               nbr = pim_neighbor_find_if(ifp1);
-               if (!nbr)
-                       continue;
-
-               nh_node->gate.ipv4 = nbr->source_addr;
-               if (PIM_DEBUG_PIM_NHT) {
-                       char str[PREFIX_STRLEN];
-                       char str1[INET_ADDRSTRLEN];
-                       pim_inet4_dump("<nht_nbr?>", nbr->source_addr, str1,
-                                      sizeof(str1));
-                       pim_addr_dump("<nht_addr?>", nht_p, str, sizeof(str));
-                       zlog_debug(
-                               "%s: addr %s new nexthop addr %s interface %s",
-                               __PRETTY_FUNCTION__, str, str1, ifp1->name);
-               }
-       }
-}
-
 /* Update Upstream nexthop info based on Nexthop update received from Zebra.*/
 static int pim_update_upstream_nh_helper(struct hash_bucket *bucket, void *arg)
 {
index 6eff7bbc891a33caf75528c2c434400fc72910cb..e3e9f578c9f151708ab4fca823ad2edf07afda6c 100644 (file)
@@ -65,7 +65,6 @@ int pim_ecmp_nexthop_lookup(struct pim_instance *pim,
                            struct prefix *grp, int neighbor_needed);
 void pim_sendmsg_zebra_rnh(struct pim_instance *pim, struct zclient *zclient,
                           struct pim_nexthop_cache *pnc, int command);
-void pim_resolve_upstream_nh(struct pim_instance *pim, struct prefix *nht_p);
 int pim_ecmp_fib_lookup_if_vif_index(struct pim_instance *pim,
                                     struct prefix *src, struct prefix *grp);
 void pim_rp_nexthop_del(struct rp_info *rp_info);
index b7db7d04187fc100ea57bca967a873f6eb68b2f2..4e285720a205694a237d6fe4326420deed052e7c 100644 (file)
@@ -1206,14 +1206,13 @@ void pim_rp_show_information(struct pim_instance *pim, struct vty *vty, bool uj)
        }
 }
 
-void pim_resolve_rp_nh(struct pim_instance *pim)
+void pim_resolve_rp_nh(struct pim_instance *pim, struct pim_neighbor *nbr)
 {
        struct listnode *node = NULL;
        struct rp_info *rp_info = NULL;
        struct nexthop *nh_node = NULL;
        struct prefix nht_p;
        struct pim_nexthop_cache pnc;
-       struct pim_neighbor *nbr = NULL;
 
        for (ALL_LIST_ELEMENTS_RO(pim->rp_list, node, rp_info)) {
                if (rp_info->rp.rpf_addr.u.prefix4.s_addr == INADDR_NONE)
@@ -1233,8 +1232,8 @@ void pim_resolve_rp_nh(struct pim_instance *pim)
 
                        struct interface *ifp1 = if_lookup_by_index(
                                nh_node->ifindex, pim->vrf_id);
-                       nbr = pim_neighbor_find_if(ifp1);
-                       if (!nbr)
+
+                       if (nbr->interface != ifp1)
                                continue;
 
                        nh_node->gate.ipv4 = nbr->source_addr;
index e0f8e16be0d37e1e549b4eeb1d19c8ea8936f714..402ec30aba270167bdc4500dcbe81e5a54eba8dc 100644 (file)
@@ -68,7 +68,7 @@ struct pim_rpf *pim_rp_g(struct pim_instance *pim, struct in_addr group);
 
 void pim_rp_show_information(struct pim_instance *pim, struct vty *vty,
                             bool uj);
-void pim_resolve_rp_nh(struct pim_instance *pim);
+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,
                                        const struct prefix *group);
index ee145a5b51a56501da7508fa300f0d10d0825d16..55f788b5bb8db373295f5a9a3f77c5209f1d2483 100644 (file)
@@ -48,8 +48,8 @@ void pim_rpf_set_refresh_time(struct pim_instance *pim)
                           pim->last_route_change_time);
 }
 
-int pim_nexthop_lookup(struct pim_instance *pim, struct pim_nexthop *nexthop,
-                      struct in_addr addr, int neighbor_needed)
+bool pim_nexthop_lookup(struct pim_instance *pim, struct pim_nexthop *nexthop,
+                       struct in_addr addr, int neighbor_needed)
 {
        struct pim_zlookup_nexthop nexthop_tab[MULTIPATH_NUM];
        struct pim_neighbor *nbr = NULL;
@@ -65,7 +65,7 @@ int pim_nexthop_lookup(struct pim_instance *pim, struct pim_nexthop *nexthop,
         * it will never work
         */
        if (addr.s_addr == INADDR_NONE)
-               return -1;
+               return false;
 
        if ((nexthop->last_lookup.s_addr == addr.s_addr)
            && (nexthop->last_lookup_time > pim->last_route_change_time)) {
@@ -83,7 +83,7 @@ int pim_nexthop_lookup(struct pim_instance *pim, struct pim_nexthop *nexthop,
                                pim->last_route_change_time, nexthop_str);
                }
                pim->nexthop_lookups_avoided++;
-               return 0;
+               return true;
        } else {
                if (PIM_DEBUG_TRACE) {
                        char addr_str[INET_ADDRSTRLEN];
@@ -107,7 +107,7 @@ int pim_nexthop_lookup(struct pim_instance *pim, struct pim_nexthop *nexthop,
                zlog_warn(
                        "%s %s: could not find nexthop ifindex for address %s",
                        __FILE__, __PRETTY_FUNCTION__, addr_str);
-               return -1;
+               return false;
        }
 
        while (!found && (i < num_ifindex)) {
@@ -179,9 +179,9 @@ int pim_nexthop_lookup(struct pim_instance *pim, struct pim_nexthop *nexthop,
                nexthop->last_lookup = addr;
                nexthop->last_lookup_time = pim_time_monotonic_usec();
                nexthop->nbr = nbr;
-               return 0;
+               return true;
        } else
-               return -1;
+               return false;
 }
 
 static int nexthop_mismatch(const struct pim_nexthop *nh1,
index a4793df667f379ce10aba5c21a4052c481d958b6..57bb22674fa6209b64d9935b5c70b24f86e9b2ba 100644 (file)
@@ -59,8 +59,8 @@ struct pim_upstream;
 unsigned int pim_rpf_hash_key(void *arg);
 bool pim_rpf_equal(const void *arg1, const void *arg2);
 
-int pim_nexthop_lookup(struct pim_instance *pim, struct pim_nexthop *nexthop,
-                      struct in_addr addr, int neighbor_needed);
+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);
index 1bbb98ad19056d35f623c270521f77b9aa0a2a53..13d2185b0fa04dfb26fcc337b567fa48b7b4a655 100644 (file)
@@ -280,8 +280,9 @@ size_t _rta_get(caddr_t sap, void *destp, size_t destlen, bool checkaf)
                }
 
                if (copylen > destlen) {
-                       zlog_warn("%s: destination buffer too small (%lu vs %lu)",
-                                 __func__, copylen, destlen);
+                       zlog_warn(
+                               "%s: destination buffer too small (%zu vs %zu)",
+                               __func__, copylen, destlen);
                        memcpy(dest, sap, destlen);
                } else
                        memcpy(dest, sap, copylen);
@@ -316,8 +317,9 @@ size_t rta_getsdlname(caddr_t sap, void *destp, short *destlen)
 
        if (copylen > 0 && dest != NULL && sdl->sdl_family == AF_LINK) {
                if (copylen > IFNAMSIZ) {
-                       zlog_warn("%s: destination buffer too small (%lu vs %d)",
-                                 __func__, copylen, IFNAMSIZ);
+                       zlog_warn(
+                               "%s: destination buffer too small (%zu vs %d)",
+                               __func__, copylen, IFNAMSIZ);
                        memcpy(dest, sdl->sdl_data, IFNAMSIZ);
                        dest[IFNAMSIZ] = 0;
                        *destlen = IFNAMSIZ;