diff options
author | Chirag Shah <chirag@cumulusnetworks.com> | 2017-02-22 16:28:36 +0100 |
---|---|---|
committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-03-16 23:53:28 +0100 |
commit | 1bc9827622572b24c7c47656565dc1a2601d6dc5 (patch) | |
tree | eda923517f772ca214aa507de5fc313bff1a24dd /pimd/pim_rp.c | |
parent | Merge pull request #270 from donaldsharp/cares (diff) | |
download | frr-1bc9827622572b24c7c47656565dc1a2601d6dc5.tar.xz frr-1bc9827622572b24c7c47656565dc1a2601d6dc5.zip |
pimd: Nexthop tracking support
Add pim Nexthop tracking feature 1st part where, specific RP or Source address (unicast address)
register with Zebra. Once nexthop update received from Zebra for a given address, scan RP or upstream
entries impacted by the change in nexthop.
Reviewed By: CCR-5761, Donald Sharp <sharpd@cumulusnetworks.com>
Testing Done: Tested with multiple RPs and multiple *,G entries at LHR.
Add new Nexthop or remove one of the link towards RP and verify RP and upstream nexthop update.
similar test done at RP with multiple S,G entries to reach source.
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
Diffstat (limited to 'pimd/pim_rp.c')
-rw-r--r-- | pimd/pim_rp.c | 53 |
1 files changed, 43 insertions, 10 deletions
diff --git a/pimd/pim_rp.c b/pimd/pim_rp.c index dc19002a4..de30116ed 100644 --- a/pimd/pim_rp.c +++ b/pimd/pim_rp.c @@ -42,14 +42,8 @@ #include "pim_memory.h" #include "pim_iface.h" #include "pim_msdp.h" +#include "pim_nht.h" -struct rp_info -{ - struct prefix group; - struct pim_rpf rp; - int i_am_rp; - char *plist; -}; static struct list *qpim_rp_list = NULL; static struct rp_info *tail = NULL; @@ -305,6 +299,7 @@ pim_rp_new (const char *rp, const char *group_range, const char *plist) struct listnode *node, *nnode; struct rp_info *tmp_rp_info; char buffer[BUFSIZ]; + struct prefix nht_p; rp_info = XCALLOC (MTYPE_PIM_RP, sizeof (*rp_info)); if (!rp_info) @@ -401,6 +396,19 @@ pim_rp_new (const char *rp, const char *group_range, const char *plist) rp_all->rp.rpf_addr = rp_info->rp.rpf_addr; XFREE (MTYPE_PIM_RP, rp_info); + /* Register addr with Zebra NHT */ + nht_p.family = AF_INET; + nht_p.prefixlen = IPV4_MAX_BITLEN; + nht_p.u.prefix4 = rp_all->rp.rpf_addr.u.prefix4; + if (PIM_DEBUG_PIM_TRACE) + { + char buf[PREFIX2STR_BUFFER]; + prefix2str (&nht_p, buf, sizeof (buf)); + zlog_debug ("%s: NHT Register rp_all addr %s with NHT ", + __PRETTY_FUNCTION__, buf); + } + pim_find_or_track_nexthop (&nht_p, NULL, rp_all); + if (pim_nexthop_lookup (&rp_all->rp.source_nexthop, rp_all->rp.rpf_addr.u.prefix4, 1) != 0) return PIM_RP_NO_PATH; @@ -448,11 +456,23 @@ pim_rp_new (const char *rp, const char *group_range, const char *plist) listnode_add_sort (qpim_rp_list, rp_info); + /* Register addr with Zebra NHT */ + nht_p.family = AF_INET; + nht_p.prefixlen = IPV4_MAX_BITLEN; + nht_p.u.prefix4 = rp_info->rp.rpf_addr.u.prefix4; + if (PIM_DEBUG_PIM_TRACE) + { + char buf[PREFIX2STR_BUFFER]; + prefix2str (&nht_p, buf, sizeof (buf)); + zlog_debug ("%s: NHT Register RP addr %s with Zebra ", __PRETTY_FUNCTION__, buf); + } + pim_find_or_track_nexthop (&nht_p, NULL, rp_info); + if (pim_nexthop_lookup (&rp_info->rp.source_nexthop, rp_info->rp.rpf_addr.u.prefix4, 1) != 0) return PIM_RP_NO_PATH; pim_rp_check_interfaces (rp_info); - pim_rp_refresh_group_to_rp_mapping(); + pim_rp_refresh_group_to_rp_mapping (); return PIM_SUCCESS; } @@ -465,6 +485,7 @@ pim_rp_del (const char *rp, const char *group_range, const char *plist) struct rp_info *rp_info; struct rp_info *rp_all; int result; + struct prefix nht_p; if (group_range == NULL) result = str2prefix ("224.0.0.0/4", &group); @@ -492,6 +513,18 @@ pim_rp_del (const char *rp, const char *group_range, const char *plist) rp_info->plist = NULL; } + /* Deregister addr with Zebra NHT */ + nht_p.family = AF_INET; + nht_p.prefixlen = IPV4_MAX_BITLEN; + nht_p.u.prefix4 = rp_info->rp.rpf_addr.u.prefix4; + if (PIM_DEBUG_PIM_TRACE) + { + char buf[PREFIX2STR_BUFFER]; + prefix2str (&nht_p, buf, sizeof (buf)); + zlog_debug ("%s: Deregister RP addr %s with NHT ", __PRETTY_FUNCTION__, buf); + } + pim_delete_tracked_nexthop (&nht_p, NULL, rp_info); + str2prefix ("224.0.0.0/4", &g_all); rp_all = pim_rp_find_match_group (&g_all); @@ -504,7 +537,7 @@ pim_rp_del (const char *rp, const char *group_range, const char *plist) } listnode_delete (qpim_rp_list, rp_info); - pim_rp_refresh_group_to_rp_mapping(); + pim_rp_refresh_group_to_rp_mapping (); return PIM_SUCCESS; } @@ -754,7 +787,7 @@ pim_rp_check_is_my_ip_address (struct in_addr group, struct in_addr dest_addr) if (if_lookup_exact_address (&dest_addr, AF_INET)) return 1; - + return 0; } |