diff options
| author | Donald Sharp <sharpd@cumulusnetworks.com> | 2016-07-17 19:51:56 -0400 |
|---|---|---|
| committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2016-12-21 20:26:02 -0500 |
| commit | 887fa0149fbba33c702c949b9e0072faa53c98fb (patch) | |
| tree | 4ddf19a52cc624ce0e4019e5a517c10820fbe226 | |
| parent | d7259eac8b7c5f9f7d0f5f04adf1b2c98dd50fa9 (diff) | |
pimd: Add pim_channel_del_oif
For a given interface remove the interface from the list
of outgoing interfaces for a mroute and reinstall it
into the kernel.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
| -rw-r--r-- | pimd/pim_oil.c | 86 | ||||
| -rw-r--r-- | pimd/pim_oil.h | 3 |
2 files changed, 89 insertions, 0 deletions
diff --git a/pimd/pim_oil.c b/pimd/pim_oil.c index 96f9ef2b62..d072c73dd8 100644 --- a/pimd/pim_oil.c +++ b/pimd/pim_oil.c @@ -142,6 +142,92 @@ void pim_channel_oil_del(struct channel_oil *c_oil) } } +int +pim_channel_del_oif (struct channel_oil *channel_oil, + struct interface *oif, + uint32_t proto_mask) +{ + struct pim_interface *pim_ifp; + + zassert (channel_oil); + zassert (oif); + + pim_ifp = oif->info; + + if (PIM_DEBUG_MROUTE) + { + char group_str[100]; + char source_str[100]; + pim_inet4_dump("<group?>", channel_oil->oil.mfcc_mcastgrp, group_str, sizeof(group_str)); + pim_inet4_dump("<source?>", channel_oil->oil.mfcc_origin, source_str, sizeof(source_str)); + zlog_debug("%s %s: (S,G)=(%s,%s): proto_mask=%u OIF=%s vif_index=%d", + __FILE__, __PRETTY_FUNCTION__, + source_str, group_str, + proto_mask, oif->name, pim_ifp->mroute_vif_index); + } + + /* + * Don't do anything if we've been asked to remove a source + * that is not actually on it. + */ + if (!(channel_oil->oif_flags[pim_ifp->mroute_vif_index] & proto_mask)) + { + if (PIM_DEBUG_MROUTE) + { + char group_str[100]; + char source_str[100]; + pim_inet4_dump("<group?>", channel_oil->oil.mfcc_mcastgrp, group_str, sizeof(group_str)); + pim_inet4_dump("<source?>", channel_oil->oil.mfcc_origin, source_str, sizeof(source_str)); + zlog_debug("%s %s: no existing protocol mask %u(%u) for requested OIF %s (vif_index=%d, min_ttl=%d) for channel (S,G)=(%s,%s)", + __FILE__, __PRETTY_FUNCTION__, + proto_mask, channel_oil->oif_flags[pim_ifp->mroute_vif_index], + oif->name, pim_ifp->mroute_vif_index, + channel_oil->oil.mfcc_ttls[pim_ifp->mroute_vif_index], + source_str, group_str); + } + return 0; + } + + channel_oil->oif_flags[pim_ifp->mroute_vif_index] &= ~proto_mask; + + if (channel_oil->oif_flags[pim_ifp->mroute_vif_index]) + { + if (PIM_DEBUG_MROUTE) + { + char group_str[100]; + char source_str[100]; + pim_inet4_dump("<group?>", channel_oil->oil.mfcc_mcastgrp, group_str, sizeof(group_str)); + pim_inet4_dump("<source?>", channel_oil->oil.mfcc_origin, source_str, sizeof(source_str)); + zlog_debug("%s %s: other protocol masks remain for requested OIF %s (vif_index=%d, min_ttl=%d) for channel (S,G)=(%s,%s)", + __FILE__, __PRETTY_FUNCTION__, + oif->name, pim_ifp->mroute_vif_index, + channel_oil->oil.mfcc_ttls[pim_ifp->mroute_vif_index], + source_str, group_str); + } + return 0; + } + + channel_oil->oil.mfcc_ttls[pim_ifp->mroute_vif_index] = 0; + + if (pim_mroute_add (channel_oil)) { + if (PIM_DEBUG_MROUTE) + { + char group_str[100]; + char source_str[100]; + pim_inet4_dump("<group?>", channel_oil->oil.mfcc_mcastgrp, group_str, sizeof(group_str)); + pim_inet4_dump("<source?>", channel_oil->oil.mfcc_origin, source_str, sizeof(source_str)); + zlog_debug("%s %s: could not remove output interface %s (vif_index=%d) for channel (S,G)=(%s,%s)", + __FILE__, __PRETTY_FUNCTION__, + oif->name, pim_ifp->mroute_vif_index, + source_str, group_str); + } + return -1; + } + + return 0; +} + + int pim_channel_add_oif(struct channel_oil *channel_oil, struct interface *oif, uint32_t proto_mask) diff --git a/pimd/pim_oil.h b/pimd/pim_oil.h index c63c026c0f..0edb50787e 100644 --- a/pimd/pim_oil.h +++ b/pimd/pim_oil.h @@ -87,5 +87,8 @@ void pim_channel_oil_del(struct channel_oil *c_oil); int pim_channel_add_oif(struct channel_oil *c_oil, struct interface *oif, uint32_t proto_mask); +int pim_channel_del_oif (struct channel_oil *c_oil, + struct interface *oif, + uint32_t proto_mask); #endif /* PIM_OIL_H */ |
