summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bgpd/bgp_nht.c4
-rw-r--r--bgpd/rfapi/vnc_debug.c30
-rw-r--r--lib/bfd.c4
-rw-r--r--lib/distribute.c2
-rw-r--r--lib/ferr.c2
-rw-r--r--lib/grammar_sandbox.c2
-rw-r--r--lib/hash.c2
-rw-r--r--lib/if.c3
-rw-r--r--lib/if_rmap.c2
-rw-r--r--lib/imsg.c4
-rw-r--r--lib/keychain.c2
-rw-r--r--lib/log.c2
-rw-r--r--lib/nexthop_group.c2
-rw-r--r--lib/prefix.h13
-rw-r--r--lib/sigevent.c2
-rw-r--r--lib/thread.c11
-rw-r--r--lib/vrf.c2
-rw-r--r--lib/vty.c2
-rw-r--r--lib/vty.h1
-rw-r--r--lib/zclient.c6
-rw-r--r--pbrd/pbr_zebra.c7
-rw-r--r--pimd/pim_cmd.c36
-rw-r--r--pimd/pim_igmp_mtrace.c14
-rw-r--r--pimd/pim_mroute.c7
-rw-r--r--pimd/pim_neighbor.c2
-rw-r--r--pimd/pim_nht.c39
-rw-r--r--pimd/pim_nht.h1
-rw-r--r--pimd/pim_rp.c7
-rw-r--r--pimd/pim_rp.h2
-rw-r--r--pimd/pim_rpf.c14
-rw-r--r--pimd/pim_rpf.h4
-rw-r--r--zebra/kernel_socket.c10
32 files changed, 70 insertions, 171 deletions
diff --git a/bgpd/bgp_nht.c b/bgpd/bgp_nht.c
index 2b4ad22b93..6e85abc8df 100644
--- a/bgpd/bgp_nht.c
+++ b/bgpd/bgp_nht.c
@@ -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
diff --git a/bgpd/rfapi/vnc_debug.c b/bgpd/rfapi/vnc_debug.c
index cb9799870b..7cac7ac7a1 100644
--- a/bgpd/rfapi/vnc_debug.c
+++ b/bgpd/rfapi/vnc_debug.c
@@ -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);
}
diff --git a/lib/bfd.c b/lib/bfd.c
index 178c203f5e..7e27a64de7 100644
--- 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
diff --git a/lib/distribute.c b/lib/distribute.c
index fa8ac5242e..be40bd2603 100644
--- a/lib/distribute.c
+++ b/lib/distribute.c
@@ -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)
{
diff --git a/lib/ferr.c b/lib/ferr.c
index e18597afb0..d7fa1a84f8 100644
--- a/lib/ferr.c
+++ b/lib/ferr.c
@@ -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)
diff --git a/lib/grammar_sandbox.c b/lib/grammar_sandbox.c
index 20d5879c67..c6fd3c04ad 100644
--- a/lib/grammar_sandbox.c
+++ b/lib/grammar_sandbox.c
@@ -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 { \
diff --git a/lib/hash.c b/lib/hash.c
index c02b81814c..884c8f22af 100644
--- a/lib/hash.c
+++ b/lib/hash.c
@@ -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,
diff --git a/lib/if.c b/lib/if.c
index 5b1473af40..5fdeb4540b 100644
--- 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
diff --git a/lib/if_rmap.c b/lib/if_rmap.c
index 955c1417c4..d8236b6b25 100644
--- a/lib/if_rmap.c
+++ b/lib/if_rmap.c
@@ -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)
{
diff --git a/lib/imsg.c b/lib/imsg.c
index 57e70617d2..f07c56f0a6 100644
--- a/lib/imsg.c
+++ b/lib/imsg.c
@@ -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__
/*
diff --git a/lib/keychain.c b/lib/keychain.c
index 0a96c4cf0e..fc9f0f9cfa 100644
--- a/lib/keychain.c
+++ b/lib/keychain.c
@@ -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)
{
diff --git a/lib/log.c b/lib/log.c
index cf623a4c19..8724e0db93 100644
--- 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",
diff --git a/lib/nexthop_group.c b/lib/nexthop_group.c
index 27ab04279c..dbc3337785 100644
--- a/lib/nexthop_group.c
+++ b/lib/nexthop_group.c
@@ -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,
diff --git a/lib/prefix.h b/lib/prefix.h
index ae931288c0..a1c2086b8d 100644
--- a/lib/prefix.h
+++ b/lib/prefix.h
@@ -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
diff --git a/lib/sigevent.c b/lib/sigevent.c
index 57b41503e1..f00ff4921e 100644
--- a/lib/sigevent.c
+++ b/lib/sigevent.c
@@ -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;
diff --git a/lib/thread.c b/lib/thread.c
index 19ab409439..2760b83fb3 100644
--- a/lib/thread.c
+++ b/lib/thread.c
@@ -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' : ' ',
diff --git a/lib/vrf.c b/lib/vrf.c
index dd87ed63e8..bc289be9c0 100644
--- 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 {
diff --git a/lib/vty.c b/lib/vty.c
index 0bcee6a801..dae8e82599 100644
--- 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;
diff --git a/lib/vty.h b/lib/vty.h
index ca5a2003c4..9c2653e1ac 100644
--- 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. */
diff --git a/lib/zclient.c b/lib/zclient.c
index 3e26cd9e6c..92a9d5ef31 100644
--- a/lib/zclient.c
+++ b/lib/zclient.c
@@ -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,
diff --git a/pbrd/pbr_zebra.c b/pbrd/pbr_zebra.c
index 44c8daa97b..4f8f50556b 100644
--- a/pbrd/pbr_zebra.c
+++ b/pbrd/pbr_zebra.c
@@ -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;
}
diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c
index 70b3ae10e5..1a30904e21 100644
--- a/pimd/pim_cmd.c
+++ b/pimd/pim_cmd.c
@@ -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);
diff --git a/pimd/pim_igmp_mtrace.c b/pimd/pim_igmp_mtrace.c
index f51e0c0d2f..0758e2f784 100644
--- a/pimd/pim_igmp_mtrace.c
+++ b/pimd/pim_igmp_mtrace.c
@@ -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 "
diff --git a/pimd/pim_mroute.c b/pimd/pim_mroute.c
index 999a1eb580..a2d50aba51 100644
--- a/pimd/pim_mroute.c
+++ b/pimd/pim_mroute.c
@@ -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,
diff --git a/pimd/pim_neighbor.c b/pimd/pim_neighbor.c
index 436f2dec27..a63b09fc1f 100644
--- a/pimd/pim_neighbor.c
+++ b/pimd/pim_neighbor.c
@@ -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);
diff --git a/pimd/pim_nht.c b/pimd/pim_nht.c
index 9b5379384c..5e550dfe85 100644
--- a/pimd/pim_nht.c
+++ b/pimd/pim_nht.c
@@ -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)
{
diff --git a/pimd/pim_nht.h b/pimd/pim_nht.h
index 6eff7bbc89..e3e9f578c9 100644
--- a/pimd/pim_nht.h
+++ b/pimd/pim_nht.h
@@ -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);
diff --git a/pimd/pim_rp.c b/pimd/pim_rp.c
index b7db7d0418..4e285720a2 100644
--- a/pimd/pim_rp.c
+++ b/pimd/pim_rp.c
@@ -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;
diff --git a/pimd/pim_rp.h b/pimd/pim_rp.h
index e0f8e16be0..402ec30aba 100644
--- a/pimd/pim_rp.h
+++ b/pimd/pim_rp.h
@@ -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);
diff --git a/pimd/pim_rpf.c b/pimd/pim_rpf.c
index ee145a5b51..55f788b5bb 100644
--- a/pimd/pim_rpf.c
+++ b/pimd/pim_rpf.c
@@ -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,
diff --git a/pimd/pim_rpf.h b/pimd/pim_rpf.h
index a4793df667..57bb22674f 100644
--- a/pimd/pim_rpf.h
+++ b/pimd/pim_rpf.h
@@ -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);
diff --git a/zebra/kernel_socket.c b/zebra/kernel_socket.c
index 1bbb98ad19..13d2185b0f 100644
--- a/zebra/kernel_socket.c
+++ b/zebra/kernel_socket.c
@@ -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;