]> git.proxmox.com Git - mirror_frr.git/commitdiff
Merge pull request #1158 from opensourcerouting/ldpd-label-allocation
authorDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 13 Sep 2017 16:24:14 +0000 (12:24 -0400)
committerGitHub <noreply@github.com>
Wed, 13 Sep 2017 16:24:14 +0000 (12:24 -0400)
ldpd label allocation

19 files changed:
bgpd/bgp_attr_evpn.c
bgpd/bgp_clist.c
bgpd/bgp_ecommunity.c
bgpd/bgp_encap_tlv.c
bgpd/bgp_evpn_vty.c
bgpd/bgp_lcommunity.c
bgpd/bgp_nexthop.c
bgpd/bgp_rd.c
bgpd/rfapi/rfapi_import.c
lib/skiplist.c
lib/stream.c
lib/stream.h
ospfd/ospf_opaque.h
zebra/redistribute.c
zebra/zebra_mpls.c
zebra/zebra_rib.c
zebra/zebra_snmp.c
zebra/zebra_vrf.c
zebra/zserv.c

index 6ead059261e635da03fcb3dbbcadbeac1fe8e154..300c9ddb506a4f471a788ba351dfa4af33474986 100644 (file)
@@ -144,11 +144,8 @@ u_int32_t bgp_attr_mac_mobility_seqnum(struct attr *attr, u_char *sticky)
                        *sticky = 0;
 
                pnt++;
-               seq_num = (*pnt++ << 24);
-               seq_num |= (*pnt++ << 16);
-               seq_num |= (*pnt++ << 8);
-               seq_num |= (*pnt++);
-
+               pnt = ptr_get_be32(pnt, &seq_num);
+               (void)pnt; /* consume value */
                return seq_num;
        }
 
index b62a0a540c3ef0412476103a908e390cf79b4bf3..f3bae9535cc92b12200a6cddec2c3f2ac67f0239 100644 (file)
@@ -25,6 +25,7 @@
 #include "memory.h"
 #include "queue.h"
 #include "filter.h"
+#include "stream.h"
 
 #include "bgpd/bgpd.h"
 #include "bgpd/bgp_community.h"
@@ -465,20 +466,10 @@ static char *lcommunity_str_get(struct lcommunity *lcom, int i)
        str = pnt = XMALLOC(MTYPE_LCOMMUNITY_STR, 48);
 
        ptr = (u_char *)lcomval.val;
-       globaladmin = (*ptr++ << 24);
-       globaladmin |= (*ptr++ << 16);
-       globaladmin |= (*ptr++ << 8);
-       globaladmin |= (*ptr++);
-
-       localdata1 = (*ptr++ << 24);
-       localdata1 |= (*ptr++ << 16);
-       localdata1 |= (*ptr++ << 8);
-       localdata1 |= (*ptr++);
-
-       localdata2 = (*ptr++ << 24);
-       localdata2 |= (*ptr++ << 16);
-       localdata2 |= (*ptr++ << 8);
-       localdata2 |= (*ptr++);
+       ptr = ptr_get_be32(ptr, &globaladmin);
+       ptr = ptr_get_be32(ptr, &localdata1);
+       ptr = ptr_get_be32(ptr, &localdata2);
+       (void)ptr; /* consume value */
 
        sprintf(pnt, "%u:%u:%u", globaladmin, localdata1, localdata2);
        pnt += strlen(pnt);
index ec52422d4cf1ae4f0db7c014914fc795561b67aa..897b1c7508c275e371431f502c159d38493549fc 100644 (file)
@@ -27,6 +27,7 @@
 #include "queue.h"
 #include "filter.h"
 #include "jhash.h"
+#include "stream.h"
 
 #include "bgpd/bgpd.h"
 #include "bgpd/bgp_ecommunity.h"
