mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-04 16:57:43 +00:00
pimd: Convert pim_ifchannel_list to use up->ifchannels
We have a bunch of places where we iterate over the pim_ifchannel_list to find those ifchannels that match a certain upstream. Since we already know in the upstream the list of ifchannels associated with it, just look at those instead. Functions changed: forward_on forward_off pim_upstream_rpf_interface_changed pim_upstream_update_could_assert pim_upstream_update_my_assert_metric pim_upstream_update_assert_tracking_desired pim_upstream_is_sg_rpt Ticket: CM-15629 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
parent
2a28f7a0b9
commit
b5e6281b65
@ -441,18 +441,10 @@ static void forward_on(struct pim_upstream *up)
|
|||||||
{
|
{
|
||||||
struct listnode *chnode;
|
struct listnode *chnode;
|
||||||
struct listnode *chnextnode;
|
struct listnode *chnextnode;
|
||||||
struct pim_interface *pim_ifp;
|
struct pim_ifchannel *ch = NULL;
|
||||||
struct pim_ifchannel *ch;
|
|
||||||
|
|
||||||
/* scan (S,G) state */
|
/* scan (S,G) state */
|
||||||
for (ALL_LIST_ELEMENTS(pim_ifchannel_list, chnode, chnextnode, ch)) {
|
for (ALL_LIST_ELEMENTS(up->ifchannels, chnode, chnextnode, ch)) {
|
||||||
pim_ifp = ch->interface->info;
|
|
||||||
if (!pim_ifp)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (ch->upstream != up)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (pim_macro_chisin_oiflist(ch))
|
if (pim_macro_chisin_oiflist(ch))
|
||||||
pim_forward_start(ch);
|
pim_forward_start(ch);
|
||||||
|
|
||||||
@ -463,17 +455,10 @@ static void forward_off(struct pim_upstream *up)
|
|||||||
{
|
{
|
||||||
struct listnode *chnode;
|
struct listnode *chnode;
|
||||||
struct listnode *chnextnode;
|
struct listnode *chnextnode;
|
||||||
struct pim_interface *pim_ifp;
|
|
||||||
struct pim_ifchannel *ch;
|
struct pim_ifchannel *ch;
|
||||||
|
|
||||||
/* scan per-interface (S,G) state */
|
/* scan per-interface (S,G) state */
|
||||||
for (ALL_LIST_ELEMENTS(pim_ifchannel_list, chnode, chnextnode, ch)) {
|
for (ALL_LIST_ELEMENTS(up->ifchannels, chnode, chnextnode, ch)) {
|
||||||
pim_ifp = ch->interface->info;
|
|
||||||
if (!pim_ifp)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (ch->upstream != up)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
pim_forward_stop(ch);
|
pim_forward_stop(ch);
|
||||||
|
|
||||||
@ -965,18 +950,9 @@ void pim_upstream_rpf_interface_changed(struct pim_upstream *up,
|
|||||||
struct listnode *chnode;
|
struct listnode *chnode;
|
||||||
struct listnode *chnextnode;
|
struct listnode *chnextnode;
|
||||||
struct pim_ifchannel *ch;
|
struct pim_ifchannel *ch;
|
||||||
struct pim_interface *pim_ifp;
|
|
||||||
|
|
||||||
/* search all ifchannels */
|
/* search all ifchannels */
|
||||||
for (ALL_LIST_ELEMENTS(pim_ifchannel_list, chnode, chnextnode, ch)) {
|
for (ALL_LIST_ELEMENTS(up->ifchannels, chnode, chnextnode, ch)) {
|
||||||
|
|
||||||
pim_ifp = ch->interface->info;
|
|
||||||
if (!pim_ifp)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (ch->upstream != up)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (ch->ifassert_state == PIM_IFASSERT_I_AM_LOSER) {
|
if (ch->ifassert_state == PIM_IFASSERT_I_AM_LOSER) {
|
||||||
if (
|
if (
|
||||||
/* RPF_interface(S) was NOT I */
|
/* RPF_interface(S) was NOT I */
|
||||||
@ -997,18 +973,10 @@ void pim_upstream_update_could_assert(struct pim_upstream *up)
|
|||||||
{
|
{
|
||||||
struct listnode *chnode;
|
struct listnode *chnode;
|
||||||
struct listnode *chnextnode;
|
struct listnode *chnextnode;
|
||||||
struct pim_interface *pim_ifp;
|
|
||||||
struct pim_ifchannel *ch;
|
struct pim_ifchannel *ch;
|
||||||
|
|
||||||
/* scan per-interface (S,G) state */
|
/* scan per-interface (S,G) state */
|
||||||
for (ALL_LIST_ELEMENTS(pim_ifchannel_list, chnode, chnextnode, ch)) {
|
for (ALL_LIST_ELEMENTS(up->ifchannels, chnode, chnextnode, ch)) {
|
||||||
pim_ifp = ch->interface->info;
|
|
||||||
if (!pim_ifp)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (ch->upstream != up)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
pim_ifchannel_update_could_assert(ch);
|
pim_ifchannel_update_could_assert(ch);
|
||||||
} /* scan iface channel list */
|
} /* scan iface channel list */
|
||||||
}
|
}
|
||||||
@ -1017,18 +985,10 @@ void pim_upstream_update_my_assert_metric(struct pim_upstream *up)
|
|||||||
{
|
{
|
||||||
struct listnode *chnode;
|
struct listnode *chnode;
|
||||||
struct listnode *chnextnode;
|
struct listnode *chnextnode;
|
||||||
struct pim_interface *pim_ifp;
|
|
||||||
struct pim_ifchannel *ch;
|
struct pim_ifchannel *ch;
|
||||||
|
|
||||||
/* scan per-interface (S,G) state */
|
/* scan per-interface (S,G) state */
|
||||||
for (ALL_LIST_ELEMENTS(pim_ifchannel_list, chnode, chnextnode, ch)) {
|
for (ALL_LIST_ELEMENTS(up->ifchannels, chnode, chnextnode, ch)) {
|
||||||
pim_ifp = ch->interface->info;
|
|
||||||
if (!pim_ifp)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (ch->upstream != up)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
pim_ifchannel_update_my_assert_metric(ch);
|
pim_ifchannel_update_my_assert_metric(ch);
|
||||||
|
|
||||||
} /* scan iface channel list */
|
} /* scan iface channel list */
|
||||||
@ -1042,14 +1002,11 @@ static void pim_upstream_update_assert_tracking_desired(struct pim_upstream *up)
|
|||||||
struct pim_ifchannel *ch;
|
struct pim_ifchannel *ch;
|
||||||
|
|
||||||
/* scan per-interface (S,G) state */
|
/* scan per-interface (S,G) state */
|
||||||
for (ALL_LIST_ELEMENTS(pim_ifchannel_list, chnode, chnextnode, ch)) {
|
for (ALL_LIST_ELEMENTS(up->ifchannels, chnode, chnextnode, ch)) {
|
||||||
pim_ifp = ch->interface->info;
|
pim_ifp = ch->interface->info;
|
||||||
if (!pim_ifp)
|
if (!pim_ifp)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (ch->upstream != up)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
pim_ifchannel_update_assert_tracking_desired(ch);
|
pim_ifchannel_update_assert_tracking_desired(ch);
|
||||||
|
|
||||||
} /* scan iface channel list */
|
} /* scan iface channel list */
|
||||||
@ -1219,11 +1176,10 @@ pim_upstream_is_sg_rpt (struct pim_upstream *up)
|
|||||||
struct listnode *chnode;
|
struct listnode *chnode;
|
||||||
struct pim_ifchannel *ch;
|
struct pim_ifchannel *ch;
|
||||||
|
|
||||||
for (ALL_LIST_ELEMENTS_RO(pim_ifchannel_list, chnode, ch))
|
for (ALL_LIST_ELEMENTS_RO(up->ifchannels, chnode, ch))
|
||||||
{
|
{
|
||||||
if ((ch->upstream == up) &&
|
if (PIM_IF_FLAG_TEST_S_G_RPT(ch->flags))
|
||||||
(PIM_IF_FLAG_TEST_S_G_RPT(ch->flags)))
|
return 1;
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user