From: Donald Sharp Date: Thu, 10 Nov 2016 14:41:28 +0000 (-0500) Subject: pimd: Write pim_upstream_empty_inherited_olist X-Git-Tag: frr-3.0-branchpoint~64^2~10^2~110 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=ce0ddb4e79d28addd02a7156ef97cd45eaaa1fc1;p=mirror%2Ffrr.git pimd: Write pim_upstream_empty_inherited_olist A empty inherited_olist implies that we have no outgoing interfaces. Signed-off-by: Donald Sharp --- diff --git a/pimd/pim_oil.c b/pimd/pim_oil.c index 9416503204..acebd6ace6 100644 --- a/pimd/pim_oil.c +++ b/pimd/pim_oil.c @@ -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)); +} diff --git a/pimd/pim_oil.h b/pimd/pim_oil.h index 0c99afb625..939ef4b3fc 100644 --- a/pimd/pim_oil.h +++ b/pimd/pim_oil.h @@ -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 */ diff --git a/pimd/pim_upstream.c b/pimd/pim_upstream.c index b3b6fdce21..fe6e81ef63 100644 --- a/pimd/pim_upstream.c +++ b/pimd/pim_upstream.c @@ -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); } /*