diff options
-rw-r--r-- | pimd/pim_bsm.c | 6 | ||||
-rw-r--r-- | pimd/pim_rp.c | 31 |
2 files changed, 32 insertions, 5 deletions
diff --git a/pimd/pim_bsm.c b/pimd/pim_bsm.c index 4689b2703..238c19d2c 100644 --- a/pimd/pim_bsm.c +++ b/pimd/pim_bsm.c @@ -35,6 +35,7 @@ #include "pim_nht.h" #include "pim_bsm.h" #include "pim_time.h" +#include "pim_zebra.h" /* Functions forward declaration */ static void pim_bs_timer_start(struct bsm_scope *scope, int bs_timeout); @@ -579,6 +580,7 @@ void pim_bsm_clear(struct pim_instance *pim) struct rp_info *rp_all; struct pim_upstream *up; struct rp_info *rp_info; + bool upstream_updated = false; if (pim->global_scope.current_bsr.s_addr) pim_nht_bsr_del(pim, pim->global_scope.current_bsr); @@ -681,8 +683,12 @@ void pim_bsm_clear(struct pim_instance *pim) } else { /* RP found for the group grp */ pim_upstream_update(pim, up); + upstream_updated = true; } } + + if (upstream_updated) + pim_zebra_update_all_interfaces(pim); } static bool pim_bsm_send_intf(uint8_t *buf, int len, struct interface *ifp, diff --git a/pimd/pim_rp.c b/pimd/pim_rp.c index 18b9236ac..4865b0ed4 100644 --- a/pimd/pim_rp.c +++ b/pimd/pim_rp.c @@ -413,7 +413,6 @@ void pim_upstream_update(struct pim_instance *pim, struct pim_upstream *up) old_rpf.source_nexthop.interface)) pim_zebra_upstream_rpf_changed(pim, up, &old_rpf); - pim_zebra_update_all_interfaces(pim); } int pim_rp_new(struct pim_instance *pim, struct in_addr rp_addr, @@ -431,6 +430,7 @@ int pim_rp_new(struct pim_instance *pim, struct in_addr rp_addr, struct prefix nht_p; struct route_node *rn; struct pim_upstream *up; + bool upstream_updated = false; if (rp_addr.s_addr == INADDR_ANY || rp_addr.s_addr == INADDR_NONE) @@ -547,10 +547,14 @@ int pim_rp_new(struct pim_instance *pim, struct in_addr rp_addr, grp.u.prefix4 = up->sg.grp; trp_info = pim_rp_find_match_group( pim, &grp); - if (trp_info == rp_all) + if (trp_info == rp_all) { pim_upstream_update(pim, up); + upstream_updated = true; + } } } + if (upstream_updated) + pim_zebra_update_all_interfaces(pim); pim_rp_check_interfaces(pim, rp_all); pim_rp_refresh_group_to_rp_mapping(pim); @@ -634,11 +638,16 @@ int pim_rp_new(struct pim_instance *pim, struct in_addr rp_addr, grp.u.prefix4 = up->sg.grp; trp_info = pim_rp_find_match_group(pim, &grp); - if (trp_info == rp_info) + if (trp_info == rp_info) { pim_upstream_update(pim, up); + upstream_updated = true; + } } } + if (upstream_updated) + pim_zebra_update_all_interfaces(pim); + pim_rp_check_interfaces(pim, rp_info); pim_rp_refresh_group_to_rp_mapping(pim); @@ -695,6 +704,7 @@ int pim_rp_del(struct pim_instance *pim, struct in_addr rp_addr, struct bsgrp_node *bsgrp = NULL; struct bsm_rpinfo *bsrp = NULL; char rp_str[INET_ADDRSTRLEN]; + bool upstream_updated = false; if (!inet_ntop(AF_INET, &rp_addr, rp_str, sizeof(rp_str))) snprintf(rp_str, sizeof(rp_str), "<rp?>"); @@ -837,11 +847,16 @@ int pim_rp_del(struct pim_instance *pim, struct in_addr rp_addr, } /* RP found for the group grp */ - else + else { pim_upstream_update(pim, up); + upstream_updated = true; + } } } + if (upstream_updated) + pim_zebra_update_all_interfaces(pim); + XFREE(MTYPE_PIM_RP, rp_info); return PIM_SUCCESS; } @@ -854,6 +869,7 @@ int pim_rp_change(struct pim_instance *pim, struct in_addr new_rp_addr, int result = 0; struct rp_info *rp_info = NULL; struct pim_upstream *up; + bool upstream_updated = false; rn = route_node_lookup(pim->rp_table, &group); if (!rn) { @@ -908,11 +924,16 @@ int pim_rp_change(struct pim_instance *pim, struct in_addr new_rp_addr, grp.u.prefix4 = up->sg.grp; trp_info = pim_rp_find_match_group(pim, &grp); - if (trp_info == rp_info) + if (trp_info == rp_info) { pim_upstream_update(pim, up); + upstream_updated = true; + } } } + if (upstream_updated) + pim_zebra_update_all_interfaces(pim); + /* Register new RP addr with Zebra NHT */ nht_p.u.prefix4 = rp_info->rp.rpf_addr.u.prefix4; if (PIM_DEBUG_PIM_NHT_RP) |