summaryrefslogtreecommitdiff
path: root/lib/zclient.c
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2014-04-24 17:30:26 +0200
committerChristian Franke <chris@opensourcerouting.org>2017-01-30 13:47:04 +0100
commitd75f3b00e74de3350202848d62b2bfbcdd1c0dae (patch)
tree0c20a539e4f15602fa3d51ea58f464b6e8661df2 /lib/zclient.c
parent3c7c91d0bd04d4db0a47db5717d36671ecc96a1b (diff)
lib: send ZAPI IPv6 source prefix
This introduces ZAPI_MESSAGE_SRCPFX, and if set adds a source prefix field to ZAPI IPv6 route messages sent from daemons to zebra. The function calls all have a new prefix_ipv6 * argument specifying the source, or NULL. All daemons currently supply NULL. Zebra support for processing the field was added in the previous patch, however, zebra does not do anything useful with the value yet. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'lib/zclient.c')
-rw-r--r--lib/zclient.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/zclient.c b/lib/zclient.c
index 42fa41c9c8..92662fd70f 100644
--- a/lib/zclient.c
+++ b/lib/zclient.c
@@ -854,12 +854,15 @@ zapi_ipv4_route_ipv6_nexthop (u_char cmd, struct zclient *zclient,
int
zapi_ipv6_route (u_char cmd, struct zclient *zclient, struct prefix_ipv6 *p,
- struct zapi_ipv6 *api)
+ struct prefix_ipv6 *src_p, struct zapi_ipv6 *api)
{
int i;
int psize;
struct stream *s;
+ /* either we have !SRCPFX && src_p == NULL, or SRCPFX && src_p != NULL */
+ assert (!(api->message & ZAPI_MESSAGE_SRCPFX) == !src_p);
+
/* Reset stream. */
s = zclient->obuf;
stream_reset (s);
@@ -878,6 +881,13 @@ zapi_ipv6_route (u_char cmd, struct zclient *zclient, struct prefix_ipv6 *p,
stream_putc (s, p->prefixlen);
stream_write (s, (u_char *)&p->prefix, psize);
+ if (CHECK_FLAG (api->message, ZAPI_MESSAGE_SRCPFX))
+ {
+ psize = PSIZE (src_p->prefixlen);
+ stream_putc (s, src_p->prefixlen);
+ stream_write (s, (u_char *)&src_p->prefix, psize);
+ }
+
/* Nexthop, ifindex, distance and metric information. */
if (CHECK_FLAG (api->message, ZAPI_MESSAGE_NEXTHOP))
{