From 62475ecd43b5394aef378ac09949512235bf0c17 Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Thu, 21 Feb 2019 16:36:58 +0000 Subject: [PATCH] vrrpd: stop session before nulling iface When an interface is deleted from the system, stop any attached VRRP sessions before nulling out the interface fields. Signed-off-by: Quentin Young --- vrrpd/vrrp.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/vrrpd/vrrp.c b/vrrpd/vrrp.c index e0f9b5286b..92ed12e239 100644 --- a/vrrpd/vrrp.c +++ b/vrrpd/vrrp.c @@ -1920,12 +1920,15 @@ void vrrp_if_del(struct interface *ifp) vrrp_if_down(ifp); for (ALL_LIST_ELEMENTS_RO(vrs, ln, vr)) { - if (vr->ifp == ifp) - vr->ifp = NULL; - else if (vr->v4->mvl_ifp == ifp) + if ((vr->v4->mvl_ifp == ifp || vr->ifp == ifp) + && vr->v4->fsm.state != VRRP_STATE_INITIALIZE) { + vrrp_event(vr->v4, VRRP_EVENT_SHUTDOWN); vr->v4->mvl_ifp = NULL; - else if (vr->v6->mvl_ifp == ifp) + } else if ((vr->v6->mvl_ifp == ifp || vr->ifp == ifp) + && vr->v6->fsm.state != VRRP_STATE_INITIALIZE) { + vrrp_event(vr->v6, VRRP_EVENT_SHUTDOWN); vr->v6->mvl_ifp = NULL; + } } list_delete(&vrs); -- 2.39.5