summaryrefslogtreecommitdiff
path: root/lib/zclient.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/zclient.c')
-rw-r--r--lib/zclient.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/lib/zclient.c b/lib/zclient.c
index 440de3635f..859751deb8 100644
--- a/lib/zclient.c
+++ b/lib/zclient.c
@@ -35,6 +35,7 @@
#include "nexthop.h"
DEFINE_MTYPE_STATIC(LIB, ZCLIENT, "Zclient")
+DEFINE_MTYPE_STATIC(LIB, REDIST_INST, "Redistribution instance IDs")
/* Zebra client events. */
enum event {ZCLIENT_SCHEDULE, ZCLIENT_READ, ZCLIENT_CONNECT};
@@ -106,7 +107,7 @@ redist_add_instance (struct redist_proto *red, u_short instance)
if (!red->instances)
red->instances = list_new();
- in = calloc (1, sizeof(u_short));
+ in = XMALLOC (MTYPE_REDIST_INST, sizeof(u_short));
*in = instance;
listnode_add (red->instances, in);
}
@@ -121,7 +122,7 @@ redist_del_instance (struct redist_proto *red, u_short instance)
return;
listnode_delete(red->instances, id);
- free (id);
+ XFREE (MTYPE_REDIST_INST, id);
if (!red->instances->count)
{
red->enabled = 0;
@@ -786,7 +787,6 @@ zapi_ipv4_route (u_char cmd, struct zclient *zclient, struct prefix_ipv4 *p,
return zclient_send_message(zclient);
}
-#ifdef HAVE_IPV6
int
zapi_ipv4_route_ipv6_nexthop (u_char cmd, struct zclient *zclient,
struct prefix_ipv4 *p, struct zapi_ipv6 *api)
@@ -855,12 +855,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);
@@ -879,6 +882,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))
{
@@ -918,7 +928,6 @@ zapi_ipv6_route (u_char cmd, struct zclient *zclient, struct prefix_ipv6 *p,
return zclient_send_message(zclient);
}
-#endif /* HAVE_IPV6 */
/*
* send a ZEBRA_REDISTRIBUTE_ADD or ZEBRA_REDISTRIBUTE_DELETE
@@ -1138,11 +1147,15 @@ struct interface *
zebra_interface_link_params_read (struct stream *s)
{
struct if_link_params *iflp;
- uint32_t ifindex = stream_getl (s);
+ ifindex_t ifindex;
+
+ assert (s);
+
+ ifindex = stream_getl (s);
struct interface *ifp = if_lookup_by_index (ifindex);
- if (ifp == NULL || s == NULL)
+ if (ifp == NULL)
{
zlog_err ("%s: unknown ifindex %u, shouldn't happen",
__func__, ifindex);
@@ -1628,6 +1641,7 @@ zclient_read (struct thread *thread)
case ZEBRA_REDISTRIBUTE_IPV6_DEL:
if (zclient->redistribute_route_ipv6_del)
(*zclient->redistribute_route_ipv6_del) (command, zclient, length, vrf_id);
+ break;
case ZEBRA_INTERFACE_LINK_PARAMS:
if (zclient->interface_link_params)
(*zclient->interface_link_params) (command, zclient, length);