}
/* called when the routerid of an instance changes */
-static int bmp_routerid_update(struct bgp *bgp, bool withdraw)
+static int bmp_bgp_attribute_updated(struct bgp *bgp, bool withdraw)
{
struct bmp_bgp *bmpbgp = bmp_bgp_find(bgp);
return 1;
}
+static int bmp_routerid_update(struct bgp *bgp, bool withdraw)
+{
+ return bmp_bgp_attribute_updated(bgp, withdraw);
+}
+
+static int bmp_route_distinguisher_update(struct bgp *bgp, afi_t afi, bool preconfig)
+{
+ return bmp_bgp_attribute_updated(bgp, preconfig);
+}
/* called when a bgp instance goes up/down, implying that the underlying VRF
* has been created or deleted in zebra
hook_register(bgp_instance_state, bmp_vrf_state_changed);
hook_register(bgp_vrf_status_changed, bmp_vrf_itf_state_changed);
hook_register(bgp_routerid_update, bmp_routerid_update);
+ hook_register(bgp_route_distinguisher_update, bmp_route_distinguisher_update);
return 0;
}
DEFINE_HOOK(bgp_snmp_update_last_changed, (struct bgp *bgp), (bgp));
DEFINE_HOOK(bgp_snmp_init_stats, (struct bgp *bgp), (bgp));
DEFINE_HOOK(bgp_snmp_traps_config_write, (struct vty * vty), (vty));
+DEFINE_HOOK(bgp_route_distinguisher_update, (struct bgp *bgp, afi_t afi, bool preconfig),
+ (bgp, afi, preconfig));
static struct peer_group *listen_range_exists(struct bgp *bgp,
struct prefix *range, int exact);
vpn_leak_prechange(BGP_VPN_POLICY_DIR_TOVPN, afi,
bgp_get_default(), bgp);
+ if (!bgp->vpn_policy[afi].tovpn_rd_pretty && !rd_str)
+ return CMD_SUCCESS;
+
+ if (yes && bgp->vpn_policy[afi].tovpn_rd_pretty && rd_str &&
+ strmatch(rd_str, bgp->vpn_policy[afi].tovpn_rd_pretty))
+ return CMD_SUCCESS;
+
+ hook_call(bgp_route_distinguisher_update, bgp, afi, true);
if (yes) {
if (bgp->vpn_policy[afi].tovpn_rd_pretty)
XFREE(MTYPE_BGP_NAME, bgp->vpn_policy[afi].tovpn_rd_pretty);
BGP_VPN_POLICY_TOVPN_RD_SET);
} else {
XFREE(MTYPE_BGP_NAME, bgp->vpn_policy[afi].tovpn_rd_pretty);
+ bgp->vpn_policy[afi].tovpn_rd_pretty = NULL;
UNSET_FLAG(bgp->vpn_policy[afi].flags,
BGP_VPN_POLICY_TOVPN_RD_SET);
}
+ hook_call(bgp_route_distinguisher_update, bgp, afi, false);
/* post-change: re-export vpn routes */
vpn_leak_postchange(BGP_VPN_POLICY_DIR_TOVPN, afi,
(vrf, enabled));
DECLARE_HOOK(bgp_instance_state, (struct bgp *bgp), (bgp));
DECLARE_HOOK(bgp_routerid_update, (struct bgp *bgp, bool withdraw), (bgp, withdraw));
+DECLARE_HOOK(bgp_route_distinguisher_update, (struct bgp *bgp, afi_t afi, bool preconfig),
+ (bgp, afi, preconfig));
/* Thread callback information */
struct afi_safi_info {