diff --git a/keepalived/core/keepalived_netlink.c b/keepalived/core/keepalived_netlink.c index 0f95cbfb3c..3582dee043 100644 --- a/keepalived/core/keepalived_netlink.c +++ b/keepalived/core/keepalived_netlink.c @@ -1978,6 +1978,8 @@ netlink_if_link_populate(interface_t *ifp, struct rtattr *tb[], struct ifinfomsg #endif /* _HAVE_VRF_ */ ifp->rp_filter = UINT_MAX; /* We have not read it yet */ + + ifp->cleaning = false; #endif /* _HAVE_VRRP_VMAC_ */ ifp->ifi_flags = ifi->ifi_flags; diff --git a/keepalived/include/vrrp_if.h b/keepalived/include/vrrp_if.h index 0ee5bb7576..248b09cfc6 100644 --- a/keepalived/include/vrrp_if.h +++ b/keepalived/include/vrrp_if.h @@ -161,6 +161,7 @@ typedef struct _interface { otherwise the physical interface */ bool is_ours; /* keepalived created the interface */ bool deleting; /* Set when we are deleting the interface */ + bool cleaning; /* Set when we are cleaning the interface */ bool seen_interface; /* The interface has existed at some point since we started */ bool changeable_type; /* The interface type or underlying interface can be changed */ #ifdef _HAVE_VRF_ diff --git a/keepalived/vrrp/vrrp_if.c b/keepalived/vrrp/vrrp_if.c index f9bde8dbae..60befa04d6 100644 --- a/keepalived/vrrp/vrrp_if.c +++ b/keepalived/vrrp/vrrp_if.c @@ -1394,6 +1394,11 @@ cleanup_lost_interface(interface_t *ifp) tracking_obj_t *top; vrrp_t *vrrp; +#ifdef _HAVE_VRRP_VMAC_ + ifp->cleaning = true; +#endif /* _HAVE_VRRP_VMAC_ */ + + list_for_each_entry(top, &ifp->tracking_vrrp, e_list) { vrrp = top->obj.vrrp; @@ -1476,12 +1481,19 @@ cleanup_lost_interface(interface_t *ifp) interface_down(ifp); +#ifdef _HAVE_VRRP_VMAC_ + if (!ifp->cleaning) + /* interface has been refreshed. Do not clean */ + return; +#endif /* _HAVE_VRRP_VMAC_ */ + ifp->ifindex = 0; ifp->ifi_flags = 0; ifp->seen_up = false; #ifdef _HAVE_VRRP_VMAC_ if (!ifp->is_ours) ifp->base_ifp = ifp; + ifp->cleaning = false; #endif #ifdef _HAVE_VRF_ ifp->vrf_master_ifp = NULL;