Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions frr/zebra_dplane_grout.c
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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(
Expand Down
7 changes: 4 additions & 3 deletions modules/infra/api/gr_infra.h
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use 0x0007 for GR_EVENT_IFACE_REMOVE to preserve ABI?

Copy link
Collaborator Author

@christophefontaine christophefontaine Nov 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no need: we don't guarantee any ABI compatibility, and the 2 customers (grcli and frr plugin) of this API are built as part of grout.
There is in fact a check on connection which rejects it if a wrong client tries to connect to grout.

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 ///////////////////////////////////////////////////////////////////////
Expand Down
3 changes: 2 additions & 1 deletion modules/infra/api/iface.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 4 additions & 0 deletions modules/infra/cli/iface.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand 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,
Expand Down
4 changes: 2 additions & 2 deletions modules/infra/control/ctlplane.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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,
Expand Down
13 changes: 11 additions & 2 deletions modules/infra/control/iface.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions modules/ip6/control/router_advert.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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) {
Expand Down