mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-15 05:18:47 +00:00
Merge pull request #15688 from mjstapp/dplane_api_version
lib, zebra: Add a version scheme for the dataplane API
This commit is contained in:
commit
692f916b88
@ -161,6 +161,21 @@ Zebra Protocol Commands
|
||||
|
||||
The definitions of zebra protocol commands can be found at ``lib/zclient.h``.
|
||||
|
||||
|
||||
Zebra Dataplane
|
||||
===============
|
||||
|
||||
The zebra dataplane subsystem provides a framework for FIB
|
||||
programming. Zebra uses the dataplane to program the local kernel as
|
||||
it makes changes to objects such as IP routes, MPLS LSPs, and
|
||||
interface IP addresses. The dataplane runs in its own pthread, in
|
||||
order to off-load work from the main zebra pthread.
|
||||
|
||||
The zebra dataplane API is versioned; the version number must be
|
||||
updated along with API changes. Plugins can test the current version
|
||||
number and confirm that they are compatible with the current version.
|
||||
|
||||
|
||||
Dataplane batching
|
||||
==================
|
||||
|
||||
|
@ -1450,3 +1450,12 @@ void _libfrr_version(void)
|
||||
write(1, banner, sizeof(banner) - 1);
|
||||
_exit(0);
|
||||
}
|
||||
|
||||
/* Render simple version tuple to string */
|
||||
const char *frr_vers2str(uint32_t version, char *buf, int buflen)
|
||||
{
|
||||
snprintf(buf, buflen, "%d.%d.%d", MAJOR_FRRVERSION(version),
|
||||
MINOR_FRRVERSION(version), SUB_FRRVERSION(version));
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
11
lib/libfrr.h
11
lib/libfrr.h
@ -233,6 +233,17 @@ extern bool frr_is_after_fork;
|
||||
|
||||
extern bool debug_memstats_at_exit;
|
||||
|
||||
/*
|
||||
* Version numbering: MAJOR (8) | MINOR (16) | SUB (8)
|
||||
*/
|
||||
#define MAKE_FRRVERSION(maj, min, sub) \
|
||||
((((maj) & 0xff) << 24) | (((min) & 0xffff) << 8) | ((sub) & 0xff))
|
||||
#define MAJOR_FRRVERSION(v) (((v) >> 24) & 0xff)
|
||||
#define MINOR_FRRVERSION(v) (((v) >> 8) & 0xffff)
|
||||
#define SUB_FRRVERSION(v) ((v) & 0xff)
|
||||
|
||||
const char *frr_vers2str(uint32_t version, char *buf, int buflen);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -39,6 +39,13 @@ DEFINE_MTYPE_STATIC(ZEBRA, DP_NS, "DPlane NSes");
|
||||
# define AOK 0
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Dataplane API version. This must be updated when any incompatible changes
|
||||
* are made. The minor version (at least) should be updated when new APIs
|
||||
* are introduced.
|
||||
*/
|
||||
static uint32_t zdplane_version = MAKE_FRRVERSION(2, 0, 0);
|
||||
|
||||
/* Control for collection of extra interface info with route updates; a plugin
|
||||
* can enable the extra info via a dplane api.
|
||||
*/
|
||||
@ -664,6 +671,12 @@ neigh_update_internal(enum dplane_op_e op, const struct interface *ifp,
|
||||
* Public APIs
|
||||
*/
|
||||
|
||||
/* Access the dplane API version */
|
||||
uint32_t zebra_dplane_get_version(void)
|
||||
{
|
||||
return zdplane_version;
|
||||
}
|
||||
|
||||
/* Obtain thread_master for dataplane thread */
|
||||
struct event_loop *dplane_get_thread_master(void)
|
||||
{
|
||||
|
@ -24,6 +24,13 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Retrieve the dataplane API version number; see libfrr.h to decode major,
|
||||
* minor, sub version values.
|
||||
* Plugins should pay attention to the major version number, at least, to
|
||||
* be able to detect API changes that may not be backward-compatible.
|
||||
*/
|
||||
uint32_t zebra_dplane_get_version(void);
|
||||
|
||||
/* Key netlink info from zebra ns */
|
||||
struct zebra_dplane_info {
|
||||
ns_id_t ns_id;
|
||||
|
Loading…
Reference in New Issue
Block a user