pimd, pim6d: Don't allow pim disabled interface as nexthop

While doing nexthop lookup, only allow the nexthop
interafce which is PIM enabled.

Issue: #10782
Issue: #11931

Signed-off-by: Sarita Patra <saritap@vmware.com>
This commit is contained in:
Sarita Patra 2022-11-10 23:21:35 -08:00
parent 93d4f4f0dd
commit 31b66ed67d
2 changed files with 17 additions and 8 deletions

View File

@ -529,6 +529,7 @@ static int pim_ecmp_nexthop_search(struct pim_instance *pim,
uint32_t hash_val = 0, mod_val = 0;
uint8_t nh_iter = 0, found = 0;
uint32_t i, num_nbrs = 0;
struct pim_interface *pim_ifp;
if (!pnc || !pnc->nexthop_num || !nexthop)
return 0;
@ -645,10 +646,13 @@ static int pim_ecmp_nexthop_search(struct pim_instance *pim,
nh_iter++;
continue;
}
if (!ifp->info) {
pim_ifp = ifp->info;
if (!pim_ifp || !pim_ifp->pim_enable) {
if (PIM_DEBUG_PIM_NHT)
zlog_debug(
"%s: multicast not enabled on input interface %s(%s) (ifindex=%d, RPF for source %pPA)",
"%s: pim not enabled on input interface %s(%s) (ifindex=%d, RPF for source %pPA)",
__func__, ifp->name, pim->vrf->name,
first_ifindex, &src);
if (nh_iter == mod_val)
@ -916,6 +920,7 @@ int pim_ecmp_nexthop_lookup(struct pim_instance *pim,
uint8_t i = 0;
uint32_t hash_val = 0, mod_val = 0;
uint32_t num_nbrs = 0;
struct pim_interface *pim_ifp;
if (PIM_DEBUG_PIM_NHT_DETAIL)
zlog_debug("%s: Looking up: %pPA(%s), last lookup time: %lld",
@ -998,10 +1003,12 @@ int pim_ecmp_nexthop_lookup(struct pim_instance *pim,
continue;
}
if (!ifp->info) {
pim_ifp = ifp->info;
if (!pim_ifp || !pim_ifp->pim_enable) {
if (PIM_DEBUG_PIM_NHT)
zlog_debug(
"%s: multicast not enabled on input interface %s(%s) (ifindex=%d, RPF for source %pPA)",
"%s: pim not enabled on input interface %s(%s) (ifindex=%d, RPF for source %pPA)",
__func__, ifp->name, pim->vrf->name,
first_ifindex, &src);
if (i == mod_val)

View File

@ -61,6 +61,7 @@ bool pim_nexthop_lookup(struct pim_instance *pim, struct pim_nexthop *nexthop,
ifindex_t first_ifindex = 0;
int found = 0;
int i = 0;
struct pim_interface *pim_ifp;
#if PIM_IPV == 4
/*
@ -118,15 +119,16 @@ bool pim_nexthop_lookup(struct pim_instance *pim, struct pim_nexthop *nexthop,
continue;
}
if (!ifp->info) {
pim_ifp = ifp->info;
if (!pim_ifp || !pim_ifp->pim_enable) {
if (PIM_DEBUG_ZEBRA)
zlog_debug(
"%s: multicast not enabled on input interface %s (ifindex=%d, RPF for source %pPAs)",
"%s: pim not enabled on input interface %s (ifindex=%d, RPF for source %pPAs)",
__func__, ifp->name, first_ifindex,
&addr);
i++;
} else if (neighbor_needed
&& !pim_if_connected_to_source(ifp, addr)) {
} else if (neighbor_needed &&
!pim_if_connected_to_source(ifp, addr)) {
nbr = pim_neighbor_find(ifp,
nexthop_tab[i].nexthop_addr);
if (PIM_DEBUG_PIM_TRACE_DETAIL)