From 224b3c8a79a6635400d7b92f5d89eab1bd9e08a2 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Wed, 22 Apr 2020 09:41:01 -0400 Subject: [PATCH] lib: Add the ability to grab a nhg starting id Add new function zclient_get_nhg_start that will allow an upper level protocol to get a starting point for it's own nhg space. Give each protocol a space of 50 million. zebra will own the space from 0 - 199999999 because of SYSTEM, KERNEL and CONNECT route types. This is the start of some work that will allow upper level protocols to install and maintain their own NHG's. Signed-off-by: Donald Sharp --- lib/zclient.c | 10 ++++++++++ lib/zclient.h | 8 ++++++++ 2 files changed, 18 insertions(+) diff --git a/lib/zclient.c b/lib/zclient.c index c5016d22e2..b0549bf84e 100644 --- a/lib/zclient.c +++ b/lib/zclient.c @@ -4001,3 +4001,13 @@ int zclient_send_neigh_discovery_req(struct zclient *zclient, stream_putw_at(s, 0, stream_get_endp(s)); return zclient_send_message(zclient); } + +/* + * Get a starting nhg point for a routing protocol + */ +uint32_t zclient_get_nhg_start(uint32_t proto) +{ + assert(proto < ZEBRA_ROUTE_MAX); + + return ZEBRA_NHG_SPACING * proto; +} diff --git a/lib/zclient.h b/lib/zclient.h index 050877f27a..d2f559c45d 100644 --- a/lib/zclient.h +++ b/lib/zclient.h @@ -671,6 +671,14 @@ struct zclient_options { extern struct zclient_options zclient_options_default; +/* + * Each client is going to get it's own nexthop group space + * and we'll separate them by 50 million, we'll figure out where + * to start based upon the route_types.h + */ +#define ZEBRA_NHG_SPACING 50000000 +extern uint32_t zclient_get_nhg_start(uint32_t proto); + extern struct zclient *zclient_new(struct thread_master *m, struct zclient_options *opt); -- 2.39.5