Skip to content

Commit

Permalink
lib: add table_id route entry flag
Browse files Browse the repository at this point in the history
Add a flag to mean that a route entry is owned by a table ID and not by
a VRF. If the VRF associated to the table ID is deleted, the route
entry must not be deleted.

Signed-off-by: Louis Scalbert <[email protected]>
  • Loading branch information
louis-6wind committed Nov 19, 2024
1 parent b44533b commit a08a901
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/zclient.c
Original file line number Diff line number Diff line change
Expand Up @@ -1236,6 +1236,8 @@ int zapi_route_encode(uint8_t cmd, struct stream *s, struct zapi_route *api)
stream_putc(s, api->type);

stream_putw(s, api->instance);
if (CHECK_FLAG(api->message, ZAPI_MESSAGE_TABLEID))
SET_FLAG(api->flags, ZEBRA_FLAG_TABLEID);
stream_putl(s, api->flags);
stream_putl(s, api->message);

Expand Down Expand Up @@ -1295,6 +1297,8 @@ int zapi_route_encode(uint8_t cmd, struct stream *s, struct zapi_route *api)
return -1;
}

if (CHECK_FLAG(api->message, ZAPI_MESSAGE_TABLEID))
SET_FLAG(api->flags, ZEBRA_FLAG_TABLEID);
if (zapi_nexthop_encode(s, api_nh, api->flags,
api->message)
!= 0)
Expand Down Expand Up @@ -1334,6 +1338,9 @@ int zapi_route_encode(uint8_t cmd, struct stream *s, struct zapi_route *api)
return -1;
}

if (CHECK_FLAG(api->message, ZAPI_MESSAGE_TABLEID))
SET_FLAG(api->flags, ZEBRA_FLAG_TABLEID);

if (zapi_nexthop_encode(s, api_nh, api->flags,
api->message)
!= 0)
Expand Down
6 changes: 6 additions & 0 deletions lib/zclient.h
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,12 @@ struct zapi_route {
* kernel (NLM_F_APPEND at the very least )
*/
#define ZEBRA_FLAG_OUTOFSYNC 0x400
/*
* This flag lets us know that the route entry is
* associated to the table ID and must remain when the
* table ID is de-associated from a VRF.
*/
#define ZEBRA_FLAG_TABLEID 0x800

/* The older XXX_MESSAGE flags live here */
uint32_t message;
Expand Down

0 comments on commit a08a901

Please sign in to comment.