/* add/delete virtual MAC address on NIC if necessary */
vrrp_vr_transition_vmac (vr, new_state);
+ vrrp_vr_event (vr, new_state);
+
vr->runtime.state = new_state;
}
vrrp_intf_enable_disable_mcast (u8 enable, u32 sw_if_index, u8 is_ipv6)
{
vrrp_main_t *vrm = &vrrp_main;
+ vrrp_vr_t *vr;
vrrp_intf_t *intf;
u32 fib_index;
+ u32 n_vrs = 0;
const mfib_prefix_t *vrrp_prefix;
fib_protocol_t proto;
vnet_link_t link_type;
via_itf.frp_proto = fib_proto_to_dpo (proto);
fib_index = mfib_table_get_index_for_sw_if_index (proto, sw_if_index);
+ /* *INDENT-OFF* */
+ pool_foreach (vr, vrm->vrs,
+ ({
+ if (vrrp_vr_is_ipv6 (vr) == is_ipv6)
+ n_vrs++;
+ }));
+ /* *INDENT-ON* */
+
if (enable)
{
- if (pool_elts (vrm->vrs) == 1)
+ /* If this is the first VR configured, add the local mcast routes */
+ if (n_vrs == 1)
mfib_table_entry_path_update (fib_index, vrrp_prefix, MFIB_SOURCE_API,
&for_us);
}
else
{
- if (pool_elts (vrm->vrs) == 0)
+ /* Remove mcast local routes if this is the last VR being deleted */
+ if (n_vrs == 0)
mfib_table_entry_path_remove (fib_index, vrrp_prefix, MFIB_SOURCE_API,
&for_us);