summaryrefslogtreecommitdiff
path: root/lib/zclient.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2018-04-18 11:10:27 -0400
committerDonald Sharp <sharpd@cumulusnetworks.com>2018-04-18 11:10:27 -0400
commit09924cffadc0fd952f730f97fe2275fa5652c7bd (patch)
tree24bbec965bf39784d4516675afc3d5d707b0556d /lib/zclient.c
parente49b64dee719b86b4844f0e3868b0f0bb6469e4d (diff)
zebra: Add pass up through zapi what zebra is capable of handling
Zebra is starting to have some run-time capabilites that would be useful to pass up to the higher level protocols so that they can act in an appropriate manner when needed. Send the ecmp value zebra is being run with and whether or not we believe mpls is enabled in the kernel or not. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'lib/zclient.c')
-rw-r--r--lib/zclient.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/zclient.c b/lib/zclient.c
index e1ce40ce70..ff4a2c7027 100644
--- a/lib/zclient.c
+++ b/lib/zclient.c
@@ -2480,6 +2480,25 @@ void zebra_read_pw_status_update(int command, struct zclient *zclient,
pw->status = stream_getl(s);
}
+static void zclient_capability_decode(int command, struct zclient *zclient,
+ zebra_size_t length, vrf_id_t vrf_id)
+{
+ struct zclient_capabilities cap;
+ struct stream *s = zclient->ibuf;
+ uint8_t mpls_enabled;
+
+ memset(&cap, 0, sizeof(cap));
+ STREAM_GETC(s, mpls_enabled);
+ cap.mpls_enabled = !!mpls_enabled;
+ STREAM_GETL(s, cap.ecmp);
+
+ if (zclient->zebra_capabilities)
+ (*zclient->zebra_capabilities)(&cap);
+
+stream_failure:
+ return;
+}
+
/* Zebra client message read function. */
static int zclient_read(struct thread *thread)
{
@@ -2577,6 +2596,9 @@ static int zclient_read(struct thread *thread)
(void *)zclient, command, vrf_id);
switch (command) {
+ case ZEBRA_CAPABILITIES:
+ zclient_capability_decode(command, zclient, length, vrf_id);
+ break;
case ZEBRA_ROUTER_ID_UPDATE:
if (zclient->router_id_update)
(*zclient->router_id_update)(command, zclient, length,