bgpd, lib, ospfd, zebra: Add ability to read/write tag value
Modify zebra to pass the tag value to and from the
various protocols.
[forward ported by Cumulus]
Signed-off-by: Daniel Walton <dwalton@cumulusnetworks.com>
Signed-off-by: Piotr Chytla <pch@packetconsulting.pl>
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Edits: Paul Jakma <paul.jakma@hpe.com> rebase conflicts in bgp_zebra.c
diff --git a/lib/zclient.c b/lib/zclient.c
index 097314a..a1de831 100644
--- a/lib/zclient.c
+++ b/lib/zclient.c
@@ -530,6 +530,8 @@
* If ZAPI_MESSAGE_METRIC is set, the metric value is written as an 8
* byte value.
*
+ * If ZAPI_MESSAGE_TAG is set, the tag value is written as a 2 byte value
+ *
* XXX: No attention paid to alignment.
*/
int
@@ -588,6 +590,8 @@
stream_putl (s, api->metric);
if (CHECK_FLAG (api->message, ZAPI_MESSAGE_MTU))
stream_putl (s, api->mtu);
+ if (CHECK_FLAG (api->message, ZAPI_MESSAGE_TAG))
+ stream_putw (s, api->tag);
/* Put length at the first point of the stream. */
stream_putw_at (s, 0, stream_get_endp (s));
@@ -644,6 +648,8 @@
stream_putl (s, api->metric);
if (CHECK_FLAG (api->message, ZAPI_MESSAGE_MTU))
stream_putl (s, api->mtu);
+ if (CHECK_FLAG (api->message, ZAPI_MESSAGE_TAG))
+ stream_putw (s, api->tag);
/* Put length at the first point of the stream. */
stream_putw_at (s, 0, stream_get_endp (s));
diff --git a/lib/zclient.h b/lib/zclient.h
index a3452eb..810c927 100644
--- a/lib/zclient.h
+++ b/lib/zclient.h
@@ -99,6 +99,7 @@
#define ZAPI_MESSAGE_DISTANCE 0x04
#define ZAPI_MESSAGE_METRIC 0x08
#define ZAPI_MESSAGE_MTU 0x10
+#define ZAPI_MESSAGE_TAG 0x20
/* Zserv protocol message header */
struct zserv_header
@@ -132,6 +133,8 @@
u_char distance;
+ u_short tag;
+
u_int32_t metric;
u_int32_t mtu;
@@ -210,6 +213,8 @@
u_char distance;
+ u_short tag;
+
u_int32_t metric;
u_int32_t mtu;