]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: add dataplane API version value
authorMark Stapp <mjs@cisco.com>
Fri, 5 Apr 2024 17:32:08 +0000 (13:32 -0400)
committerMark Stapp <mjs@cisco.com>
Tue, 9 Apr 2024 12:59:13 +0000 (08:59 -0400)
Add a version value and accessor API for the zebra dataplane;
plugins can test this to detect API changes.

Signed-off-by: Mark Stapp <mjs@cisco.com>
zebra/zebra_dplane.c
zebra/zebra_dplane.h

index 006ab504efa2e03b5f681e77653cb46dde61f184..06b34da20932b25b2eb69029b8cb02fe2639e74b 100644 (file)
@@ -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)
 {
index 2f7d2185081b44653dc2bd1a9fdbe09c70822dca..060b1c8b9e032ddb7d154ad89b2a8e2118bd7dc4 100644 (file)
 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;