forked from Mirror/frr
pimd: Refactor some functions
A bunch of functions had return values that were never checked for ( and not needed ) and opposite return values for proper calling function boolean logic. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
parent
da82728dbf
commit
cb9c7c50d3
|
@ -3599,10 +3599,9 @@ DEFUN (show_ip_pim_nexthop_lookup,
|
||||||
grp.u.prefix4 = grp_addr;
|
grp.u.prefix4 = grp_addr;
|
||||||
memset(&nexthop, 0, sizeof(nexthop));
|
memset(&nexthop, 0, sizeof(nexthop));
|
||||||
|
|
||||||
if ((pim_find_or_track_nexthop(&nht_p, NULL, NULL, &pnc)) == 1) {
|
if (pim_find_or_track_nexthop(&nht_p, NULL, NULL, &pnc))
|
||||||
// Compute PIM RPF using Cached nexthop
|
|
||||||
pim_ecmp_nexthop_search(&pnc, &nexthop, &nht_p, &grp, 0);
|
pim_ecmp_nexthop_search(&pnc, &nexthop, &nht_p, &grp, 0);
|
||||||
} else
|
else
|
||||||
pim_ecmp_nexthop_lookup(&nexthop, vif_source, &nht_p, &grp, 0);
|
pim_ecmp_nexthop_lookup(&nexthop, vif_source, &nht_p, &grp, 0);
|
||||||
|
|
||||||
pim_addr_dump("<grp?>", &grp, grp_str, sizeof(grp_str));
|
pim_addr_dump("<grp?>", &grp, grp_str, sizeof(grp_str));
|
||||||
|
|
|
@ -142,8 +142,13 @@ struct pim_nexthop_cache *pim_nexthop_cache_add(struct pim_rpf *rpf_addr)
|
||||||
return pnc;
|
return pnc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This API is used to Register an address with Zebra
|
/*
|
||||||
ret 1 means nexthop cache is found.
|
* pim_find_or_track_nexthop
|
||||||
|
*
|
||||||
|
* This API is used to Register an address with Zebra
|
||||||
|
*
|
||||||
|
* 1 -> Success
|
||||||
|
* 0 -> Failure
|
||||||
*/
|
*/
|
||||||
int pim_find_or_track_nexthop(struct prefix *addr, struct pim_upstream *up,
|
int pim_find_or_track_nexthop(struct prefix *addr, struct pim_upstream *up,
|
||||||
struct rp_info *rp,
|
struct rp_info *rp,
|
||||||
|
@ -172,7 +177,7 @@ int pim_find_or_track_nexthop(struct prefix *addr, struct pim_upstream *up,
|
||||||
sizeof(rpf_str));
|
sizeof(rpf_str));
|
||||||
zlog_warn("%s: pnc node allocation failed. addr %s ",
|
zlog_warn("%s: pnc node allocation failed. addr %s ",
|
||||||
__PRETTY_FUNCTION__, rpf_str);
|
__PRETTY_FUNCTION__, rpf_str);
|
||||||
return -1;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -299,31 +304,29 @@ void pim_resolve_upstream_nh(struct prefix *nht_p)
|
||||||
struct pim_neighbor *nbr = NULL;
|
struct pim_neighbor *nbr = NULL;
|
||||||
|
|
||||||
memset(&pnc, 0, sizeof(struct pim_nexthop_cache));
|
memset(&pnc, 0, sizeof(struct pim_nexthop_cache));
|
||||||
if ((pim_find_or_track_nexthop(nht_p, NULL, NULL, &pnc)) == 1) {
|
if (!pim_find_or_track_nexthop(nht_p, NULL, NULL, &pnc))
|
||||||
|
return;
|
||||||
|
|
||||||
for (nh_node = pnc.nexthop; nh_node; nh_node = nh_node->next) {
|
for (nh_node = pnc.nexthop; nh_node; nh_node = nh_node->next) {
|
||||||
if (nh_node->gate.ipv4.s_addr == 0) {
|
if (nh_node->gate.ipv4.s_addr != 0)
|
||||||
struct interface *ifp1 = if_lookup_by_index(
|
continue;
|
||||||
nh_node->ifindex, pimg->vrf_id);
|
|
||||||
|
struct interface *ifp1 =
|
||||||
|
if_lookup_by_index(nh_node->ifindex, pimg->vrf_id);
|
||||||
nbr = pim_neighbor_find_if(ifp1);
|
nbr = pim_neighbor_find_if(ifp1);
|
||||||
if (nbr) {
|
if (!nbr)
|
||||||
|
continue;
|
||||||
|
|
||||||
nh_node->gate.ipv4 = nbr->source_addr;
|
nh_node->gate.ipv4 = nbr->source_addr;
|
||||||
if (PIM_DEBUG_TRACE) {
|
if (PIM_DEBUG_TRACE) {
|
||||||
char str[PREFIX_STRLEN];
|
char str[PREFIX_STRLEN];
|
||||||
char str1[INET_ADDRSTRLEN];
|
char str1[INET_ADDRSTRLEN];
|
||||||
pim_inet4_dump("<nht_nbr?>",
|
pim_inet4_dump("<nht_nbr?>", nbr->source_addr, str1,
|
||||||
nbr->source_addr,
|
|
||||||
str1,
|
|
||||||
sizeof(str1));
|
sizeof(str1));
|
||||||
pim_addr_dump("<nht_addr?>",
|
pim_addr_dump("<nht_addr?>", nht_p, str, sizeof(str));
|
||||||
nht_p, str,
|
|
||||||
sizeof(str));
|
|
||||||
zlog_debug(
|
zlog_debug(
|
||||||
"%s: addr %s new nexthop addr %s interface %s",
|
"%s: addr %s new nexthop addr %s interface %s",
|
||||||
__PRETTY_FUNCTION__,
|
__PRETTY_FUNCTION__, str, str1, ifp1->name);
|
||||||
str, str1, ifp1->name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -499,7 +502,7 @@ int pim_ecmp_nexthop_search(struct pim_nexthop_cache *pnc,
|
||||||
uint8_t nh_iter = 0, found = 0;
|
uint8_t nh_iter = 0, found = 0;
|
||||||
|
|
||||||
if (!pnc || !pnc->nexthop_num || !nexthop)
|
if (!pnc || !pnc->nexthop_num || !nexthop)
|
||||||
return -1;
|
return 0;
|
||||||
|
|
||||||
// Current Nexthop is VALID, check to stay on the current path.
|
// Current Nexthop is VALID, check to stay on the current path.
|
||||||
if (nexthop->interface && nexthop->interface->info
|
if (nexthop->interface && nexthop->interface->info
|
||||||
|
@ -653,9 +656,9 @@ int pim_ecmp_nexthop_search(struct pim_nexthop_cache *pnc,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (found)
|
if (found)
|
||||||
return 0;
|
return 1;
|
||||||
else
|
else
|
||||||
return -1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This API is used to parse Registered address nexthop update coming from Zebra
|
/* This API is used to parse Registered address nexthop update coming from Zebra
|
||||||
|
@ -899,7 +902,7 @@ int pim_ecmp_nexthop_lookup(struct pim_nexthop *nexthop, struct in_addr addr,
|
||||||
zlog_warn(
|
zlog_warn(
|
||||||
"%s %s: could not find nexthop ifindex for address %s",
|
"%s %s: could not find nexthop ifindex for address %s",
|
||||||
__FILE__, __PRETTY_FUNCTION__, addr_str);
|
__FILE__, __PRETTY_FUNCTION__, addr_str);
|
||||||
return -1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If PIM ECMP enable then choose ECMP path.
|
// If PIM ECMP enable then choose ECMP path.
|
||||||
|
@ -1001,10 +1004,11 @@ int pim_ecmp_nexthop_lookup(struct pim_nexthop *nexthop, struct in_addr addr,
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (found)
|
if (found)
|
||||||
return 0;
|
return 1;
|
||||||
else
|
else
|
||||||
return -1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int pim_ecmp_fib_lookup_if_vif_index(struct in_addr addr, struct prefix *src,
|
int pim_ecmp_fib_lookup_if_vif_index(struct in_addr addr, struct prefix *src,
|
||||||
|
|
|
@ -402,14 +402,11 @@ int pim_rp_new(const char *rp, const char *group_range, const char *plist)
|
||||||
__PRETTY_FUNCTION__, buf, buf1);
|
__PRETTY_FUNCTION__, buf, buf1);
|
||||||
}
|
}
|
||||||
memset(&pnc, 0, sizeof(struct pim_nexthop_cache));
|
memset(&pnc, 0, sizeof(struct pim_nexthop_cache));
|
||||||
if ((pim_find_or_track_nexthop(&nht_p, NULL, rp_all,
|
if (pim_find_or_track_nexthop(&nht_p, NULL, rp_all,
|
||||||
&pnc))
|
&pnc)) {
|
||||||
== 1) {
|
if (!pim_ecmp_nexthop_search(
|
||||||
// Compute PIM RPF using Cached nexthop
|
|
||||||
if ((pim_ecmp_nexthop_search(
|
|
||||||
&pnc, &rp_all->rp.source_nexthop,
|
&pnc, &rp_all->rp.source_nexthop,
|
||||||
&nht_p, &rp_all->group, 1))
|
&nht_p, &rp_all->group, 1))
|
||||||
!= 0)
|
|
||||||
return PIM_RP_NO_PATH;
|
return PIM_RP_NO_PATH;
|
||||||
} else {
|
} else {
|
||||||
if (pim_nexthop_lookup(
|
if (pim_nexthop_lookup(
|
||||||
|
@ -474,11 +471,9 @@ int pim_rp_new(const char *rp, const char *group_range, const char *plist)
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(&pnc, 0, sizeof(struct pim_nexthop_cache));
|
memset(&pnc, 0, sizeof(struct pim_nexthop_cache));
|
||||||
if ((pim_find_or_track_nexthop(&nht_p, NULL, rp_info, &pnc)) == 1) {
|
if (pim_find_or_track_nexthop(&nht_p, NULL, rp_info, &pnc)) {
|
||||||
// Compute PIM RPF using Cached nexthop
|
if (!pim_ecmp_nexthop_search(&pnc, &rp_info->rp.source_nexthop,
|
||||||
if (pim_ecmp_nexthop_search(&pnc, &rp_info->rp.source_nexthop,
|
&nht_p, &rp_info->group, 1))
|
||||||
&nht_p, &rp_info->group, 1)
|
|
||||||
!= 0)
|
|
||||||
return PIM_RP_NO_PATH;
|
return PIM_RP_NO_PATH;
|
||||||
} else {
|
} else {
|
||||||
if (pim_nexthop_lookup(&rp_info->rp.source_nexthop,
|
if (pim_nexthop_lookup(&rp_info->rp.source_nexthop,
|
||||||
|
@ -554,11 +549,10 @@ int pim_rp_del(const char *rp, const char *group_range, const char *plist)
|
||||||
return PIM_SUCCESS;
|
return PIM_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int pim_rp_setup(void)
|
void pim_rp_setup(void)
|
||||||
{
|
{
|
||||||
struct listnode *node;
|
struct listnode *node;
|
||||||
struct rp_info *rp_info;
|
struct rp_info *rp_info;
|
||||||
int ret = 0;
|
|
||||||
struct prefix nht_p;
|
struct prefix nht_p;
|
||||||
struct pim_nexthop_cache pnc;
|
struct pim_nexthop_cache pnc;
|
||||||
|
|
||||||
|
@ -570,15 +564,11 @@ int pim_rp_setup(void)
|
||||||
nht_p.prefixlen = IPV4_MAX_BITLEN;
|
nht_p.prefixlen = IPV4_MAX_BITLEN;
|
||||||
nht_p.u.prefix4 = rp_info->rp.rpf_addr.u.prefix4;
|
nht_p.u.prefix4 = rp_info->rp.rpf_addr.u.prefix4;
|
||||||
memset(&pnc, 0, sizeof(struct pim_nexthop_cache));
|
memset(&pnc, 0, sizeof(struct pim_nexthop_cache));
|
||||||
if ((pim_find_or_track_nexthop(&nht_p, NULL, rp_info, &pnc))
|
if (pim_find_or_track_nexthop(&nht_p, NULL, rp_info, &pnc))
|
||||||
== 1) {
|
pim_ecmp_nexthop_search(&pnc,
|
||||||
// Compute PIM RPF using Cached nexthop
|
&rp_info->rp.source_nexthop,
|
||||||
if ((pim_ecmp_nexthop_search(
|
&nht_p, &rp_info->group, 1);
|
||||||
&pnc, &rp_info->rp.source_nexthop, &nht_p,
|
else {
|
||||||
&rp_info->group, 1))
|
|
||||||
!= 0)
|
|
||||||
ret++;
|
|
||||||
} else {
|
|
||||||
if (PIM_DEBUG_ZEBRA) {
|
if (PIM_DEBUG_ZEBRA) {
|
||||||
char buf[PREFIX2STR_BUFFER];
|
char buf[PREFIX2STR_BUFFER];
|
||||||
prefix2str(&nht_p, buf, sizeof(buf));
|
prefix2str(&nht_p, buf, sizeof(buf));
|
||||||
|
@ -589,21 +579,14 @@ int pim_rp_setup(void)
|
||||||
if (pim_nexthop_lookup(&rp_info->rp.source_nexthop,
|
if (pim_nexthop_lookup(&rp_info->rp.source_nexthop,
|
||||||
rp_info->rp.rpf_addr.u.prefix4,
|
rp_info->rp.rpf_addr.u.prefix4,
|
||||||
1)
|
1)
|
||||||
!= 0) {
|
!= 0)
|
||||||
if (PIM_DEBUG_PIM_TRACE)
|
if (PIM_DEBUG_PIM_TRACE)
|
||||||
zlog_debug(
|
zlog_debug(
|
||||||
"Unable to lookup nexthop for rp specified");
|
"Unable to lookup nexthop for rp specified");
|
||||||
ret++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Checks to see if we should elect ourself the actual RP when new if
|
* Checks to see if we should elect ourself the actual RP when new if
|
||||||
* addresses are added against an interface.
|
* addresses are added against an interface.
|
||||||
|
@ -745,13 +728,11 @@ struct pim_rpf *pim_rp_g(struct in_addr group)
|
||||||
__PRETTY_FUNCTION__, buf, buf1);
|
__PRETTY_FUNCTION__, buf, buf1);
|
||||||
}
|
}
|
||||||
memset(&pnc, 0, sizeof(struct pim_nexthop_cache));
|
memset(&pnc, 0, sizeof(struct pim_nexthop_cache));
|
||||||
if ((pim_find_or_track_nexthop(&nht_p, NULL, rp_info, &pnc))
|
if (pim_find_or_track_nexthop(&nht_p, NULL, rp_info, &pnc))
|
||||||
== 1) {
|
|
||||||
// Compute PIM RPF using Cached nexthop
|
|
||||||
pim_ecmp_nexthop_search(&pnc,
|
pim_ecmp_nexthop_search(&pnc,
|
||||||
&rp_info->rp.source_nexthop,
|
&rp_info->rp.source_nexthop,
|
||||||
&nht_p, &rp_info->group, 1);
|
&nht_p, &rp_info->group, 1);
|
||||||
} else {
|
else {
|
||||||
if (PIM_DEBUG_ZEBRA) {
|
if (PIM_DEBUG_ZEBRA) {
|
||||||
char buf[PREFIX2STR_BUFFER];
|
char buf[PREFIX2STR_BUFFER];
|
||||||
char buf1[PREFIX2STR_BUFFER];
|
char buf1[PREFIX2STR_BUFFER];
|
||||||
|
@ -989,44 +970,32 @@ void pim_resolve_rp_nh(void)
|
||||||
nht_p.prefixlen = IPV4_MAX_BITLEN;
|
nht_p.prefixlen = IPV4_MAX_BITLEN;
|
||||||
nht_p.u.prefix4 = rp_info->rp.rpf_addr.u.prefix4;
|
nht_p.u.prefix4 = rp_info->rp.rpf_addr.u.prefix4;
|
||||||
memset(&pnc, 0, sizeof(struct pim_nexthop_cache));
|
memset(&pnc, 0, sizeof(struct pim_nexthop_cache));
|
||||||
if ((pim_find_or_track_nexthop(&nht_p, NULL, rp_info, &pnc))
|
if (!pim_find_or_track_nexthop(&nht_p, NULL, rp_info, &pnc))
|
||||||
== 1) {
|
continue;
|
||||||
for (nh_node = pnc.nexthop; nh_node;
|
|
||||||
nh_node = nh_node->next) {
|
for (nh_node = pnc.nexthop; nh_node; nh_node = nh_node->next) {
|
||||||
if (nh_node->gate.ipv4.s_addr == 0) {
|
if (nh_node->gate.ipv4.s_addr != 0)
|
||||||
nbr = pim_neighbor_find_if(
|
continue;
|
||||||
if_lookup_by_index(
|
|
||||||
nh_node->ifindex,
|
struct interface *ifp1 = if_lookup_by_index(
|
||||||
pimg->vrf_id));
|
nh_node->ifindex, pimg->vrf_id);
|
||||||
if (nbr) {
|
nbr = pim_neighbor_find_if(ifp1);
|
||||||
nh_node->gate.ipv4 =
|
if (!nbr)
|
||||||
nbr->source_addr;
|
continue;
|
||||||
|
|
||||||
|
nh_node->gate.ipv4 = nbr->source_addr;
|
||||||
if (PIM_DEBUG_TRACE) {
|
if (PIM_DEBUG_TRACE) {
|
||||||
char str[PREFIX_STRLEN];
|
char str[PREFIX_STRLEN];
|
||||||
char str1
|
char str1[INET_ADDRSTRLEN];
|
||||||
[INET_ADDRSTRLEN];
|
pim_inet4_dump("<nht_nbr?>", nbr->source_addr,
|
||||||
struct interface *ifp1 =
|
str1, sizeof(str1));
|
||||||
if_lookup_by_index(
|
pim_addr_dump("<nht_addr?>", &nht_p, str,
|
||||||
nh_node->ifindex,
|
|
||||||
pimg->vrf_id);
|
|
||||||
pim_inet4_dump(
|
|
||||||
"<nht_nbr?>",
|
|
||||||
nbr->source_addr,
|
|
||||||
str1,
|
|
||||||
sizeof(str1));
|
|
||||||
pim_addr_dump(
|
|
||||||
"<nht_addr?>",
|
|
||||||
&nht_p, str,
|
|
||||||
sizeof(str));
|
sizeof(str));
|
||||||
zlog_debug(
|
zlog_debug(
|
||||||
"%s: addr %s new nexthop addr %s interface %s",
|
"%s: addr %s new nexthop addr %s interface %s",
|
||||||
__PRETTY_FUNCTION__,
|
__PRETTY_FUNCTION__, str, str1,
|
||||||
str, str1,
|
|
||||||
ifp1->name);
|
ifp1->name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ void pim_rp_prefix_list_update(struct prefix_list *plist);
|
||||||
|
|
||||||
int pim_rp_config_write(struct vty *vty);
|
int pim_rp_config_write(struct vty *vty);
|
||||||
|
|
||||||
int pim_rp_setup(void);
|
void pim_rp_setup(void);
|
||||||
|
|
||||||
int pim_rp_i_am_rp(struct in_addr group);
|
int pim_rp_i_am_rp(struct in_addr group);
|
||||||
void pim_rp_check_on_if_add(struct pim_interface *pim_ifp);
|
void pim_rp_check_on_if_add(struct pim_interface *pim_ifp);
|
||||||
|
|
|
@ -194,7 +194,6 @@ enum pim_rpf_result pim_rpf_update(struct pim_upstream *up, struct pim_rpf *old,
|
||||||
struct pim_rpf saved;
|
struct pim_rpf saved;
|
||||||
struct prefix nht_p;
|
struct prefix nht_p;
|
||||||
struct pim_nexthop_cache pnc;
|
struct pim_nexthop_cache pnc;
|
||||||
int ret = 0;
|
|
||||||
struct prefix src, grp;
|
struct prefix src, grp;
|
||||||
|
|
||||||
saved.source_nexthop = rpf->source_nexthop;
|
saved.source_nexthop = rpf->source_nexthop;
|
||||||
|
@ -219,28 +218,23 @@ enum pim_rpf_result pim_rpf_update(struct pim_upstream *up, struct pim_rpf *old,
|
||||||
grp.prefixlen = IPV4_MAX_BITLEN;
|
grp.prefixlen = IPV4_MAX_BITLEN;
|
||||||
grp.u.prefix4 = up->sg.grp;
|
grp.u.prefix4 = up->sg.grp;
|
||||||
memset(&pnc, 0, sizeof(struct pim_nexthop_cache));
|
memset(&pnc, 0, sizeof(struct pim_nexthop_cache));
|
||||||
if ((ret = pim_find_or_track_nexthop(&nht_p, up, NULL, &pnc)) == 1) {
|
if (pim_find_or_track_nexthop(&nht_p, up, NULL, &pnc)) {
|
||||||
if (pnc.nexthop_num) {
|
if (pnc.nexthop_num) {
|
||||||
// Compute PIM RPF using Cached nexthop
|
if (!pim_ecmp_nexthop_search(
|
||||||
if (pim_ecmp_nexthop_search(
|
|
||||||
&pnc, &up->rpf.source_nexthop, &src, &grp,
|
&pnc, &up->rpf.source_nexthop, &src, &grp,
|
||||||
!PIM_UPSTREAM_FLAG_TEST_FHR(up->flags)
|
!PIM_UPSTREAM_FLAG_TEST_FHR(up->flags)
|
||||||
&& !PIM_UPSTREAM_FLAG_TEST_SRC_IGMP(
|
&& !PIM_UPSTREAM_FLAG_TEST_SRC_IGMP(
|
||||||
up->flags)))
|
up->flags)))
|
||||||
|
|
||||||
{
|
|
||||||
return PIM_RPF_FAILURE;
|
return PIM_RPF_FAILURE;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (pim_ecmp_nexthop_lookup(
|
if (!pim_ecmp_nexthop_lookup(
|
||||||
&rpf->source_nexthop, up->upstream_addr, &src, &grp,
|
&rpf->source_nexthop, up->upstream_addr, &src, &grp,
|
||||||
!PIM_UPSTREAM_FLAG_TEST_FHR(up->flags)
|
!PIM_UPSTREAM_FLAG_TEST_FHR(up->flags)
|
||||||
&& !PIM_UPSTREAM_FLAG_TEST_SRC_IGMP(
|
&& !PIM_UPSTREAM_FLAG_TEST_SRC_IGMP(
|
||||||
up->flags))) {
|
up->flags)))
|
||||||
return PIM_RPF_FAILURE;
|
return PIM_RPF_FAILURE;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
rpf->rpf_addr.family = AF_INET;
|
rpf->rpf_addr.family = AF_INET;
|
||||||
rpf->rpf_addr.u.prefix4 = pim_rpf_find_rpf_addr(up);
|
rpf->rpf_addr.u.prefix4 = pim_rpf_find_rpf_addr(up);
|
||||||
|
|
|
@ -849,7 +849,6 @@ void igmp_source_forward_start(struct igmp_source *source)
|
||||||
struct in_addr vif_source;
|
struct in_addr vif_source;
|
||||||
struct pim_interface *pim_oif;
|
struct pim_interface *pim_oif;
|
||||||
struct prefix nht_p, src, grp;
|
struct prefix nht_p, src, grp;
|
||||||
int ret = 0;
|
|
||||||
struct pim_nexthop_cache out_pnc;
|
struct pim_nexthop_cache out_pnc;
|
||||||
struct pim_nexthop nexthop;
|
struct pim_nexthop nexthop;
|
||||||
struct pim_upstream *up = NULL;
|
struct pim_upstream *up = NULL;
|
||||||
|
@ -871,17 +870,14 @@ void igmp_source_forward_start(struct igmp_source *source)
|
||||||
grp.prefixlen = IPV4_MAX_BITLEN;
|
grp.prefixlen = IPV4_MAX_BITLEN;
|
||||||
grp.u.prefix4 = sg.grp;
|
grp.u.prefix4 = sg.grp;
|
||||||
|
|
||||||
if ((ret = pim_find_or_track_nexthop(&nht_p, NULL, NULL,
|
if (pim_find_or_track_nexthop(&nht_p, NULL, NULL, &out_pnc)) {
|
||||||
&out_pnc))
|
|
||||||
== 1) {
|
|
||||||
if (out_pnc.nexthop_num) {
|
if (out_pnc.nexthop_num) {
|
||||||
up = pim_upstream_find(&sg);
|
up = pim_upstream_find(&sg);
|
||||||
memset(&nexthop, 0, sizeof(struct pim_nexthop));
|
memset(&nexthop, 0, sizeof(nexthop));
|
||||||
if (up)
|
if (up)
|
||||||
memcpy(&nexthop,
|
memcpy(&nexthop,
|
||||||
&up->rpf.source_nexthop,
|
&up->rpf.source_nexthop,
|
||||||
sizeof(struct pim_nexthop));
|
sizeof(struct pim_nexthop));
|
||||||
// Compute PIM RPF using Cached nexthop
|
|
||||||
pim_ecmp_nexthop_search(&out_pnc, &nexthop,
|
pim_ecmp_nexthop_search(&out_pnc, &nexthop,
|
||||||
&src, &grp, 0);
|
&src, &grp, 0);
|
||||||
if (nexthop.interface)
|
if (nexthop.interface)
|
||||||
|
@ -1096,7 +1092,6 @@ void pim_forward_start(struct pim_ifchannel *ch)
|
||||||
|| (up->channel_oil
|
|| (up->channel_oil
|
||||||
&& up->channel_oil->oil.mfcc_parent >= MAXVIFS)) {
|
&& up->channel_oil->oil.mfcc_parent >= MAXVIFS)) {
|
||||||
struct prefix nht_p, src, grp;
|
struct prefix nht_p, src, grp;
|
||||||
int ret = 0;
|
|
||||||
struct pim_nexthop_cache out_pnc;
|
struct pim_nexthop_cache out_pnc;
|
||||||
|
|
||||||
/* Register addr with Zebra NHT */
|
/* Register addr with Zebra NHT */
|
||||||
|
@ -1108,9 +1103,7 @@ void pim_forward_start(struct pim_ifchannel *ch)
|
||||||
grp.u.prefix4 = up->sg.grp;
|
grp.u.prefix4 = up->sg.grp;
|
||||||
memset(&out_pnc, 0, sizeof(struct pim_nexthop_cache));
|
memset(&out_pnc, 0, sizeof(struct pim_nexthop_cache));
|
||||||
|
|
||||||
if ((ret = pim_find_or_track_nexthop(&nht_p, NULL, NULL,
|
if (pim_find_or_track_nexthop(&nht_p, NULL, NULL, &out_pnc)) {
|
||||||
&out_pnc))
|
|
||||||
== 1) {
|
|
||||||
if (out_pnc.nexthop_num) {
|
if (out_pnc.nexthop_num) {
|
||||||
src.family = AF_INET;
|
src.family = AF_INET;
|
||||||
src.prefixlen = IPV4_MAX_BITLEN;
|
src.prefixlen = IPV4_MAX_BITLEN;
|
||||||
|
@ -1122,8 +1115,7 @@ void pim_forward_start(struct pim_ifchannel *ch)
|
||||||
// Compute PIM RPF using Cached nexthop
|
// Compute PIM RPF using Cached nexthop
|
||||||
if (pim_ecmp_nexthop_search(
|
if (pim_ecmp_nexthop_search(
|
||||||
&out_pnc, &up->rpf.source_nexthop,
|
&out_pnc, &up->rpf.source_nexthop,
|
||||||
&src, &grp, 0)
|
&src, &grp, 0))
|
||||||
== 0)
|
|
||||||
input_iface_vif_index =
|
input_iface_vif_index =
|
||||||
pim_if_find_vifindex_by_ifindex(
|
pim_if_find_vifindex_by_ifindex(
|
||||||
up->rpf.source_nexthop
|
up->rpf.source_nexthop
|
||||||
|
|
Loading…
Reference in a new issue