summaryrefslogtreecommitdiffstats
path: root/zebra/zebra_opaque.c
diff options
context:
space:
mode:
authorMark Stapp <mjs@voltanet.io>2020-06-04 19:11:35 +0200
committerMark Stapp <mjs@voltanet.io>2020-06-10 14:26:27 +0200
commit387831ffc39cb432c9cedfe1376b8361084c7bc1 (patch)
tree9eea0f71580c91399be95743e2f560eb582131ec /zebra/zebra_opaque.c
parentlib,zebra: rename opaque decode api (diff)
downloadfrr-387831ffc39cb432c9cedfe1376b8361084c7bc1.tar.xz
frr-387831ffc39cb432c9cedfe1376b8361084c7bc1.zip
lib,zebra,sharpd: modify opaque zapi message to support unicast
Start modifying the OPAQUE zapi message to include optional unicast destination zapi client info. Add a 'decode' api and opaque msg struct to encapsulate that optional info. Signed-off-by: Mark Stapp <mjs@voltanet.io>
Diffstat (limited to 'zebra/zebra_opaque.c')
-rw-r--r--zebra/zebra_opaque.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/zebra/zebra_opaque.c b/zebra/zebra_opaque.c
index 0b7c5b26b..8fb02114d 100644
--- a/zebra/zebra_opaque.c
+++ b/zebra/zebra_opaque.c
@@ -347,8 +347,9 @@ static int dispatch_opq_messages(struct stream_fifo *msg_fifo)
{
struct stream *msg, *dup;
struct zmsghdr hdr;
+ struct zapi_opaque_msg info;
struct opq_msg_reg *reg;
- uint32_t type;
+ int ret;
struct opq_client_reg *client;
struct zserv *zclient;
char buf[50];
@@ -372,15 +373,17 @@ static int dispatch_opq_messages(struct stream_fifo *msg_fifo)
/* Dispatch to any registered ZAPI client(s) */
- /* Extract subtype */
- STREAM_GETL(msg, type);
+ /* Extract subtype and flags */
+ ret = zclient_opaque_decode(msg, &info);
+ if (ret != 0)
+ goto drop_it;
/* Look up registered ZAPI client(s) */
- reg = opq_reg_lookup(type);
+ reg = opq_reg_lookup(info.type);
if (reg == NULL) {
if (IS_ZEBRA_DEBUG_RECV)
- zlog_debug("%s: no registrations for opaque type %u",
- __func__, type);
+ zlog_debug("%s: no registrations for opaque type %u, flags %#x",
+ __func__, info.type, info.flags);
goto drop_it;
}
@@ -427,7 +430,7 @@ static int dispatch_opq_messages(struct stream_fifo *msg_fifo)
} else {
if (IS_ZEBRA_DEBUG_RECV)
zlog_debug("%s: type %u: no zclient for %s",
- __func__, type,
+ __func__, info.type,
opq_client2str(buf,
sizeof(buf),
client));
@@ -438,7 +441,7 @@ static int dispatch_opq_messages(struct stream_fifo *msg_fifo)
}
drop_it:
-stream_failure:
+
if (msg)
stream_free(msg);
}