diff --git a/frr/zebra_dplane_grout.c b/frr/zebra_dplane_grout.c index cc4172ab2..6d76259aa 100644 --- a/frr/zebra_dplane_grout.c +++ b/frr/zebra_dplane_grout.c @@ -243,7 +243,7 @@ static void dplane_grout_connect(struct event *) { {.type = GR_EVENT_IFACE_STATUS_UP, .suppress_self_events = true}, {.type = GR_EVENT_IFACE_STATUS_DOWN, .suppress_self_events = true}, {.type = GR_EVENT_IFACE_POST_RECONFIG, .suppress_self_events = true}, - {.type = GR_EVENT_IFACE_PRE_REMOVE, .suppress_self_events = true}, + {.type = GR_EVENT_IFACE_REMOVE, .suppress_self_events = true}, {.type = GR_EVENT_IP_ADDR_ADD, .suppress_self_events = false}, {.type = GR_EVENT_IP6_ADDR_ADD, .suppress_self_events = false}, {.type = GR_EVENT_IP_ADDR_DEL, .suppress_self_events = false}, @@ -383,8 +383,8 @@ static const char *gr_evt_to_str(uint32_t e) { return TOSTRING(GR_EVENT_IFACE_ADD); case GR_EVENT_IFACE_POST_ADD: return TOSTRING(GR_EVENT_IFACE_POST_ADD); - case GR_EVENT_IFACE_PRE_REMOVE: - return TOSTRING(GR_EVENT_IFACE_PRE_REMOVE); + case GR_EVENT_IFACE_REMOVE: + return TOSTRING(GR_EVENT_IFACE_REMOVE); case GR_EVENT_IFACE_STATUS_UP: return TOSTRING(GR_EVENT_IFACE_STATUS_UP); case GR_EVENT_IFACE_STATUS_DOWN: @@ -443,7 +443,7 @@ static void dplane_read_notifications(struct event *event) { case GR_EVENT_IFACE_POST_RECONFIG: new = true; // fallthrough - case GR_EVENT_IFACE_PRE_REMOVE: + case GR_EVENT_IFACE_REMOVE: iface = PAYLOAD(gr_e); gr_log_debug( diff --git a/modules/infra/api/gr_infra.h b/modules/infra/api/gr_infra.h index 913ee6135..3bac61226 100644 --- a/modules/infra/api/gr_infra.h +++ b/modules/infra/api/gr_infra.h @@ -199,9 +199,10 @@ typedef enum { GR_EVENT_IFACE_ADD = EVENT_TYPE(GR_INFRA_MODULE, 0x0001), GR_EVENT_IFACE_POST_ADD = EVENT_TYPE(GR_INFRA_MODULE, 0x0002), GR_EVENT_IFACE_PRE_REMOVE = EVENT_TYPE(GR_INFRA_MODULE, 0x0003), - GR_EVENT_IFACE_POST_RECONFIG = EVENT_TYPE(GR_INFRA_MODULE, 0x0004), - GR_EVENT_IFACE_STATUS_UP = EVENT_TYPE(GR_INFRA_MODULE, 0x0005), - GR_EVENT_IFACE_STATUS_DOWN = EVENT_TYPE(GR_INFRA_MODULE, 0x0006), + GR_EVENT_IFACE_REMOVE = EVENT_TYPE(GR_INFRA_MODULE, 0x0004), + GR_EVENT_IFACE_POST_RECONFIG = EVENT_TYPE(GR_INFRA_MODULE, 0x0005), + GR_EVENT_IFACE_STATUS_UP = EVENT_TYPE(GR_INFRA_MODULE, 0x0006), + GR_EVENT_IFACE_STATUS_DOWN = EVENT_TYPE(GR_INFRA_MODULE, 0x0007), } gr_event_iface_t; // ifaces /////////////////////////////////////////////////////////////////////// diff --git a/modules/infra/api/iface.c b/modules/infra/api/iface.c index e59a6c1b5..227de54d7 100644 --- a/modules/infra/api/iface.c +++ b/modules/infra/api/iface.c @@ -163,11 +163,12 @@ static int iface_event_serialize(const void *obj, void **buf) { static struct gr_event_serializer iface_serializer = { .callback = iface_event_serialize, - .ev_count = 6, + .ev_count = 7, .ev_types = { GR_EVENT_IFACE_ADD, GR_EVENT_IFACE_POST_ADD, GR_EVENT_IFACE_PRE_REMOVE, + GR_EVENT_IFACE_REMOVE, GR_EVENT_IFACE_POST_RECONFIG, GR_EVENT_IFACE_STATUS_UP, GR_EVENT_IFACE_STATUS_DOWN, diff --git a/modules/infra/cli/iface.c b/modules/infra/cli/iface.c index 5dc2d0ff6..0ff5f0156 100644 --- a/modules/infra/cli/iface.c +++ b/modules/infra/cli/iface.c @@ -547,6 +547,9 @@ static void iface_event_print(uint32_t event, const void *obj) { action = "post add"; break; case GR_EVENT_IFACE_PRE_REMOVE: + action = "pre del"; + break; + case GR_EVENT_IFACE_REMOVE: action = "del"; break; case GR_EVENT_IFACE_STATUS_UP: @@ -574,6 +577,7 @@ static struct cli_event_printer printer = { GR_EVENT_IFACE_ADD, GR_EVENT_IFACE_POST_ADD, GR_EVENT_IFACE_PRE_REMOVE, + GR_EVENT_IFACE_REMOVE, GR_EVENT_IFACE_STATUS_UP, GR_EVENT_IFACE_STATUS_DOWN, GR_EVENT_IFACE_POST_RECONFIG, diff --git a/modules/infra/control/ctlplane.c b/modules/infra/control/ctlplane.c index 118dc01c2..5ab28f6c9 100644 --- a/modules/infra/control/ctlplane.c +++ b/modules/infra/control/ctlplane.c @@ -426,7 +426,7 @@ static void iface_event(uint32_t event, const void *obj) { case GR_EVENT_IFACE_POST_RECONFIG: cp_update(iface); break; - case GR_EVENT_IFACE_PRE_REMOVE: + case GR_EVENT_IFACE_REMOVE: cp_delete(iface); break; case GR_EVENT_IFACE_STATUS_UP: @@ -446,7 +446,7 @@ static struct gr_event_subscription iface_event_handler = { .ev_count = 5, .ev_types = { GR_EVENT_IFACE_ADD, - GR_EVENT_IFACE_PRE_REMOVE, + GR_EVENT_IFACE_REMOVE, GR_EVENT_IFACE_STATUS_UP, GR_EVENT_IFACE_STATUS_DOWN, GR_EVENT_IFACE_POST_RECONFIG, diff --git a/modules/infra/control/iface.c b/modules/infra/control/iface.c index 088d5aa41..2bd705d86 100644 --- a/modules/infra/control/iface.c +++ b/modules/infra/control/iface.c @@ -433,12 +433,13 @@ int iface_destroy(uint16_t ifid) { if (gr_vec_len(iface->subinterfaces) != 0) return errno_set(EBUSY); + gr_event_push(GR_EVENT_IFACE_PRE_REMOVE, iface); // interface is still up, send status down if (iface->flags & GR_IFACE_F_UP) { iface->flags &= ~GR_IFACE_F_UP; gr_event_push(GR_EVENT_IFACE_STATUS_DOWN, iface); } - gr_event_push(GR_EVENT_IFACE_PRE_REMOVE, iface); + gr_event_push(GR_EVENT_IFACE_REMOVE, iface); if (iface->type != GR_IFACE_TYPE_LOOPBACK) vrf_decref(iface->vrf_id); nexthop_iface_cleanup(ifid); @@ -502,12 +503,18 @@ static void iface_event(uint32_t event, const void *obj) { const struct iface *iface = obj; char *str = ""; switch (event) { + case GR_EVENT_IFACE_ADD: + str = "ADD"; + break; case GR_EVENT_IFACE_POST_ADD: str = "POST_ADD"; break; case GR_EVENT_IFACE_PRE_REMOVE: str = "PRE_REMOVE"; break; + case GR_EVENT_IFACE_REMOVE: + str = "REMOVE"; + break; case GR_EVENT_IFACE_POST_RECONFIG: str = "POST_RECONFIG"; break; @@ -536,10 +543,12 @@ static void iface_event(uint32_t event, const void *obj) { static struct gr_event_subscription iface_event_handler = { .callback = iface_event, - .ev_count = 5, + .ev_count = 7, .ev_types = { + GR_EVENT_IFACE_ADD, GR_EVENT_IFACE_POST_ADD, GR_EVENT_IFACE_PRE_REMOVE, + GR_EVENT_IFACE_REMOVE, GR_EVENT_IFACE_POST_RECONFIG, GR_EVENT_IFACE_STATUS_UP, GR_EVENT_IFACE_STATUS_DOWN, diff --git a/modules/ip6/control/router_advert.c b/modules/ip6/control/router_advert.c index d7b784e81..aabbe6292 100644 --- a/modules/ip6/control/router_advert.c +++ b/modules/ip6/control/router_advert.c @@ -230,7 +230,7 @@ static void iface_event_handler(uint32_t event, const void *obj) { ev_base, -1, EV_PERSIST, send_ra_cb, (void *)iface ); break; - case GR_EVENT_IFACE_PRE_REMOVE: + case GR_EVENT_IFACE_REMOVE: event_free(ra_conf[iface->id].timer); ra_conf[iface->id].timer = NULL; break; @@ -240,7 +240,7 @@ static void iface_event_handler(uint32_t event, const void *obj) { static struct gr_event_subscription iface_event_sub = { .callback = iface_event_handler, .ev_count = 2, - .ev_types = {GR_EVENT_IFACE_POST_ADD, GR_EVENT_IFACE_PRE_REMOVE}, + .ev_types = {GR_EVENT_IFACE_POST_ADD, GR_EVENT_IFACE_REMOVE}, }; RTE_INIT(router_advertisement_init) {