mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-12 22:12:50 +00:00
pimd: Make XX_forward_start 'struct pim_instance *' aware
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
parent
611925dc02
commit
6f932b0c91
@ -220,7 +220,7 @@ static void igmp_source_timer_on(struct igmp_group *group,
|
|||||||
|
|
||||||
Source timer switched from (T == 0) to (T > 0): enable forwarding.
|
Source timer switched from (T == 0) to (T > 0): enable forwarding.
|
||||||
*/
|
*/
|
||||||
igmp_source_forward_start(source);
|
igmp_source_forward_start(pimg, source);
|
||||||
}
|
}
|
||||||
|
|
||||||
void igmp_source_reset_gmi(struct igmp_sock *igmp, struct igmp_group *group,
|
void igmp_source_reset_gmi(struct igmp_sock *igmp, struct igmp_group *group,
|
||||||
@ -313,7 +313,7 @@ static void group_exclude_fwd_anysrc_ifempty(struct igmp_group *group)
|
|||||||
zassert(group->group_filtermode_isexcl);
|
zassert(group->group_filtermode_isexcl);
|
||||||
|
|
||||||
if (listcount(group->group_source_list) < 1) {
|
if (listcount(group->group_source_list) < 1) {
|
||||||
igmp_anysource_forward_start(group);
|
igmp_anysource_forward_start(pimg, group);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
103
pimd/pim_zebra.c
103
pimd/pim_zebra.c
@ -758,7 +758,8 @@ void pim_zebra_init(void)
|
|||||||
zclient_lookup_new();
|
zclient_lookup_new();
|
||||||
}
|
}
|
||||||
|
|
||||||
void igmp_anysource_forward_start(struct igmp_group *group)
|
void igmp_anysource_forward_start(struct pim_instance *pim,
|
||||||
|
struct igmp_group *group)
|
||||||
{
|
{
|
||||||
struct igmp_source *source;
|
struct igmp_source *source;
|
||||||
struct in_addr src_addr = {.s_addr = 0};
|
struct in_addr src_addr = {.s_addr = 0};
|
||||||
@ -773,7 +774,7 @@ void igmp_anysource_forward_start(struct igmp_group *group)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
igmp_source_forward_start(source);
|
igmp_source_forward_start(pim, source);
|
||||||
}
|
}
|
||||||
|
|
||||||
void igmp_anysource_forward_stop(struct igmp_group *group)
|
void igmp_anysource_forward_stop(struct igmp_group *group)
|
||||||
@ -830,39 +831,51 @@ void igmp_source_forward_reevaluate_all(void)
|
|||||||
{
|
{
|
||||||
struct listnode *ifnode;
|
struct listnode *ifnode;
|
||||||
struct interface *ifp;
|
struct interface *ifp;
|
||||||
|
struct vrf *vrf;
|
||||||
|
struct pim_instance *pim;
|
||||||
|
|
||||||
for (ALL_LIST_ELEMENTS_RO(vrf_iflist(pimg->vrf_id), ifnode, ifp)) {
|
RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
|
||||||
struct pim_interface *pim_ifp = ifp->info;
|
{
|
||||||
struct listnode *sock_node;
|
pim = vrf->info;
|
||||||
struct igmp_sock *igmp;
|
if (!pim)
|
||||||
|
|
||||||
if (!pim_ifp)
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* scan igmp sockets */
|
for (ALL_LIST_ELEMENTS_RO(vrf_iflist(pim->vrf_id), ifnode,
|
||||||
for (ALL_LIST_ELEMENTS_RO(pim_ifp->igmp_socket_list, sock_node,
|
ifp)) {
|
||||||
igmp)) {
|
struct pim_interface *pim_ifp = ifp->info;
|
||||||
struct listnode *grpnode;
|
struct listnode *sock_node;
|
||||||
struct igmp_group *grp;
|
struct igmp_sock *igmp;
|
||||||
|
|
||||||
/* scan igmp groups */
|
if (!pim_ifp)
|
||||||
for (ALL_LIST_ELEMENTS_RO(igmp->igmp_group_list,
|
continue;
|
||||||
grpnode, grp)) {
|
|
||||||
struct listnode *srcnode;
|
|
||||||
struct igmp_source *src;
|
|
||||||
|
|
||||||
/* scan group sources */
|
/* scan igmp sockets */
|
||||||
for (ALL_LIST_ELEMENTS_RO(
|
for (ALL_LIST_ELEMENTS_RO(pim_ifp->igmp_socket_list,
|
||||||
grp->group_source_list, srcnode,
|
sock_node, igmp)) {
|
||||||
src)) {
|
struct listnode *grpnode;
|
||||||
igmp_source_forward_reevaluate_one(src);
|
struct igmp_group *grp;
|
||||||
} /* scan group sources */
|
|
||||||
} /* scan igmp groups */
|
/* scan igmp groups */
|
||||||
} /* scan igmp sockets */
|
for (ALL_LIST_ELEMENTS_RO(igmp->igmp_group_list,
|
||||||
} /* scan interfaces */
|
grpnode, grp)) {
|
||||||
|
struct listnode *srcnode;
|
||||||
|
struct igmp_source *src;
|
||||||
|
|
||||||
|
/* scan group sources */
|
||||||
|
for (ALL_LIST_ELEMENTS_RO(
|
||||||
|
grp->group_source_list,
|
||||||
|
srcnode, src)) {
|
||||||
|
igmp_source_forward_reevaluate_one(
|
||||||
|
src);
|
||||||
|
} /* scan group sources */
|
||||||
|
} /* scan igmp groups */
|
||||||
|
} /* scan igmp sockets */
|
||||||
|
} /* scan interfaces */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void igmp_source_forward_start(struct igmp_source *source)
|
void igmp_source_forward_start(struct pim_instance *pim,
|
||||||
|
struct igmp_source *source)
|
||||||
{
|
{
|
||||||
struct igmp_group *group;
|
struct igmp_group *group;
|
||||||
struct prefix_sg sg;
|
struct prefix_sg sg;
|
||||||
@ -898,7 +911,7 @@ void igmp_source_forward_start(struct igmp_source *source)
|
|||||||
struct pim_nexthop nexthop;
|
struct pim_nexthop nexthop;
|
||||||
struct pim_upstream *up = NULL;
|
struct pim_upstream *up = NULL;
|
||||||
|
|
||||||
if (!pim_rp_set_upstream_addr(pimg, &vif_source,
|
if (!pim_rp_set_upstream_addr(pim, &vif_source,
|
||||||
source->source_addr, sg.grp))
|
source->source_addr, sg.grp))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -915,22 +928,21 @@ 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 (pim_find_or_track_nexthop(pimg, &nht_p, NULL, NULL,
|
if (pim_find_or_track_nexthop(pim, &nht_p, NULL, NULL,
|
||||||
&out_pnc)) {
|
&out_pnc)) {
|
||||||
if (out_pnc.nexthop_num) {
|
if (out_pnc.nexthop_num) {
|
||||||
up = pim_upstream_find(pimg, &sg);
|
up = pim_upstream_find(pim, &sg);
|
||||||
memset(&nexthop, 0, sizeof(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));
|
||||||
pim_ecmp_nexthop_search(pimg, &out_pnc,
|
pim_ecmp_nexthop_search(pim, &out_pnc, &nexthop,
|
||||||
&nexthop, &src, &grp,
|
&src, &grp, 0);
|
||||||
0);
|
|
||||||
if (nexthop.interface)
|
if (nexthop.interface)
|
||||||
input_iface_vif_index =
|
input_iface_vif_index =
|
||||||
pim_if_find_vifindex_by_ifindex(
|
pim_if_find_vifindex_by_ifindex(
|
||||||
pimg,
|
pim,
|
||||||
nexthop.interface->ifindex);
|
nexthop.interface->ifindex);
|
||||||
} else {
|
} else {
|
||||||
if (PIM_DEBUG_ZEBRA) {
|
if (PIM_DEBUG_ZEBRA) {
|
||||||
@ -951,7 +963,7 @@ void igmp_source_forward_start(struct igmp_source *source)
|
|||||||
} else
|
} else
|
||||||
input_iface_vif_index =
|
input_iface_vif_index =
|
||||||
pim_ecmp_fib_lookup_if_vif_index(
|
pim_ecmp_fib_lookup_if_vif_index(
|
||||||
pimg, vif_source, &src, &grp);
|
pim, vif_source, &src, &grp);
|
||||||
|
|
||||||
if (PIM_DEBUG_ZEBRA) {
|
if (PIM_DEBUG_ZEBRA) {
|
||||||
char buf2[INET_ADDRSTRLEN];
|
char buf2[INET_ADDRSTRLEN];
|
||||||
@ -1010,7 +1022,7 @@ void igmp_source_forward_start(struct igmp_source *source)
|
|||||||
}
|
}
|
||||||
|
|
||||||
source->source_channel_oil =
|
source->source_channel_oil =
|
||||||
pim_channel_oil_add(pimg, &sg, input_iface_vif_index);
|
pim_channel_oil_add(pim, &sg, input_iface_vif_index);
|
||||||
if (!source->source_channel_oil) {
|
if (!source->source_channel_oil) {
|
||||||
if (PIM_DEBUG_IGMP_TRACE) {
|
if (PIM_DEBUG_IGMP_TRACE) {
|
||||||
zlog_debug(
|
zlog_debug(
|
||||||
@ -1116,6 +1128,11 @@ void pim_forward_start(struct pim_ifchannel *ch)
|
|||||||
struct pim_upstream *up = ch->upstream;
|
struct pim_upstream *up = ch->upstream;
|
||||||
uint32_t mask = PIM_OIF_FLAG_PROTO_PIM;
|
uint32_t mask = PIM_OIF_FLAG_PROTO_PIM;
|
||||||
int input_iface_vif_index = 0;
|
int input_iface_vif_index = 0;
|
||||||
|
struct pim_instance *pim;
|
||||||
|
struct pim_interface *pim_ifp;
|
||||||
|
|
||||||
|
pim_ifp = ch->interface->info;
|
||||||
|
pim = pim_ifp->pim;
|
||||||
|
|
||||||
if (PIM_DEBUG_PIM_TRACE) {
|
if (PIM_DEBUG_PIM_TRACE) {
|
||||||
char source_str[INET_ADDRSTRLEN];
|
char source_str[INET_ADDRSTRLEN];
|
||||||
@ -1151,7 +1168,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 (pim_find_or_track_nexthop(pimg, &nht_p, NULL, NULL,
|
if (pim_find_or_track_nexthop(pim, &nht_p, NULL, NULL,
|
||||||
&out_pnc)) {
|
&out_pnc)) {
|
||||||
if (out_pnc.nexthop_num) {
|
if (out_pnc.nexthop_num) {
|
||||||
src.family = AF_INET;
|
src.family = AF_INET;
|
||||||
@ -1163,12 +1180,12 @@ void pim_forward_start(struct pim_ifchannel *ch)
|
|||||||
grp.u.prefix4 = up->sg.grp;
|
grp.u.prefix4 = up->sg.grp;
|
||||||
// Compute PIM RPF using Cached nexthop
|
// Compute PIM RPF using Cached nexthop
|
||||||
if (pim_ecmp_nexthop_search(
|
if (pim_ecmp_nexthop_search(
|
||||||
pimg, &out_pnc,
|
pim, &out_pnc,
|
||||||
&up->rpf.source_nexthop, &src, &grp,
|
&up->rpf.source_nexthop, &src, &grp,
|
||||||
0))
|
0))
|
||||||
input_iface_vif_index =
|
input_iface_vif_index =
|
||||||
pim_if_find_vifindex_by_ifindex(
|
pim_if_find_vifindex_by_ifindex(
|
||||||
pimg,
|
pim,
|
||||||
up->rpf.source_nexthop
|
up->rpf.source_nexthop
|
||||||
.interface->ifindex);
|
.interface->ifindex);
|
||||||
else {
|
else {
|
||||||
@ -1197,7 +1214,7 @@ void pim_forward_start(struct pim_ifchannel *ch)
|
|||||||
} else
|
} else
|
||||||
input_iface_vif_index =
|
input_iface_vif_index =
|
||||||
pim_ecmp_fib_lookup_if_vif_index(
|
pim_ecmp_fib_lookup_if_vif_index(
|
||||||
pimg, up->upstream_addr, &src, &grp);
|
pim, up->upstream_addr, &src, &grp);
|
||||||
|
|
||||||
if (input_iface_vif_index < 1) {
|
if (input_iface_vif_index < 1) {
|
||||||
if (PIM_DEBUG_PIM_TRACE) {
|
if (PIM_DEBUG_PIM_TRACE) {
|
||||||
@ -1213,14 +1230,14 @@ void pim_forward_start(struct pim_ifchannel *ch)
|
|||||||
}
|
}
|
||||||
if (PIM_DEBUG_TRACE) {
|
if (PIM_DEBUG_TRACE) {
|
||||||
struct interface *in_intf = pim_if_find_by_vif_index(
|
struct interface *in_intf = pim_if_find_by_vif_index(
|
||||||
pimg, input_iface_vif_index);
|
pim, input_iface_vif_index);
|
||||||
zlog_debug(
|
zlog_debug(
|
||||||
"%s: Update channel_oil IIF %s VIFI %d entry %s ",
|
"%s: Update channel_oil IIF %s VIFI %d entry %s ",
|
||||||
__PRETTY_FUNCTION__,
|
__PRETTY_FUNCTION__,
|
||||||
in_intf ? in_intf->name : "NIL",
|
in_intf ? in_intf->name : "NIL",
|
||||||
input_iface_vif_index, up->sg_str);
|
input_iface_vif_index, up->sg_str);
|
||||||
}
|
}
|
||||||
up->channel_oil = pim_channel_oil_add(pimg, &up->sg,
|
up->channel_oil = pim_channel_oil_add(pim, &up->sg,
|
||||||
input_iface_vif_index);
|
input_iface_vif_index);
|
||||||
if (!up->channel_oil) {
|
if (!up->channel_oil) {
|
||||||
if (PIM_DEBUG_PIM_TRACE)
|
if (PIM_DEBUG_PIM_TRACE)
|
||||||
|
@ -32,10 +32,12 @@ void pim_zebra_zclient_update(struct vty *vty);
|
|||||||
void pim_scan_individual_oil(struct channel_oil *c_oil, int in_vif_index);
|
void pim_scan_individual_oil(struct channel_oil *c_oil, int in_vif_index);
|
||||||
void pim_scan_oil(void);
|
void pim_scan_oil(void);
|
||||||
|
|
||||||
void igmp_anysource_forward_start(struct igmp_group *group);
|
void igmp_anysource_forward_start(struct pim_instance *pim,
|
||||||
|
struct igmp_group *group);
|
||||||
void igmp_anysource_forward_stop(struct igmp_group *group);
|
void igmp_anysource_forward_stop(struct igmp_group *group);
|
||||||
|
|
||||||
void igmp_source_forward_start(struct igmp_source *source);
|
void igmp_source_forward_start(struct pim_instance *pim,
|
||||||
|
struct igmp_source *source);
|
||||||
void igmp_source_forward_stop(struct igmp_source *source);
|
void igmp_source_forward_stop(struct igmp_source *source);
|
||||||
void igmp_source_forward_reevaluate_all(void);
|
void igmp_source_forward_reevaluate_all(void);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user