@@ -583,10 +584,7 @@ static int ecommunity_rt_soo_str(char *buf, u_int8_t *pnt, int type,
 
        /* Put string into buffer.  */
        if (type == ECOMMUNITY_ENCODE_AS4) {
-               eas.as = (*pnt++ << 24);
-               eas.as |= (*pnt++ << 16);
-               eas.as |= (*pnt++ << 8);
-               eas.as |= (*pnt++);
+               pnt = ptr_get_be32(pnt, &eas.as);
                eas.val = (*pnt++ << 8);
                eas.val |= (*pnt++);
 
@@ -594,11 +592,7 @@ static int ecommunity_rt_soo_str(char *buf, u_int8_t *pnt, int type,
        } else if (type == ECOMMUNITY_ENCODE_AS) {
                eas.as = (*pnt++ << 8);
                eas.as |= (*pnt++);
-
-               eas.val = (*pnt++ << 24);
-               eas.val |= (*pnt++ << 16);
-               eas.val |= (*pnt++ << 8);
-               eas.val |= (*pnt++);
+               pnt = ptr_get_be32(pnt, &eas.val);
 
                len = sprintf(buf, "%s%u:%u", prefix, eas.as, eas.val);
        } else if (type == ECOMMUNITY_ENCODE_IP) {
@@ -610,6 +604,7 @@ static int ecommunity_rt_soo_str(char *buf, u_int8_t *pnt, int type,
                len = sprintf(buf, "%s%s:%u", prefix, inet_ntoa(eip.ip),
                              eip.val);
        }
+       (void)pnt; /* consume value */
 
        return len;
 }
index 5c0cc40f16c2e35826e69c381f0a91efd57e58f6..4457501613a1b25dde212471c3293a35cebac5bb 100644 (file)
@@ -22,6 +22,7 @@
 #include "memory.h"
 #include "prefix.h"
 #include "filter.h"
+#include "stream.h"
 
 #include "bgpd.h"
 #include "bgp_attr.h"
@@ -470,8 +471,7 @@ static int subtlv_decode_encap_l2tpv3_over_ip(
                return -1;
        }
 
-       st->sessionid = (subtlv->value[0] << 24) | (subtlv->value[1] << 16)
-                       | (subtlv->value[2] << 8) | subtlv->value[3];
+       ptr_get_be32(subtlv->value, &st->sessionid);
        st->cookie_length = subtlv->length - 4;
        if (st->cookie_length > sizeof(st->cookie)) {
                zlog_debug("%s, subtlv length %d is greater than %d", __func__,
@@ -491,8 +491,7 @@ static int subtlv_decode_encap_gre(struct bgp_attr_encap_subtlv *subtlv,
                           subtlv->length);
                return -1;
        }
-       st->gre_key = (subtlv->value[0] << 24) | (subtlv->value[1] << 16)
-                     | (subtlv->value[2] << 8) | subtlv->value[3];
+       ptr_get_be32(subtlv->value, &st->gre_key);
        return 0;
 }
 
@@ -545,8 +544,7 @@ static int subtlv_decode_color(struct bgp_attr_encap_subtlv *subtlv,
                           __func__);
                return -1;
        }
-       st->color = (subtlv->value[4] << 24) | (subtlv->value[5] << 16)
-                   | (subtlv->value[6] << 8) | subtlv->value[7];
+       ptr_get_be32(subtlv->value + 4, &st->color);
        return 0;
 }
 
@@ -580,16 +578,13 @@ subtlv_decode_remote_endpoint(struct bgp_attr_encap_subtlv *subtlv,
        }
        if (subtlv->length == 8) {
                st->family = AF_INET;
-               st->ip_address.v4.s_addr =
-                       ((subtlv->value[0] << 24) | (subtlv->value[1] << 16)
-                        | (subtlv->value[2] << 8) | subtlv->value[3]);
+               memcpy(&st->ip_address.v4.s_addr, subtlv->value, 4);
        } else {
                st->family = AF_INET6;
                memcpy(&(st->ip_address.v6.s6_addr), subtlv->value, 16);
        }
        i = subtlv->length - 4;
-       st->as4 = ((subtlv->value[i] << 24) | (subtlv->value[i + 1] << 16)
-                  | (subtlv->value[i + 2] << 8) | subtlv->value[i + 3]);
+       ptr_get_be32(subtlv->value + i, &st->as4);
        return 0;
 }
 
index 2410f30ddfa65d62e59e1cdeb10e82e0b0858c22..17511827b1b8fcffde582f53b2d7a3a1f48b1fa8 100644 (file)
@@ -22,6 +22,7 @@
 #include "command.h"
 #include "prefix.h"
 #include "lib/json.h"
+#include "stream.h"
 
 #include "bgpd/bgpd.h"
 #include "bgpd/bgp_table.h"
