]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: Save memory when using bgp_path_info_extra and vnc 15266/head
authorDonald Sharp <sharpd@nvidia.com>
Wed, 31 Jan 2024 18:37:25 +0000 (13:37 -0500)
committerDonald Sharp <sharpd@nvidia.com>
Thu, 1 Feb 2024 12:54:35 +0000 (07:54 -0500)
Structure size of bgp_path_info_extra when compiled
with vnc is 184 bytes.  Reduce this size to 72 bytes
when compiled w/ vnc but not necessarily turned
on vnc.

With 2 full bgp feeds this saves aproximately 100mb
when compiling with vnc and not using vnc.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
bgpd/bgp_memory.c
bgpd/bgp_memory.h
bgpd/bgp_route.c
bgpd/bgp_route.h
bgpd/rfapi/rfapi.c
bgpd/rfapi/rfapi_import.c
bgpd/rfapi/rfapi_monitor.c
bgpd/rfapi/rfapi_rib.c
bgpd/rfapi/rfapi_vty.c
bgpd/rfapi/vnc_import_bgp.c

index 38aa4f1c3870f7b8ef5d6df0ef2622ed657a22a6..0764f1ed181d9f6da07dc4381cce52a179a8b6a7 100644 (file)
@@ -42,6 +42,7 @@ DEFINE_MTYPE(BGPD, BGP_ROUTE_EXTRA, "BGP ancillary route info");
 DEFINE_MTYPE(BGPD, BGP_ROUTE_EXTRA_EVPN, "BGP extra info for EVPN");
 DEFINE_MTYPE(BGPD, BGP_ROUTE_EXTRA_FS, "BGP extra info for flowspec");
 DEFINE_MTYPE(BGPD, BGP_ROUTE_EXTRA_VRFLEAK, "BGP extra info for vrf leaking");
+DEFINE_MTYPE(BGPD, BGP_ROUTE_EXTRA_VNC, "BGP extra info for vnc");
 DEFINE_MTYPE(BGPD, BGP_CONN, "BGP connected");
 DEFINE_MTYPE(BGPD, BGP_STATIC, "BGP static");
 DEFINE_MTYPE(BGPD, BGP_ADVERTISE_ATTR, "BGP adv attr");
index 8c9524e2ad010c2e1b983d6a284fa8dab2853e6d..29584cd780543e289371b96cd9473963907d7703 100644 (file)
@@ -38,6 +38,7 @@ DECLARE_MTYPE(BGP_ROUTE_EXTRA);
 DECLARE_MTYPE(BGP_ROUTE_EXTRA_EVPN);
 DECLARE_MTYPE(BGP_ROUTE_EXTRA_FS);
 DECLARE_MTYPE(BGP_ROUTE_EXTRA_VRFLEAK);
+DECLARE_MTYPE(BGP_ROUTE_EXTRA_VNC);
 DECLARE_MTYPE(BGP_CONN);
 DECLARE_MTYPE(BGP_STATIC);
 DECLARE_MTYPE(BGP_ADVERTISE_ATTR);
index 518e848258ff57470b6e3deb21ab6009489847f7..b8d6c660b759caf09d6d64afa68bd0872d897a82 100644 (file)
@@ -263,6 +263,10 @@ void bgp_path_info_extra_free(struct bgp_path_info_extra **extra)
                XFREE(MTYPE_BGP_ROUTE_EXTRA_FS, e->flowspec);
        if (e->vrfleak)
                XFREE(MTYPE_BGP_ROUTE_EXTRA_VRFLEAK, e->vrfleak);
+#ifdef ENABLE_BGP_VNC
+       if (e->vnc)
+               XFREE(MTYPE_BGP_ROUTE_EXTRA_VNC, e->vnc);
+#endif
 
        XFREE(MTYPE_BGP_ROUTE_EXTRA, *extra);
 }
index 18a60341f786daf7ea779f780535be7ac7ef496f..2d82f0f206f743ebb826ee525b09f375ab602cf3 100644 (file)
@@ -193,33 +193,9 @@ struct bgp_path_info_extra_vrfleak {
        struct prefix nexthop_orig;
 };
 
