pimd: Write pim_upstream_empty_inherited_olist

A empty inherited_olist implies that we have
no outgoing interfaces.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
Donald Sharp 2016-11-10 09:41:28 -05:00
parent b72f79a92b
commit ce0ddb4e79
3 changed files with 23 additions and 2 deletions

View File

@ -432,3 +432,24 @@ int pim_channel_add_oif(struct channel_oil *channel_oil,
return 0;
}
int
pim_channel_oil_empty (struct channel_oil *c_oil)
{
static uint32_t zero[MAXVIFS];
static int inited = 0;
if (!c_oil)
return 1;
/*
* Not sure that this is necessary, but I would rather ensure
* that this works.
*/
if (!inited)
{
memset(&zero, 0, sizeof(uint32_t) * MAXVIFS);
inited = 1;
}
return !memcmp(c_oil->oif_flags, zero, MAXVIFS * sizeof(uint32_t));
}

View File

@ -95,4 +95,5 @@ int pim_channel_del_oif (struct channel_oil *c_oil,
struct interface *oif,
uint32_t proto_mask);
int pim_channel_oil_empty (struct channel_oil *c_oil);
#endif /* PIM_OIL_H */

View File

@ -1242,8 +1242,7 @@ pim_upstream_inherited_olist (struct pim_upstream *up)
int
pim_upstream_empty_inherited_olist (struct pim_upstream *up)
{
// FIXME: Currently this is not implemented
return 0;
return pim_channel_oil_empty (up->channel_oil);
}
/*