@@ -87,11 +88,7 @@ static void display_import_rt(struct vty *vty, struct irt_node *irt,
        case ECOMMUNITY_ENCODE_AS:
                eas.as = (*pnt++ << 8);
                eas.as |= (*pnt++);
-
-               eas.val = (*pnt++ << 24);
-               eas.val |= (*pnt++ << 16);
-               eas.val |= (*pnt++ << 8);
-               eas.val |= (*pnt++);
+               pnt = ptr_get_be32(pnt, &eas.val);
 
                snprintf(rt_buf, RT_ADDRSTRLEN, "%u:%u", eas.as, eas.val);
 
@@ -119,11 +116,7 @@ static void display_import_rt(struct vty *vty, struct irt_node *irt,
                break;
 
        case ECOMMUNITY_ENCODE_AS4:
-               eas.as = (*pnt++ << 24);
-               eas.as |= (*pnt++ << 16);
-               eas.as |= (*pnt++ << 8);
-               eas.as |= (*pnt++);
-
+               pnt = ptr_get_be32(pnt, &eas.val);
                eas.val = (*pnt++ << 8);
                eas.val |= (*pnt++);
 
index d75f33f58b827cf609ebc2991cf6b6100acf94f7..54e9fd889457757d563c5772a9d56dd6bc66d15b 100644 (file)
@@ -26,6 +26,7 @@
 #include "command.h"
 #include "filter.h"
 #include "jhash.h"
+#include "stream.h"
 
 #include "bgpd/bgpd.h"
 #include "bgpd/bgp_lcommunity.h"
@@ -431,20 +432,10 @@ char *lcommunity_lcom2str(struct lcommunity *lcom, int format)
 
                pnt = lcom->val + (i * LCOMMUNITY_SIZE);
 
-               globaladmin = (*pnt++ << 24);
-               globaladmin |= (*pnt++ << 16);
-               globaladmin |= (*pnt++ << 8);
-               globaladmin |= (*pnt++);
-
-               localdata1 = (*pnt++ << 24);
-               localdata1 |= (*pnt++ << 16);
-               localdata1 |= (*pnt++ << 8);
-               localdata1 |= (*pnt++);
-
-               localdata2 = (*pnt++ << 24);
-               localdata2 |= (*pnt++ << 16);
-               localdata2 |= (*pnt++ << 8);
-               localdata2 |= (*pnt++);
+               pnt = ptr_get_be32(pnt, &globaladmin);
+               pnt = ptr_get_be32(pnt, &localdata1);
+               pnt = ptr_get_be32(pnt, &localdata2);
+               (void)pnt; /* consume value */
 
                len = sprintf(str_buf + str_pnt, "%u:%u:%u", globaladmin,
                              localdata1, localdata2);
index 1200d74d6a59246846d800928bda511c66770993..8c08fe4c8f1ca19d2b56ae8c2e4c9e2f60c59db8 100644 (file)
@@ -580,7 +580,11 @@ DEFUN (show_ip_bgp_nexthop,
        "Show detailed information\n")
 {
        int idx = 0;
-       char *vrf = argv_find(argv, argc, "WORD", &idx) ? argv[idx]->arg : NULL;
+       char *vrf = NULL;
+
+       if (argv_find(argv, argc, "view", &idx)
+           || argv_find(argv, argc, "vrf", &idx))
+               vrf = argv[++idx]->arg;
        int detail = argv_find(argv, argc, "detail", &idx) ? 1 : 0;
        return show_ip_bgp_nexthop_table(vty, vrf, detail);
 }
index a15828bd36a9402194ff82d72ba24b7a0dc97c97..2b676e052b3480b31ac72c2938ff0e69df317918 100644 (file)
@@ -63,21 +63,13 @@ void decode_rd_as(u_char *pnt, struct rd_as *rd_as)
 {
        rd_as->as = (u_int16_t)*pnt++ << 8;
        rd_as->as |= (u_int16_t)*pnt++;
-
-       rd_as->val = ((u_int32_t)*pnt++ << 24);
-       rd_as->val |= ((u_int32_t)*pnt++ << 16);
-       rd_as->val |= ((u_int32_t)*pnt++ << 8);
-       rd_as->val |= (u_int32_t)*pnt;
+       ptr_get_be32(pnt, &rd_as->val);
 }
 
 /* type == RD_TYPE_AS4 */
 void decode_rd_as4(u_char *pnt, struct rd_as *rd_as)
 {
-       rd_as->as = (u_int32_t)*pnt++ << 24;
-       rd_as->as |= (u_int32_t)*pnt++ << 16;
-       rd_as->as |= (u_int32_t)*pnt++ << 8;
-       rd_as->as |= (u_int32_t)*pnt++;
-
+       pnt = ptr_get_be32(pnt, &rd_as->as);
        rd_as->val = ((u_int16_t)*pnt++ << 8);
        rd_as->val |= (u_int16_t)*pnt;
 }
index 3f427c39031ee336ec05c1b44fda998dadc3c392..d963a759ace65927c6d9cc2e8fb04cf0335a46ef 100644 (file)
@@ -33,6 +33,7 @@
 #include "lib/log.h"
 #include "lib/skiplist.h"
 #include "lib/thread.h"
+#include "lib/stream.h"
 
 #include "bgpd/bgpd.h"
 #include "bgpd/bgp_ecommunity.h"
@@ -1079,10 +1080,7 @@ int rfapiEcommunityGetEthernetTag(struct ecommunity *ecom, uint16_t *tag_id)
 
                        if (*p++ == ECOMMUNITY_ROUTE_TARGET) {
                                if (encode == ECOMMUNITY_ENCODE_AS4) {
-                                       as = (*p++ << 24);
-                                       as |= (*p++ << 16);
-                                       as |= (*p++ << 8);
-                                       as |= (*p++);
+                                       p = ptr_get_be32(p, &as);
                                } else if (encode == ECOMMUNITY_ENCODE_AS) {
                                        as = (*p++ << 8);
                                        as |= (*p++);
index 7acc78f563729e7f32aef1cd4074cedab6376b4e..a546bb44c0250ead36af58b7a104b6745d1ce126 100644 (file)
@@ -593,8 +593,8 @@ static void *scramble(int i)
 {
        uintptr_t result;
 
-       result = (i & 0xff) << 24;
-       result |= (i >> 8);
+       result = (unsigned)(i & 0xff) << 24;
+       result |= (unsigned)i >> 8;
 
        return (void *)result;
 }
index 577fa257df53df53b01b6ae83be213986afcfbee..f88689f677c4842f6226c3657c8eb170bb63a21e 100644 (file)
@@ -394,7 +394,7 @@ u_int32_t stream_getl_from(struct stream *s, size_t from)
                return 0;
        }
 
-       l = s->data[from++] << 24;
+       l = (unsigned)(s->data[from++]) << 24;
        l |= s->data[from++] << 16;
        l |= s->data[from++] << 8;
        l |= s->data[from];
@@ -426,7 +426,7 @@ u_int32_t stream_getl(struct stream *s)
                return 0;
        }
 
-       l = s->data[s->getp++] << 24;
+       l = (unsigned)(s->data[s->getp++]) << 24;
        l |= s->data[s->getp++] << 16;
        l |= s->data[s->getp++] << 8;
        l |= s->data[s->getp++];
index 33dd64c4a399eb89ca89bb1f8f9a337b4406565e..7dcdca69f6db8aa0f8dfa03c7fa110937730854d 100644 (file)
@@ -239,4 +239,22 @@ extern struct stream *stream_fifo_head(struct stream_fifo *fifo);
 extern void stream_fifo_clean(struct stream_fifo *fifo);
 extern void stream_fifo_free(struct stream_fifo *fifo);
 
+/* This is here because "<< 24" is particularly problematic in C.
+ * This is because the left operand of << is integer-promoted, which means
+ * an uint8_t gets converted into a *signed* int.  Shifting into the sign
+ * bit of a signed int is theoretically undefined behaviour, so - the left
+ * operand needs to be cast to unsigned.
+ *
+ * This is not a problem for 16- or 8-bit values (they don't reach the sign
+ * bit), for 64-bit values (you need to cast them anyway), and neither for
+ * encoding (because it's downcasted.)
+ */
+static inline uint8_t *ptr_get_be32(uint8_t *ptr, uint32_t *out)
+{
+       uint32_t tmp;
+       memcpy(&tmp, ptr, sizeof(tmp));
+       *out = ntohl(tmp);
+       return ptr + 4;
+}
+
 #endif /* _ZEBRA_STREAM_H */
index 2470cd2e2b2f1d7bb90cf8acb288c1c0a7c0d501..9dc1f92f4dc16ab0decc992dd94c3fdb1405342d 100644 (file)
@@ -46,7 +46,8 @@
 #define GET_OPAQUE_ID(lsid) ((u_int32_t)(lsid)&LSID_OPAQUE_ID_MASK)
 
 #define SET_OPAQUE_LSID(type, id)                                              \
-       ((((type) << 24) & LSID_OPAQUE_TYPE_MASK) | ((id)&LSID_OPAQUE_ID_MASK))
+       ((((unsigned)(type) << 24) & LSID_OPAQUE_TYPE_MASK)                    \
+        | ((id) & LSID_OPAQUE_ID_MASK))
 
 /*
  * Opaque LSA types will be assigned by IANA.
index ce86b6c1e34b15e5782d2289db4822086227fb8c..93bfc0c031d3cdfff332657524e0195ac8e76ad0 100644 (file)
@@ -84,11 +84,13 @@ static void zebra_redistribute_default(struct zserv *client, vrf_id_t vrf_id)
                if (!rn)
                        continue;
 
-               RNODE_FOREACH_RE(rn, newre)
-               if (CHECK_FLAG(newre->flags, ZEBRA_FLAG_SELECTED)
-                   && newre->distance != DISTANCE_INFINITY)
-                       zsend_redistribute_route(ZEBRA_REDISTRIBUTE_ROUTE_ADD,
-                                                client, &rn->p, NULL, newre);
+               RNODE_FOREACH_RE(rn, newre) {
+                       if (CHECK_FLAG(newre->flags, ZEBRA_FLAG_SELECTED)
+                           && newre->distance != DISTANCE_INFINITY)
+                               zsend_redistribute_route(
+                                       ZEBRA_REDISTRIBUTE_ROUTE_ADD,
+                                       client, &rn->p, NULL, newre);
+               }
 
                route_unlock_node(rn);
        }
index 273945778a0413063c08f81b9db2110cf282af48..e3ce414127d77934ba2742bfd35dd027611bfa30 100644 (file)
@@ -2392,15 +2392,20 @@ void mpls_ldp_ftn_uninstall_all(struct zebra_vrf *zvrf, int afi)
 
        for (rn = route_top(table); rn; rn = route_next(rn)) {
                update = 0;
-               RNODE_FOREACH_RE(rn, re)
-               for (nexthop = re->nexthop; nexthop; nexthop = nexthop->next)
-                       if (nexthop->nh_label_type == ZEBRA_LSP_LDP) {
+               RNODE_FOREACH_RE(rn, re) {
+                       for (nexthop = re->nexthop;
+                            nexthop;
+                            nexthop = nexthop->next) {
+                               if (nexthop->nh_label_type != ZEBRA_LSP_LDP)
+                                       continue;
+
                                nexthop_del_labels(nexthop);
                                SET_FLAG(re->status, ROUTE_ENTRY_CHANGED);
                                SET_FLAG(re->status,
                                         ROUTE_ENTRY_LABELS_CHANGED);
                                update = 1;
                        }
+               }
 
                if (update)
                        rib_queue_add(rn);
index c4c80b156b796c9c0188b5e027c6ade99feab422..376425329bfcfc4307bf8c7eeb8b81b8a59e3f56 100644 (file)
@@ -1118,7 +1118,6 @@ static int rib_can_delete_dest(rib_dest_t *dest)
 int rib_gc_dest(struct route_node *rn)
 {
        rib_dest_t *dest;
-       struct zebra_vrf *zvrf;
 
        dest = rib_dest_from_rnode(rn);
        if (!dest)
@@ -1127,9 +1126,12 @@ int rib_gc_dest(struct route_node *rn)
        if (!rib_can_delete_dest(dest))
                return 0;
 
-       zvrf = rib_dest_vrf(dest);
-       if (IS_ZEBRA_DEBUG_RIB)
+       if (IS_ZEBRA_DEBUG_RIB) {
+               struct zebra_vrf *zvrf;
+
+               zvrf = rib_dest_vrf(dest);
                rnode_debug(rn, zvrf_id(zvrf), "removing dest from table");
+       }
 
        dest->rnode = NULL;
        XFREE(MTYPE_RIB_DEST, dest);
@@ -2551,27 +2553,29 @@ static void rib_update_table(struct route_table *table,
                         */
                        RNODE_FOREACH_RE_SAFE(rn, re, next)
                        {
-                               if (re->type == ZEBRA_ROUTE_OSPF
-                                   || re->type == ZEBRA_ROUTE_OSPF6
-                                   || re->type == ZEBRA_ROUTE_BGP)
-                                       continue; /* protocol will handle. */
-                               else if (re->type == ZEBRA_ROUTE_STATIC) {
-                                       struct nexthop *nh;
-                                       for (nh = re->nexthop; nh;
-                                            nh = nh->next)
-                                               if (!(nh->type
-                                                             == NEXTHOP_TYPE_IPV4
-                                                     || nh->type
-                                                                == NEXTHOP_TYPE_IPV6))
-                                                       break;
-
-                                       /* If we only have nexthops to a
-                                        * gateway, NHT will
-                                        * take care.
-                                        */
-                                       if (nh)
-                                               rib_queue_add(rn);
-                               } else
+                               struct nexthop *nh;
+
+                               if (re->type != ZEBRA_ROUTE_SYSTEM &&
+                                   re->type != ZEBRA_ROUTE_KERNEL &&
+                                   re->type != ZEBRA_ROUTE_CONNECT &&
+                                   re->type != ZEBRA_ROUTE_STATIC)
+                                       continue;
+
+                               if (re->type != ZEBRA_ROUTE_STATIC) {
+                                       rib_queue_add(rn);
+                                       continue;
+                               }
+
+                               for (nh = re->nexthop; nh; nh = nh->next)
+                                       if (!(nh->type == NEXTHOP_TYPE_IPV4
+                                             || nh->type == NEXTHOP_TYPE_IPV6))
+                                               break;
+
+                               /* If we only have nexthops to a
+                                * gateway, NHT will
+                                * take care.
+                                */
+                               if (nh)
                                        rib_queue_add(rn);
                        }
                        break;
index 4d6ba566ca90868f051de103ba0b61cedaf577df..9ac24c53ed572d5312e89f7e9819ec6955f44916 100644 (file)
@@ -155,8 +155,9 @@ static u_char *ipFwNumber(struct variable *v, oid objid[], size_t *objid_len,
        /* Return number of routing entries. */
        result = 0;
        for (rn = route_top(table); rn; rn = route_next(rn))
-               RNODE_FOREACH_RE(rn, re)
-       result++;
+               RNODE_FOREACH_RE(rn, re) {
+                       result++;
+               }
 
        return (u_char *)&result;
 }
@@ -182,8 +183,9 @@ static u_char *ipCidrNumber(struct variable *v, oid objid[], size_t *objid_len,
        /* Return number of routing entries. */
        result = 0;
        for (rn = route_top(table); rn; rn = route_next(rn))
-               RNODE_FOREACH_RE(rn, re)
-       result++;
+               RNODE_FOREACH_RE(rn, re) {
+                       result++;
+               }
 
        return (u_char *)&result;
 }
@@ -388,8 +390,9 @@ static void get_fwtable_route_node(struct variable *v, oid objid[],
 
                /* Check destination first */
                if (in_addr_cmp(&np2->p.u.prefix, (u_char *)&dest) > 0)
-                       RNODE_FOREACH_RE(np2, re2)
-               check_replace(np2, re2, np, re);
+                       RNODE_FOREACH_RE(np2, re2) {
+                               check_replace(np2, re2, np, re);
+                       }
 
                if (in_addr_cmp(&np2->p.u.prefix, (u_char *)&dest)
                    == 0) { /* have to look at each re individually */
index 0a26ac6ad79d5ade6c4dd76f364159fa12a27606..62c7d020bc2a239adb6d2dad514ec47133bcf45f 100644 (file)
@@ -290,8 +290,9 @@ static void zebra_rtable_node_cleanup(struct route_table *table,
 {
        struct route_entry *re, *next;
 
-       RNODE_FOREACH_RE_SAFE(node, re, next)
-       rib_unlink(node, re);
+       RNODE_FOREACH_RE_SAFE(node, re, next) {
+               rib_unlink(node, re);
+       }
 
        if (node->info)
                XFREE(MTYPE_RIB_DEST, node->info);
index ef289f3960cf160667af1c838bfb956aa47b4fa2..61a75e156ce4657ada7deabceed12bd16d55c552 100644 (file)
@@ -601,7 +601,7 @@ int zsend_redistribute_route(int cmd, struct zserv *client, struct prefix *p,
        int count = 0;
 
        memset(&api, 0, sizeof(api));
-       api.vrf_id = VRF_DEFAULT;
+       api.vrf_id = re->vrf_id;
        api.type = re->type;
        api.instance = re->instance;
        api.flags = re->flags;