#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);
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);
} 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,
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,
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)
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);
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);
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?>");
}
/* 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;
}
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) {
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)