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 0c29b523bf..714888a3f3 100644
--- a/lib/zclient.c
+++ b/lib/zclient.c
@@ -363,6 +363,22 @@ static int zebra_hello_send(struct zclient *zclient)
return 0;
}
+void zclient_send_vrf_label(struct zclient *zclient, vrf_id_t vrf_id, afi_t afi,
+ mpls_label_t label, enum lsp_types_t ltype)
+{
+ struct stream *s;
+
+ s = zclient->obuf;
+ stream_reset(s);
+
+ zclient_create_header(s, ZEBRA_VRF_LABEL, vrf_id);
+ stream_putl(s, label);
+ stream_putc(s, afi);
+ stream_putc(s, ltype);
+ stream_putw_at(s, 0, stream_get_endp(s));
+ zclient_send_message(zclient);
+}
+
/* Send register requests to zebra daemon for the information in a VRF. */
void zclient_send_reg_requests(struct zclient *zclient, vrf_id_t vrf_id)
{
@@ -975,12 +991,11 @@ int zapi_route_encode(u_char cmd, struct stream *s, struct zapi_route *api)
}
stream_putw(s, api->nexthop_num);
- if (api->nexthop_num)
- stream_putl(s, api->nh_vrf_id);
for (i = 0; i < api->nexthop_num; i++) {
api_nh = &api->nexthops[i];
+ stream_putl(s, api_nh->vrf_id);
stream_putc(s, api_nh->type);
switch (api_nh->type) {
case NEXTHOP_TYPE_BLACKHOLE:
@@ -1126,12 +1141,10 @@ int zapi_route_decode(struct stream *s, struct zapi_route *api)
return -1;
}
- if (api->nexthop_num)
- STREAM_GETL(s, api->nh_vrf_id);
-
for (i = 0; i < api->nexthop_num; i++) {
api_nh = &api->nexthops[i];
+ STREAM_GETL(s, api_nh->vrf_id);
STREAM_GETC(s, api_nh->type);
switch (api_nh->type) {
case NEXTHOP_TYPE_BLACKHOLE:
@@ -1217,6 +1230,7 @@ struct nexthop *nexthop_from_zapi_nexthop(struct zapi_nexthop *znh)
struct nexthop *n = nexthop_new();
n->type = znh->type;
+ n->vrf_id = znh->vrf_id;
n->ifindex = znh->ifindex;
n->gate = znh->gate;
@@ -1979,8 +1993,8 @@ int lm_get_label_chunk(struct zclient *zclient, u_char keep,
__func__, *start, *end, keep, response_keep);
}
/* sanity */
- if (*start > *end || *start < MPLS_MIN_UNRESERVED_LABEL
- || *end > MPLS_MAX_UNRESERVED_LABEL) {
+ if (*start > *end || *start < MPLS_LABEL_UNRESERVED_MIN
+ || *end > MPLS_LABEL_UNRESERVED_MAX) {
zlog_err("%s: Invalid Label chunk: %u - %u", __func__, *start,
*end);
return -1;