-/* Ancillary information to struct bgp_path_info,
- * used for uncommonly used data (aggregation, MPLS, etc.)
- * and lazily allocated to save memory.
- */
-struct bgp_path_info_extra {
-       /* Pointer to dampening structure.  */
-       struct bgp_damp_info *damp_info;
-
-       /** List of aggregations that suppress this path. */
-       struct list *aggr_suppressors;
-
-       /* Nexthop reachability check.  */
-       uint32_t igpmetric;
-
-       /* MPLS label(s) - VNI(s) for EVPN-VxLAN  */
-       mpls_label_t label[BGP_MAX_LABELS];
-       uint32_t num_labels;
-
-       /* timestamp of the rib installation */
-       time_t bgp_rib_uptime;
-
-       /*For EVPN*/
-       struct bgp_path_info_extra_evpn *evpn;
-
 #ifdef ENABLE_BGP_VNC
+struct bgp_path_info_extra_vnc {
        union {
-
                struct {
                        void *rfapi_handle; /* export: NVE advertising this
                                               route */
@@ -242,8 +218,36 @@ struct bgp_path_info_extra {
                        struct prefix aux_prefix; /* AFI_L2VPN: the IP addr,
                                                     if family set */
                } import;
-
        } vnc;
+};
+#endif
+
+/* Ancillary information to struct bgp_path_info,
+ * used for uncommonly used data (aggregation, MPLS, etc.)
+ * and lazily allocated to save memory.
+ */
+struct bgp_path_info_extra {
+       /* Pointer to dampening structure.  */
+       struct bgp_damp_info *damp_info;
+
+       /** List of aggregations that suppress this path. */
+       struct list *aggr_suppressors;
+
+       /* Nexthop reachability check.  */
+       uint32_t igpmetric;
+
+       /* MPLS label(s) - VNI(s) for EVPN-VxLAN  */
+       mpls_label_t label[BGP_MAX_LABELS];
+       uint32_t num_labels;
+
+       /* timestamp of the rib installation */
+       time_t bgp_rib_uptime;
+
+       /*For EVPN*/
+       struct bgp_path_info_extra_evpn *evpn;
+
+#ifdef ENABLE_BGP_VNC
+       struct bgp_path_info_extra_vnc *vnc;
 #endif
 
        /* For flowspec*/
index a2c86d1eae9d1b7b8f2d517155828b9d1ffb1ce8..382af05c245ac8351757842c1979827933ac5a46 100644 (file)
@@ -366,20 +366,19 @@ void del_vnc_route(struct rfapi_descriptor *rfd,
 
        for (bpi = (bn ? bgp_dest_get_bgp_path_info(bn) : NULL); bpi;
             bpi = bpi->next) {
-
                vnc_zlog_debug_verbose(
                        "%s: trying bpi=%p, bpi->peer=%p, bpi->type=%d, bpi->sub_type=%d, bpi->extra->vnc.export.rfapi_handle=%p, local_pref=%" PRIu64,
                        __func__, bpi, bpi->peer, bpi->type, bpi->sub_type,
-                       (bpi->extra ? bpi->extra->vnc.export.rfapi_handle
+                       (bpi->extra ? bpi->extra->vnc->vnc.export.rfapi_handle
                                    : NULL),
                        CHECK_FLAG(bpi->attr->flag,
                                   ATTR_FLAG_BIT(BGP_ATTR_LOCAL_PREF)
-                                  ? bpi->attr->local_pref : 0));
-
-               if (bpi->peer == peer && bpi->type == type
-                   && bpi->sub_type == sub_type && bpi->extra
-                   && bpi->extra->vnc.export.rfapi_handle == (void *)rfd) {
+                                          ? bpi->attr->local_pref
+                                          : 0));
 
+               if (bpi->peer == peer && bpi->type == type &&
+                   bpi->sub_type == sub_type && bpi->extra &&
+                   bpi->extra->vnc->vnc.export.rfapi_handle == (void *)rfd) {
                        vnc_zlog_debug_verbose("%s: matched it", __func__);
 
                        break;
@@ -392,8 +391,8 @@ void del_vnc_route(struct rfapi_descriptor *rfd,
                 * route. Leave the route itself in place.
                 * TBD add return code reporting of success/failure
                 */
-               if (!bpi || !bpi->extra
-                   || !bpi->extra->vnc.export.local_nexthops) {
+               if (!bpi || !bpi->extra ||
+                   !bpi->extra->vnc->vnc.export.local_nexthops) {
                        /*
                         * no local nexthops
                         */
@@ -409,16 +408,16 @@ void del_vnc_route(struct rfapi_descriptor *rfd,
                struct listnode *node;
                struct rfapi_nexthop *pLnh = NULL;
 
-               for (ALL_LIST_ELEMENTS_RO(bpi->extra->vnc.export.local_nexthops,
+               for (ALL_LIST_ELEMENTS_RO(bpi->extra->vnc->vnc.export
+                                                 .local_nexthops,
                                          node, pLnh)) {
-
                        if (prefix_same(&pLnh->addr, &lnh->addr)) {
                                break;
                        }
                }
 
                if (pLnh) {
-                       listnode_delete(bpi->extra->vnc.export.local_nexthops,
+                       listnode_delete(bpi->extra->vnc->vnc.export.local_nexthops,
                                        pLnh);
 
                        /* silly rabbit, listnode_delete doesn't invoke
@@ -459,8 +458,8 @@ void del_vnc_route(struct rfapi_descriptor *rfd,
                /*
                 * Delete local_nexthops list
                 */
-               if (bpi->extra && bpi->extra->vnc.export.local_nexthops)
-                       list_delete(&bpi->extra->vnc.export.local_nexthops);
+               if (bpi->extra && bpi->extra->vnc->vnc.export.local_nexthops)
+                       list_delete(&bpi->extra->vnc->vnc.export.local_nexthops);
 
                bgp_aggregate_decrement(bgp, p, bpi, afi, safi);
                bgp_path_info_delete(bn, bpi);
@@ -902,11 +901,10 @@ void add_vnc_route(struct rfapi_descriptor *rfd, /* cookie, VPN UN addr, peer */
         */
        for (bpi = bgp_dest_get_bgp_path_info(bn); bpi; bpi = bpi->next) {
                /* probably only need to check
-                * bpi->extra->vnc.export.rfapi_handle */
-               if (bpi->peer == rfd->peer && bpi->type == type
-                   && bpi->sub_type == sub_type && bpi->extra
-                   && bpi->extra->vnc.export.rfapi_handle == (void *)rfd) {
-
+                * bpi->extra->vnc->vnc.export.rfapi_handle */
+               if (bpi->peer == rfd->peer && bpi->type == type &&
+                   bpi->sub_type == sub_type && bpi->extra &&
+                   bpi->extra->vnc->vnc.export.rfapi_handle == (void *)rfd) {
                        break;
                }
        }
@@ -918,11 +916,11 @@ void add_vnc_route(struct rfapi_descriptor *rfd, /* cookie, VPN UN addr, peer */
                 * what is advertised via BGP
                 */
                if (lnh) {
-                       if (!bpi->extra->vnc.export.local_nexthops) {
+                       if (!bpi->extra->vnc->vnc.export.local_nexthops) {
                                /* TBD make arrangements to free when needed */
-                               bpi->extra->vnc.export.local_nexthops =
+                               bpi->extra->vnc->vnc.export.local_nexthops =
                                        list_new();
-                               bpi->extra->vnc.export.local_nexthops->del =
+                               bpi->extra->vnc->vnc.export.local_nexthops->del =
                                        rfapi_nexthop_free;
                        }
 
@@ -932,10 +930,9 @@ void add_vnc_route(struct rfapi_descriptor *rfd, /* cookie, VPN UN addr, peer */
                        struct listnode *node;
                        struct rfapi_nexthop *pLnh = NULL;
 
-                       for (ALL_LIST_ELEMENTS_RO(
-                                    bpi->extra->vnc.export.local_nexthops,
-                                    node, pLnh)) {
-
+                       for (ALL_LIST_ELEMENTS_RO(bpi->extra->vnc->vnc.export
+                                                         .local_nexthops,
+                                                 node, pLnh)) {
                                if (prefix_same(&pLnh->addr, &lnh->addr)) {
                                        break;
                                }
@@ -946,9 +943,9 @@ void add_vnc_route(struct rfapi_descriptor *rfd, /* cookie, VPN UN addr, peer */
                         */
                        if (!pLnh) {
                                pLnh = rfapi_nexthop_new(lnh);
-                               listnode_add(
-                                       bpi->extra->vnc.export.local_nexthops,
-                                       pLnh);
+                               listnode_add(bpi->extra->vnc->vnc.export
+                                                    .local_nexthops,
+                                            pLnh);
                        }
                }
 
@@ -1020,7 +1017,9 @@ void add_vnc_route(struct rfapi_descriptor *rfd, /* cookie, VPN UN addr, peer */
 
        /* save backref to rfapi handle */
        bgp_path_info_extra_get(new);
-       new->extra->vnc.export.rfapi_handle = (void *)rfd;
+       new->extra->vnc = XCALLOC(MTYPE_BGP_ROUTE_EXTRA_VNC,
+                                 sizeof(struct bgp_path_info_extra_vnc));
+       new->extra->vnc->vnc.export.rfapi_handle = (void *)rfd;
        encode_label(label_val, &new->extra->label[0]);
 
        /* debug */
index f9789adad259d8a9073e9539c618ff982818fb15..168b8e4c1e2e37592eb8b0c13fb9276325c4455f 100644 (file)
@@ -397,18 +397,22 @@ int rfapiGetUnAddrOfVpnBi(struct bgp_path_info *bpi, struct prefix *p)
         * advertisement
         */
        if (bpi->extra) {
-               switch (bpi->extra->vnc.import.un_family) {
+               switch (bpi->extra->vnc->vnc.import.un_family) {
                case AF_INET:
                        if (p) {
-                               p->family = bpi->extra->vnc.import.un_family;
-                               p->u.prefix4 = bpi->extra->vnc.import.un.addr4;
+                               p->family =
+                                       bpi->extra->vnc->vnc.import.un_family;
+                               p->u.prefix4 =
+                                       bpi->extra->vnc->vnc.import.un.addr4;
                                p->prefixlen = IPV4_MAX_BITLEN;
                        }
                        return 0;
                case AF_INET6:
                        if (p) {
-                               p->family = bpi->extra->vnc.import.un_family;
-                               p->u.prefix6 = bpi->extra->vnc.import.un.addr6;
+                               p->family =
+                                       bpi->extra->vnc->vnc.import.un_family;
+                               p->u.prefix6 =
+                                       bpi->extra->vnc->vnc.import.un.addr6;
                                p->prefixlen = IPV6_MAX_BITLEN;
                        }
                        return 0;
@@ -444,9 +448,11 @@ static struct bgp_path_info *rfapiBgpInfoCreate(struct attr *attr,
        new->attr = bgp_attr_intern(attr);
 
        bgp_path_info_extra_get(new);
+       new->extra->vnc = XCALLOC(MTYPE_BGP_ROUTE_EXTRA_VNC,
+                                 sizeof(struct bgp_path_info_extra_vnc));
        if (prd) {
-               new->extra->vnc.import.rd = *prd;
-               new->extra->vnc.import.create_time = monotime(NULL);
+               new->extra->vnc->vnc.import.rd = *prd;
+               new->extra->vnc->vnc.import.create_time = monotime(NULL);
        }
        if (label)
                encode_label(*label, &new->extra->label[0]);
@@ -811,13 +817,13 @@ static void rfapiBgpInfoChainFree(struct bgp_path_info *bpi)
                 * If there is a timer waiting to delete this bpi, cancel
                 * the timer and delete immediately
                 */
-               if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED)
-                   && bpi->extra->vnc.import.timer) {
+               if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED) &&
+                   bpi->extra->vnc->vnc.import.timer) {
                        struct rfapi_withdraw *wcb =
-                               EVENT_ARG(bpi->extra->vnc.import.timer);
+                               EVENT_ARG(bpi->extra->vnc->vnc.import.timer);
 
                        XFREE(MTYPE_RFAPI_WITHDRAW, wcb);
-                       EVENT_OFF(bpi->extra->vnc.import.timer);
+                       EVENT_OFF(bpi->extra->vnc->vnc.import.timer);
                }
 
                next = bpi->next;
@@ -1105,15 +1111,15 @@ static int rfapiVpnBiSamePtUn(struct bgp_path_info *bpi1,
         */
        if (rfapiGetVncTunnelUnAddr(bpi1->attr, &pfx_un1)) {
                if (bpi1->extra) {
-                       pfx_un1.family = bpi1->extra->vnc.import.un_family;
-                       switch (bpi1->extra->vnc.import.un_family) {
+                       pfx_un1.family = bpi1->extra->vnc->vnc.import.un_family;
+                       switch (bpi1->extra->vnc->vnc.import.un_family) {
                        case AF_INET:
                                pfx_un1.u.prefix4 =
-                                       bpi1->extra->vnc.import.un.addr4;
+                                       bpi1->extra->vnc->vnc.import.un.addr4;
                                break;
                        case AF_INET6:
                                pfx_un1.u.prefix6 =
-                                       bpi1->extra->vnc.import.un.addr6;
+                                       bpi1->extra->vnc->vnc.import.un.addr6;
                                break;
                        default:
                                pfx_un1.family = AF_UNSPEC;
@@ -1124,15 +1130,15 @@ static int rfapiVpnBiSamePtUn(struct bgp_path_info *bpi1,
 
        if (rfapiGetVncTunnelUnAddr(bpi2->attr, &pfx_un2)) {
                if (bpi2->extra) {
-                       pfx_un2.family = bpi2->extra->vnc.import.un_family;
-                       switch (bpi2->extra->vnc.import.un_family) {
+                       pfx_un2.family = bpi2->extra->vnc->vnc.import.un_family;
+                       switch (bpi2->extra->vnc->vnc.import.un_family) {
                        case AF_INET:
                                pfx_un2.u.prefix4 =
-                                       bpi2->extra->vnc.import.un.addr4;
+                                       bpi2->extra->vnc->vnc.import.un.addr4;
                                break;
                        case AF_INET6:
                                pfx_un2.u.prefix6 =
-                                       bpi2->extra->vnc.import.un.addr6;
+                                       bpi2->extra->vnc->vnc.import.un.addr6;
                                break;
                        default:
                                pfx_un2.family = AF_UNSPEC;
@@ -1237,9 +1243,8 @@ rfapiRouteInfo2NextHopEntry(struct rfapi_ip_prefix *rprefix,
 
        new->prefix = *rprefix;
 
-       if (bpi->extra
-           && decode_rd_type(bpi->extra->vnc.import.rd.val)
-                      == RD_TYPE_VNC_ETH) {
+       if (bpi->extra && decode_rd_type(bpi->extra->vnc->vnc.import.rd.val) ==
+                                 RD_TYPE_VNC_ETH) {
                /* ethernet */
 
                struct rfapi_vn_option *vo;
@@ -1258,7 +1263,8 @@ rfapiRouteInfo2NextHopEntry(struct rfapi_ip_prefix *rprefix,
                        &vo->v.l2addr.tag_id);
 
                /* local_nve_id comes from lower byte of RD type */
-               vo->v.l2addr.local_nve_id = bpi->extra->vnc.import.rd.val[1];
+               vo->v.l2addr.local_nve_id =
+                       bpi->extra->vnc->vnc.import.rd.val[1];
 
                /* label comes from MP_REACH_NLRI label */
                vo->v.l2addr.label = decode_label(&bpi->extra->label[0]);
@@ -1269,8 +1275,9 @@ rfapiRouteInfo2NextHopEntry(struct rfapi_ip_prefix *rprefix,
                 * If there is an auxiliary prefix (i.e., host IP address),
                 * use it as the nexthop prefix instead of the query prefix
                 */
-               if (bpi->extra->vnc.import.aux_prefix.family) {
-                       rfapiQprefix2Rprefix(&bpi->extra->vnc.import.aux_prefix,
+               if (bpi->extra->vnc->vnc.import.aux_prefix.family) {
+                       rfapiQprefix2Rprefix(&bpi->extra->vnc->vnc.import
+                                                     .aux_prefix,
                                             &new->prefix);
                }
        }
@@ -1371,15 +1378,16 @@ rfapiRouteInfo2NextHopEntry(struct rfapi_ip_prefix *rprefix,
                /*
                 * use cached UN address from ENCAP route
                 */
-               new->un_address.addr_family = bpi->extra->vnc.import.un_family;
+               new->un_address.addr_family =
+                       bpi->extra->vnc->vnc.import.un_family;
                switch (new->un_address.addr_family) {
                case AF_INET:
                        new->un_address.addr.v4 =
-                               bpi->extra->vnc.import.un.addr4;
+                               bpi->extra->vnc->vnc.import.un.addr4;
                        break;
                case AF_INET6:
                        new->un_address.addr.v6 =
-                               bpi->extra->vnc.import.un.addr6;
+                               bpi->extra->vnc->vnc.import.un.addr6;
                        break;
                default:
                        zlog_warn("%s: invalid UN addr family (%d) for bpi %p",
@@ -1506,7 +1514,7 @@ static int rfapiNhlAddNodeRoutes(
                if (is_l2) {
                        /* L2 routes: semantic nexthop in aux_prefix; VN addr
                         * ain't it */
-                       pfx_vn = bpi->extra->vnc.import.aux_prefix;
+                       pfx_vn = bpi->extra->vnc->vnc.import.aux_prefix;
                } else {
                        rfapiNexthop2Prefix(bpi->attr, &pfx_vn);
                }
@@ -1980,9 +1988,10 @@ static int rfapi_bi_peer_rd_cmp(const void *b1, const void *b2)
        /*
         * compare RDs
         */
-       return vnc_prefix_cmp(
-               (const struct prefix *)&bpi1->extra->vnc.import.rd,
-               (const struct prefix *)&bpi2->extra->vnc.import.rd);
+       return vnc_prefix_cmp((const struct prefix *)&bpi1->extra->vnc->vnc
+                                     .import.rd,
+                             (const struct prefix *)&bpi2->extra->vnc->vnc
+                                     .import.rd);
 }
 
 /*
@@ -2007,8 +2016,8 @@ static int rfapi_bi_peer_rd_aux_cmp(const void *b1, const void *b2)
        /*
         * compare RDs
         */
-       rc = vnc_prefix_cmp((struct prefix *)&bpi1->extra->vnc.import.rd,
-                           (struct prefix *)&bpi2->extra->vnc.import.rd);
+       rc = vnc_prefix_cmp((struct prefix *)&bpi1->extra->vnc->vnc.import.rd,
+                           (struct prefix *)&bpi2->extra->vnc->vnc.import.rd);
        if (rc) {
                return rc;
        }
@@ -2025,19 +2034,18 @@ static int rfapi_bi_peer_rd_aux_cmp(const void *b1, const void *b2)
         * because there is no guarantee of the order the test key and
         * the real key will be passed)
         */
-       if ((bpi1->extra->vnc.import.aux_prefix.family == AF_ETHERNET
-            && (bpi1->extra->vnc.import.aux_prefix.prefixlen == 1))
-           || (bpi2->extra->vnc.import.aux_prefix.family == AF_ETHERNET
-               && (bpi2->extra->vnc.import.aux_prefix.prefixlen == 1))) {
-
+       if ((bpi1->extra->vnc->vnc.import.aux_prefix.family == AF_ETHERNET &&
+            (bpi1->extra->vnc->vnc.import.aux_prefix.prefixlen == 1)) ||
+           (bpi2->extra->vnc->vnc.import.aux_prefix.family == AF_ETHERNET &&
+            (bpi2->extra->vnc->vnc.import.aux_prefix.prefixlen == 1))) {
                /*
                 * wildcard aux address specified
                 */
                return 0;
        }
 
-       return vnc_prefix_cmp(&bpi1->extra->vnc.import.aux_prefix,
-                             &bpi2->extra->vnc.import.aux_prefix);
+       return vnc_prefix_cmp(&bpi1->extra->vnc->vnc.import.aux_prefix,
+                             &bpi2->extra->vnc->vnc.import.aux_prefix);
 }
 
 
@@ -2055,7 +2063,7 @@ static void rfapiItBiIndexAdd(struct agg_node *rn, /* Import table VPN node */
        assert(bpi->extra);
 
        vnc_zlog_debug_verbose("%s: bpi %p, peer %p, rd %pRDP", __func__, bpi,
-                              bpi->peer, &bpi->extra->vnc.import.rd);
+                              bpi->peer, &bpi->extra->vnc->vnc.import.rd);
 
        sl = RFAPI_RDINDEX_W_ALLOC(rn);
        if (!sl) {
@@ -2092,11 +2100,10 @@ static void rfapiItBiIndexDump(struct agg_node *rn)
                char buf[RD_ADDRSTRLEN];
                char buf_aux_pfx[PREFIX_STRLEN];
 
-               prefix_rd2str(
-                       &k->extra->vnc.import.rd, buf, sizeof(buf),
-                       bgp_get_asnotation(k->peer ? k->peer->bgp : NULL));
-               if (k->extra->vnc.import.aux_prefix.family) {
-                       prefix2str(&k->extra->vnc.import.aux_prefix,
+               prefix_rd2str(&k->extra->vnc->vnc.import.rd, buf, sizeof(buf),
+                             bgp_get_asnotation(k->peer ? k->peer->bgp : NULL));
+               if (k->extra->vnc->vnc.import.aux_prefix.family) {
+                       prefix2str(&k->extra->vnc->vnc.import.aux_prefix,
                                   buf_aux_pfx, sizeof(buf_aux_pfx));
                } else
                        strlcpy(buf_aux_pfx, "(none)", sizeof(buf_aux_pfx));
@@ -2115,6 +2122,7 @@ static struct bgp_path_info *rfapiItBiIndexSearch(
        int rc;
        struct bgp_path_info bpi_fake = {0};
        struct bgp_path_info_extra bpi_extra = {0};
+       struct bgp_path_info_extra_vnc bpi_extra_vnc = { 0 };
        struct bgp_path_info *bpi_result;
 
        sl = RFAPI_RDINDEX(rn);
@@ -2147,27 +2155,25 @@ static struct bgp_path_info *rfapiItBiIndexSearch(
                for (bpi_result = rn->info; bpi_result;
                     bpi_result = bpi_result->next) {
 #ifdef DEBUG_BI_SEARCH
-                       vnc_zlog_debug_verbose(
-                               "%s: bpi has prd=%pRDP, peer=%p", __func__,
-                               &bpi_result->extra->vnc.import.rd,
-                               bpi_result->peer);
+                       vnc_zlog_debug_verbose("%s: bpi has prd=%pRDP, peer=%p",
+                                              __func__,
+                                              &bpi_result->extra->vnc->vnc
+                                                       .import.rd,
+                                              bpi_result->peer);
 #endif
-                       if (peer == bpi_result->peer
-                           && !prefix_cmp((struct prefix *)&bpi_result->extra
-                                                  ->vnc.import.rd,
-                                          (struct prefix *)prd)) {
-
+                       if (peer == bpi_result->peer &&
+                           !prefix_cmp((struct prefix *)&bpi_result->extra->vnc
+                                               ->vnc.import.rd,
+                                       (struct prefix *)prd)) {
 #ifdef DEBUG_BI_SEARCH
                                vnc_zlog_debug_verbose(
                                        "%s: peer and RD same, doing aux_prefix check",
                                        __func__);
 #endif
-                               if (!aux_prefix
-                                   || !prefix_cmp(
-                                              aux_prefix,
-                                              &bpi_result->extra->vnc.import
-                                                       .aux_prefix)) {
-
+                               if (!aux_prefix ||
+                                   !prefix_cmp(aux_prefix,
+                                               &bpi_result->extra->vnc->vnc
+                                                        .import.aux_prefix)) {
 #ifdef DEBUG_BI_SEARCH
                                        vnc_zlog_debug_verbose("%s: match",
                                                               __func__);
@@ -2181,13 +2187,14 @@ static struct bgp_path_info *rfapiItBiIndexSearch(
 
        bpi_fake.peer = peer;
        bpi_fake.extra = &bpi_extra;
-       bpi_fake.extra->vnc.import.rd = *prd;
+       bpi_fake.extra->vnc = &bpi_extra_vnc;
+       bpi_fake.extra->vnc->vnc.import.rd = *prd;
        if (aux_prefix) {
-               bpi_fake.extra->vnc.import.aux_prefix = *aux_prefix;
+               bpi_fake.extra->vnc->vnc.import.aux_prefix = *aux_prefix;
        } else {
                /* wildcard */
-               bpi_fake.extra->vnc.import.aux_prefix.family = AF_ETHERNET;
-               bpi_fake.extra->vnc.import.aux_prefix.prefixlen = 1;
+               bpi_fake.extra->vnc->vnc.import.aux_prefix.family = AF_ETHERNET;
+               bpi_fake.extra->vnc->vnc.import.aux_prefix.prefixlen = 1;
        }
 
        rc = skiplist_search(sl, (void *)&bpi_fake, (void *)&bpi_result);
@@ -2213,7 +2220,7 @@ static void rfapiItBiIndexDel(struct agg_node *rn, /* Import table VPN node */
        int rc;
 
        vnc_zlog_debug_verbose("%s: bpi %p, peer %p, rd %pRDP", __func__, bpi,
-                              bpi->peer, &bpi->extra->vnc.import.rd);
+                              bpi->peer, &bpi->extra->vnc->vnc.import.rd);
 
        sl = RFAPI_RDINDEX(rn);
        assert(sl);
@@ -2261,11 +2268,10 @@ rfapiMonitorEncapAdd(struct rfapi_import_table *import_table,
        RFAPI_MONITOR_ENCAP_W_ALLOC(rn) = m;
 
        /* for easy lookup when deleting vpn route */
-       vpn_bpi->extra->vnc.import.hme = m;
+       vpn_bpi->extra->vnc->vnc.import.hme = m;
 
-       vnc_zlog_debug_verbose(
-               "%s: it=%p, vpn_bpi=%p, afi=%d, encap rn=%p, setting vpn_bpi->extra->vnc.import.hme=%p",
-               __func__, import_table, vpn_bpi, afi, rn, m);
+       vnc_zlog_debug_verbose("%s: it=%p, vpn_bpi=%p, afi=%d, encap rn=%p, setting vpn_bpi->extra->vnc->vnc.import.hme=%p",
+                              __func__, import_table, vpn_bpi, afi, rn, m);
 
        RFAPI_CHECK_REFCOUNT(rn, SAFI_ENCAP, 0);
        bgp_attr_intern(vpn_bpi->attr);
@@ -2279,7 +2285,7 @@ static void rfapiMonitorEncapDelete(struct bgp_path_info *vpn_bpi)
        vnc_zlog_debug_verbose("%s: vpn_bpi=%p", __func__, vpn_bpi);
        if (vpn_bpi->extra) {
                struct rfapi_monitor_encap *hme =
-                       vpn_bpi->extra->vnc.import.hme;
+                       vpn_bpi->extra->vnc->vnc.import.hme;
 
                if (hme) {
 
@@ -2303,7 +2309,7 @@ static void rfapiMonitorEncapDelete(struct bgp_path_info *vpn_bpi)
 
                        agg_unlock_node(hme->rn); /* decr ref count */
                        XFREE(MTYPE_RFAPI_MONITOR_ENCAP, hme);
-                       vpn_bpi->extra->vnc.import.hme = NULL;
+                       vpn_bpi->extra->vnc->vnc.import.hme = NULL;
                }
        }
 }
@@ -2542,21 +2548,21 @@ static void rfapiCopyUnEncap2VPN(struct bgp_path_info *encap_bpi,
                vnc_zlog_debug_verbose("%s: vpn_bpi->extra=%p", __func__,
                                       vpn_bpi->extra);
 
-               vpn_bpi->extra->vnc.import.un_family = AF_INET;
-               vpn_bpi->extra->vnc.import.un.addr4 =
+               vpn_bpi->extra->vnc->vnc.import.un_family = AF_INET;
+               vpn_bpi->extra->vnc->vnc.import.un.addr4 =
                        encap_bpi->attr->mp_nexthop_global_in;
                break;
 
        case AF_INET6:
-               vpn_bpi->extra->vnc.import.un_family = AF_INET6;
-               vpn_bpi->extra->vnc.import.un.addr6 =
+               vpn_bpi->extra->vnc->vnc.import.un_family = AF_INET6;
+               vpn_bpi->extra->vnc->vnc.import.un.addr6 =
                        encap_bpi->attr->mp_nexthop_global;
                break;
 
        default:
                zlog_warn("%s: invalid encap nexthop length: %d", __func__,
                          encap_bpi->attr->mp_nexthop_len);
-               vpn_bpi->extra->vnc.import.un_family = AF_UNSPEC;
+               vpn_bpi->extra->vnc->vnc.import.un_family = AF_UNSPEC;
                break;
        }
 }
@@ -2581,9 +2587,9 @@ rfapiWithdrawEncapUpdateCachedUn(struct rfapi_import_table *import_table,
                                __func__);
                        return 1;
                }
-               vpn_bpi->extra->vnc.import.un_family = AF_UNSPEC;
-               memset(&vpn_bpi->extra->vnc.import.un, 0,
-                      sizeof(vpn_bpi->extra->vnc.import.un));
+               vpn_bpi->extra->vnc->vnc.import.un_family = AF_UNSPEC;
+               memset(&vpn_bpi->extra->vnc->vnc.import.un, 0,
+                      sizeof(vpn_bpi->extra->vnc->vnc.import.un));
                if (CHECK_FLAG(vpn_bpi->flags, BGP_PATH_VALID)) {
                        if (rfapiGetVncTunnelUnAddr(vpn_bpi->attr, NULL)) {
                                UNSET_FLAG(vpn_bpi->flags, BGP_PATH_VALID);
@@ -2754,9 +2760,9 @@ rfapiBiStartWithdrawTimer(struct rfapi_import_table *import_table,
        assert(bpi->extra);
        if (lifetime > UINT32_MAX / 1001) {
                /* sub-optimal case, but will probably never happen */
-               bpi->extra->vnc.import.timer = NULL;
+               bpi->extra->vnc->vnc.import.timer = NULL;
                event_add_timer(bm->master, timer_service_func, wcb, lifetime,
-                               &bpi->extra->vnc.import.timer);
+                               &bpi->extra->vnc->vnc.import.timer);
        } else {
                static uint32_t jitter;
                uint32_t lifetime_msec;
@@ -2770,10 +2776,10 @@ rfapiBiStartWithdrawTimer(struct rfapi_import_table *import_table,
 
                lifetime_msec = (lifetime * 1000) + jitter;
 
-               bpi->extra->vnc.import.timer = NULL;
+               bpi->extra->vnc->vnc.import.timer = NULL;
                event_add_timer_msec(bm->master, timer_service_func, wcb,
                                     lifetime_msec,
-                                    &bpi->extra->vnc.import.timer);
+                                    &bpi->extra->vnc->vnc.import.timer);
        }
 
        /* re-sort route list (BGP_PATH_REMOVED routes are last) */
@@ -2986,17 +2992,16 @@ static void rfapiBgpInfoFilteredImportEncap(
                         * Compare RDs
                         *
                         * RD of import table bpi is in
-                        * bpi->extra->vnc.import.rd RD of info_orig is in prd
+                        * bpi->extra->vnc->vnc.import.rd RD of info_orig is in prd
                         */
                        if (!bpi->extra) {
                                vnc_zlog_debug_verbose("%s: no bpi->extra",
                                                       __func__);
                                continue;
                        }
-                       if (prefix_cmp(
-                                   (struct prefix *)&bpi->extra->vnc.import.rd,
-                                   (struct prefix *)prd)) {
-
+                       if (prefix_cmp((struct prefix *)&bpi->extra->vnc->vnc
+                                              .import.rd,
+                                      (struct prefix *)prd)) {
                                vnc_zlog_debug_verbose("%s: prd does not match",
                                                       __func__);
                                continue;
@@ -3040,13 +3045,14 @@ static void rfapiBgpInfoFilteredImportEncap(
                                 * a previous withdraw, we must cancel its
                                 * timer.
                                 */
-                               if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED)
-                                   && bpi->extra->vnc.import.timer) {
+                               if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED) &&
+                                   bpi->extra->vnc->vnc.import.timer) {
                                        struct rfapi_withdraw *wcb = EVENT_ARG(
-                                               bpi->extra->vnc.import.timer);
+                                               bpi->extra->vnc->vnc.import.timer);
 
                                        XFREE(MTYPE_RFAPI_WITHDRAW, wcb);
-                                       EVENT_OFF(bpi->extra->vnc.import.timer);
+                                       EVENT_OFF(bpi->extra->vnc->vnc.import
+                                                         .timer);
                                }
 
                                if (action == FIF_ACTION_UPDATE) {
@@ -3132,12 +3138,12 @@ static void rfapiBgpInfoFilteredImportEncap(
                vnc_zlog_debug_verbose(
                        "%s: removing holddown bpi matching NVE of new route",
                        __func__);
-               if (bpi->extra->vnc.import.timer) {
+               if (bpi->extra->vnc->vnc.import.timer) {
                        struct rfapi_withdraw *wcb =
-                               EVENT_ARG(bpi->extra->vnc.import.timer);
+                               EVENT_ARG(bpi->extra->vnc->vnc.import.timer);
 
                        XFREE(MTYPE_RFAPI_WITHDRAW, wcb);
-                       EVENT_OFF(bpi->extra->vnc.import.timer);
+                       EVENT_OFF(bpi->extra->vnc->vnc.import.timer);
                }
                rfapiExpireEncapNow(import_table, rn, bpi);
        }
@@ -3492,13 +3498,14 @@ void rfapiBgpInfoFilteredImportVPN(
                                 * a previous withdraw, we must cancel its
                                 * timer.
                                 */
-                               if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED)
-                                   && bpi->extra->vnc.import.timer) {
+                               if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED) &&
+                                   bpi->extra->vnc->vnc.import.timer) {
                                        struct rfapi_withdraw *wcb = EVENT_ARG(
-                                               bpi->extra->vnc.import.timer);
+                                               bpi->extra->vnc->vnc.import.timer);
 
                                        XFREE(MTYPE_RFAPI_WITHDRAW, wcb);
-                                       EVENT_OFF(bpi->extra->vnc.import.timer);
+                                       EVENT_OFF(bpi->extra->vnc->vnc.import
+                                                         .timer);
 
                                        import_table->holddown_count[afi] -= 1;
                                        RFAPI_UPDATE_ITABLE_COUNT(
@@ -3571,7 +3578,7 @@ void rfapiBgpInfoFilteredImportVPN(
                /* Not a big deal, just means VPN route got here first */
                vnc_zlog_debug_verbose("%s: no encap route for vn addr %pFX",
                                       __func__, &vn_prefix);
-               info_new->extra->vnc.import.un_family = AF_UNSPEC;
+               info_new->extra->vnc->vnc.import.un_family = AF_UNSPEC;
        }
 
        if (rn) {
@@ -3593,7 +3600,7 @@ void rfapiBgpInfoFilteredImportVPN(
 
                vnc_zlog_debug_verbose("%s: setting BPI's aux_prefix",
                                       __func__);
-               info_new->extra->vnc.import.aux_prefix = *aux_prefix;
+               info_new->extra->vnc->vnc.import.aux_prefix = *aux_prefix;
        }
 
        vnc_zlog_debug_verbose("%s: inserting bpi %p at prefix %pRN #%d",
@@ -3711,12 +3718,12 @@ void rfapiBgpInfoFilteredImportVPN(
                vnc_zlog_debug_verbose(
                        "%s: removing holddown bpi matching NVE of new route",
                        __func__);
-               if (bpi->extra->vnc.import.timer) {
+               if (bpi->extra->vnc->vnc.import.timer) {
                        struct rfapi_withdraw *wcb =
-                               EVENT_ARG(bpi->extra->vnc.import.timer);
+                               EVENT_ARG(bpi->extra->vnc->vnc.import.timer);
 
                        XFREE(MTYPE_RFAPI_WITHDRAW, wcb);
-                       EVENT_OFF(bpi->extra->vnc.import.timer);
+                       EVENT_OFF(bpi->extra->vnc->vnc.import.timer);
                }
                rfapiExpireVpnNow(import_table, rn, bpi, 0);
        }
@@ -4448,12 +4455,10 @@ static void rfapiDeleteRemotePrefixesIt(
                                if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED)) {
                                        if (!delete_holddown)
                                                continue;
-                                       if (bpi->extra->vnc.import.timer) {
-                                               struct rfapi_withdraw *wcb =
-                                                       EVENT_ARG(
-                                                               bpi->extra->vnc
-                                                                       .import
-                                                                       .timer);
+                                       if (bpi->extra->vnc->vnc.import.timer) {
+                                               struct rfapi_withdraw *wcb = EVENT_ARG(
+                                                       bpi->extra->vnc->vnc
+                                                               .import.timer);
 
                                                wcb->import_table
                                                        ->holddown_count[afi] -=
@@ -4463,8 +4468,8 @@ static void rfapiDeleteRemotePrefixesIt(
                                                        afi, 1);
                                                XFREE(MTYPE_RFAPI_WITHDRAW,
                                                      wcb);
-                                               EVENT_OFF(bpi->extra->vnc.import
-                                                                 .timer);
+                                               EVENT_OFF(bpi->extra->vnc->vnc
+                                                                 .import.timer);
                                        }
                                } else {
                                        if (!delete_active)
index 3fe957ba4de742f735e79096a7b955882ea78203..146e0d18b54932266c924d18d019bc77449a5248 100644 (file)
@@ -354,7 +354,7 @@ struct agg_node *rfapiMonitorGetAttachNode(struct rfapi_descriptor *rfd,
                         * If there is a cached ENCAP UN address, it's a usable
                         * VPN route
                         */
-                       if (bpi->extra && bpi->extra->vnc.import.un_family) {
+                       if (bpi->extra && bpi->extra->vnc->vnc.import.un_family) {
                                break;
                        }
 
index 5784f95b278691c735dbcef925a51364e7d71168..316904e45b8a8605944a614fdd3fce2fffc9215e 100644 (file)
@@ -663,9 +663,8 @@ static void rfapiRibBi2Ri(struct bgp_path_info *bpi, struct rfapi_info *ri,
        /*
         * VN options
         */
-       if (bpi->extra
-           && decode_rd_type(bpi->extra->vnc.import.rd.val)
-                      == RD_TYPE_VNC_ETH) {
+       if (bpi->extra && decode_rd_type(bpi->extra->vnc->vnc.import.rd.val) ==
+                                 RD_TYPE_VNC_ETH) {
                /* ethernet route */
 
                struct rfapi_vn_option *vo;
@@ -678,8 +677,8 @@ static void rfapiRibBi2Ri(struct bgp_path_info *bpi, struct rfapi_info *ri,
 
                /* copy from RD already stored in bpi, so we don't need it_node
                 */
-               memcpy(&vo->v.l2addr.macaddr, bpi->extra->vnc.import.rd.val + 2,
-                      ETH_ALEN);
+               memcpy(&vo->v.l2addr.macaddr,
+                      bpi->extra->vnc->vnc.import.rd.val + 2, ETH_ALEN);
 
                (void)rfapiEcommunityGetLNI(bgp_attr_get_ecommunity(bpi->attr),
                                            &vo->v.l2addr.logical_net_id);
@@ -688,7 +687,8 @@ static void rfapiRibBi2Ri(struct bgp_path_info *bpi, struct rfapi_info *ri,
                        &vo->v.l2addr.tag_id);
 
                /* local_nve_id comes from RD */
-               vo->v.l2addr.local_nve_id = bpi->extra->vnc.import.rd.val[1];
+               vo->v.l2addr.local_nve_id =
+                       bpi->extra->vnc->vnc.import.rd.val[1];
 
                /* label comes from MP_REACH_NLRI label */
                vo->v.l2addr.label = decode_label(&bpi->extra->label[0]);
@@ -701,8 +701,8 @@ static void rfapiRibBi2Ri(struct bgp_path_info *bpi, struct rfapi_info *ri,
        /*
         * If there is an auxiliary IP address (L2 can have it), copy it
         */
-       if (bpi->extra && bpi->extra->vnc.import.aux_prefix.family) {
-               ri->rk.aux_prefix = bpi->extra->vnc.import.aux_prefix;
+       if (bpi->extra && bpi->extra->vnc->vnc.import.aux_prefix.family) {
+               ri->rk.aux_prefix = bpi->extra->vnc->vnc.import.aux_prefix;
        }
 }
 
@@ -746,13 +746,13 @@ int rfapiRibPreloadBi(
 
        memset((void *)&rk, 0, sizeof(rk));
        rk.vn = *pfx_vn;
-       rk.rd = bpi->extra->vnc.import.rd;
+       rk.rd = bpi->extra->vnc->vnc.import.rd;
 
        /*
         * If there is an auxiliary IP address (L2 can have it), copy it
         */
-       if (bpi->extra->vnc.import.aux_prefix.family) {
-               rk.aux_prefix = bpi->extra->vnc.import.aux_prefix;
+       if (bpi->extra->vnc->vnc.import.aux_prefix.family) {
+               rk.aux_prefix = bpi->extra->vnc->vnc.import.aux_prefix;
        }
 
        /*
@@ -1629,12 +1629,13 @@ void rfapiRibUpdatePendingNode(
 
                ri = rfapi_info_new();
                ri->rk.vn = pfx_nh;
-               ri->rk.rd = bpi->extra->vnc.import.rd;
+               ri->rk.rd = bpi->extra->vnc->vnc.import.rd;
                /*
                 * If there is an auxiliary IP address (L2 can have it), copy it
                 */
-               if (bpi->extra->vnc.import.aux_prefix.family) {
-                       ri->rk.aux_prefix = bpi->extra->vnc.import.aux_prefix;
+               if (bpi->extra->vnc->vnc.import.aux_prefix.family) {
+                       ri->rk.aux_prefix =
+                               bpi->extra->vnc->vnc.import.aux_prefix;
                }
 
                if (rfapiGetUnAddrOfVpnBi(bpi, &ri->un)) {
index 43625b11a6748ac2ee3df8f7ef10345b04a1a2b7..8e88550ddf81f0c83c565080c434fe7ca21fa8f0 100644 (file)
@@ -519,9 +519,10 @@ void rfapiPrintBi(void *stream, struct bgp_path_info *bpi)
        if (!bpi)
                return;
 
-       if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED) && bpi->extra
-           && bpi->extra->vnc.import.timer) {
-               struct event *t = (struct event *)bpi->extra->vnc.import.timer;
+       if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED) && bpi->extra &&
+           bpi->extra->vnc->vnc.import.timer) {
+               struct event *t =
+                       (struct event *)bpi->extra->vnc->vnc.import.timer;
 
                r = snprintf(p, REMAIN, " [%4lu] ",
                             event_timer_remain_second(t));
@@ -534,12 +535,12 @@ void rfapiPrintBi(void *stream, struct bgp_path_info *bpi)
 
        if (bpi->extra) {
                /* TBD This valid only for SAFI_MPLS_VPN, but not for encap */
-               if (decode_rd_type(bpi->extra->vnc.import.rd.val)
-                   == RD_TYPE_VNC_ETH) {
+               if (decode_rd_type(bpi->extra->vnc->vnc.import.rd.val) ==
+                   RD_TYPE_VNC_ETH) {
                        has_macaddr = 1;
-                       memcpy(macaddr.octet, bpi->extra->vnc.import.rd.val + 2,
-                              6);
-                       l2hid = bpi->extra->vnc.import.rd.val[1];
+                       memcpy(macaddr.octet,
+                              bpi->extra->vnc->vnc.import.rd.val + 2, 6);
+                       l2hid = bpi->extra->vnc->vnc.import.rd.val[1];
                }
        }
 
@@ -670,11 +671,11 @@ void rfapiPrintBi(void *stream, struct bgp_path_info *bpi)
                   l2o_buf.label, l2o_buf.logical_net_id, l2o_buf.local_nve_id,
                   HVTYNL);
        }
-       if (bpi->extra && bpi->extra->vnc.import.aux_prefix.family) {
+       if (bpi->extra && bpi->extra->vnc->vnc.import.aux_prefix.family) {
                const char *sp;
 
-               sp = rfapi_ntop(bpi->extra->vnc.import.aux_prefix.family,
-                               &bpi->extra->vnc.import.aux_prefix.u.prefix,
+               sp = rfapi_ntop(bpi->extra->vnc->vnc.import.aux_prefix.family,
+                               &bpi->extra->vnc->vnc.import.aux_prefix.u.prefix,
                                buf, BUFSIZ);
                buf[BUFSIZ - 1] = 0;
                if (sp) {
@@ -1097,14 +1098,14 @@ static int rfapiPrintRemoteRegBi(struct bgp *bgp, void *stream,
                fp(out, "%-10s ", buf_lifetime);
        }
 
-       if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED) && bpi->extra
-           && bpi->extra->vnc.import.timer) {
-
+       if (CHECK_FLAG(bpi->flags, BGP_PATH_REMOVED) && bpi->extra &&
+           bpi->extra->vnc->vnc.import.timer) {
                uint32_t remaining;
                time_t age;
                char buf_age[BUFSIZ];
 
-               struct event *t = (struct event *)bpi->extra->vnc.import.timer;
+               struct event *t =
+                       (struct event *)bpi->extra->vnc->vnc.import.timer;
                remaining = event_timer_remain_second(t);
 
 #ifdef RFAPI_REGISTRATIONS_REPORT_AGE
@@ -1125,11 +1126,10 @@ static int rfapiPrintRemoteRegBi(struct bgp *bgp, void *stream,
                fp(out, "%-10s ", buf_age);
 
        } else if (RFAPI_LOCAL_BI(bpi)) {
-
                char buf_age[BUFSIZ];
 
-               if (bpi->extra && bpi->extra->vnc.import.create_time) {
-                       rfapiFormatAge(bpi->extra->vnc.import.create_time,
+               if (bpi->extra && bpi->extra->vnc->vnc.import.create_time) {
+                       rfapiFormatAge(bpi->extra->vnc->vnc.import.create_time,
                                       buf_age, BUFSIZ);
                } else {
                        buf_age[0] = '?';
@@ -1145,13 +1145,14 @@ static int rfapiPrintRemoteRegBi(struct bgp *bgp, void *stream,
                 * print that on the next line
                 */
 
-               if (bpi->extra && bpi->extra->vnc.import.aux_prefix.family) {
+               if (bpi->extra && bpi->extra->vnc->vnc.import.aux_prefix.family) {
                        const char *sp;
 
-                       sp = rfapi_ntop(
-                               bpi->extra->vnc.import.aux_prefix.family,
-                               &bpi->extra->vnc.import.aux_prefix.u.prefix,
-                               buf_ntop, BUFSIZ);
+                       sp = rfapi_ntop(bpi->extra->vnc->vnc.import.aux_prefix
+                                               .family,
+                                       &bpi->extra->vnc->vnc.import.aux_prefix
+                                                .u.prefix,
+                                       buf_ntop, BUFSIZ);
                        buf_ntop[BUFSIZ - 1] = 0;
 
                        if (sp && strcmp(buf_vn, sp) != 0) {
@@ -1545,10 +1546,9 @@ void rfapiPrintAdvertisedInfo(struct vty *vty, struct rfapi_descriptor *rfd,
        vty_out(vty, "  bd=%p%s", bd, HVTYNL);
 
        for (bpi = bgp_dest_get_bgp_path_info(bd); bpi; bpi = bpi->next) {
-               if (bpi->peer == rfd->peer && bpi->type == type
-                   && bpi->sub_type == BGP_ROUTE_RFP && bpi->extra
-                   && bpi->extra->vnc.export.rfapi_handle == (void *)rfd) {
-
+               if (bpi->peer == rfd->peer && bpi->type == type &&
+                   bpi->sub_type == BGP_ROUTE_RFP && bpi->extra &&
+                   bpi->extra->vnc->vnc.export.rfapi_handle == (void *)rfd) {
                        rfapiPrintBi(vty, bpi);
                        printed = 1;
                }
index 3fcc0e6f5f4b7bae5ee919af927dbc705727d5a9..c067b7a610c11902ce4704326a7c72462735bcea 100644 (file)
@@ -1696,8 +1696,8 @@ static void vnc_import_bgp_exterior_add_route_it(
                                have_usable_route = 1;
 
                                if (bpi_interior->extra) {
-                                       prd = &bpi_interior->extra->vnc.import
-                                                      .rd;
+                                       prd = &bpi_interior->extra->vnc->vnc
+                                                      .import.rd;
                                        label = decode_label(
                                                &bpi_interior->extra->label[0]);
                                } else
@@ -1865,8 +1865,8 @@ void vnc_import_bgp_exterior_del_route(
                                have_usable_route = 1;
 
                                if (bpi_interior->extra) {
-                                       prd = &bpi_interior->extra->vnc.import
-                                                      .rd;
+                                       prd = &bpi_interior->extra->vnc->vnc
+                                                      .import.rd;
                                        label = decode_label(
                                                &bpi_interior->extra->label[0]);
                                } else
@@ -2013,7 +2013,7 @@ void vnc_import_bgp_exterior_add_route_interior(
                        assert(pfx_exterior);
 
                        if (bpi_interior->extra) {
-                               prd = &bpi_interior->extra->vnc.import.rd;
+                               prd = &bpi_interior->extra->vnc->vnc.import.rd;
                                label = decode_label(
                                        &bpi_interior->extra->label[0]);
                        } else
@@ -2126,8 +2126,8 @@ void vnc_import_bgp_exterior_add_route_interior(
                                for (bpi = par->info; bpi; bpi = bpi->next) {
 
                                        if (bpi->extra) {
-                                               prd = &bpi->extra->vnc.import
-                                                              .rd;
+                                               prd = &bpi->extra->vnc->vnc
+                                                              .import.rd;
                                                label = decode_label(
                                                        &bpi->extra->label[0]);
                                        } else
@@ -2148,8 +2148,8 @@ void vnc_import_bgp_exterior_add_route_interior(
                                 * the new interior route at longer prefix.
                                 */
                                if (bpi_interior->extra) {
-                                       prd = &bpi_interior->extra->vnc.import
-                                                      .rd;
+                                       prd = &bpi_interior->extra->vnc->vnc
+                                                      .import.rd;
                                        label = decode_label(
                                                &bpi_interior->extra->label[0]);
                                } else
@@ -2267,7 +2267,7 @@ void vnc_import_bgp_exterior_add_route_interior(
                         * new interior route at the longer prefix.
                         */
                        if (bpi_interior->extra) {
-                               prd = &bpi_interior->extra->vnc.import.rd;
+                               prd = &bpi_interior->extra->vnc->vnc.import.rd;
                                label = decode_label(
                                        &bpi_interior->extra->label[0]);
                        } else
@@ -2375,7 +2375,7 @@ void vnc_import_bgp_exterior_del_route_interior(
                uint32_t label = 0;
 
                if (bpi_interior->extra) {
-                       prd = &bpi_interior->extra->vnc.import.rd;
+                       prd = &bpi_interior->extra->vnc->vnc.import.rd;
                        label = decode_label(&bpi_interior->extra->label[0]);
                } else
                        prd = NULL;
@@ -2452,7 +2452,7 @@ void vnc_import_bgp_exterior_del_route_interior(
                                        continue;
 
                                if (bpi->extra) {
-                                       prd = &bpi->extra->vnc.import.rd;
+                                       prd = &bpi->extra->vnc->vnc.import.rd;
                                        label = decode_label(
                                                &bpi->extra->label[0]);
                                } else
@@ -2805,14 +2805,14 @@ void vnc_import_bgp_redist_disable(struct bgp *bgp, afi_t afi)
 
                                assert(bpi->extra);
 
-                               rfd = bpi->extra->vnc.export.rfapi_handle;
+                               rfd = bpi->extra->vnc->vnc.export.rfapi_handle;
 
                                vnc_zlog_debug_verbose(
-                                       "%s: deleting bpi=%p, bpi->peer=%p, bpi->type=%d, bpi->sub_type=%d, bpi->extra->vnc.export.rfapi_handle=%p [passing rfd=%p]",
+                                       "%s: deleting bpi=%p, bpi->peer=%p, bpi->type=%d, bpi->sub_type=%d, bpi->extra->vnc->vnc.export.rfapi_handle=%p [passing rfd=%p]",
                                        __func__, bpi, bpi->peer, bpi->type,
                                        bpi->sub_type,
-                                       (bpi->extra ? bpi->extra->vnc.export
-                                                             .rfapi_handle
+                                       (bpi->extra ? bpi->extra->vnc->vnc
+                                                             .export.rfapi_handle
                                                    : NULL),
                                        rfd);