]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgp rfapi: use route_table_init and _finish (fixes crash due to recent lib change)
authorLou Berger <lberger@labn.net>
Thu, 27 Jul 2017 14:05:48 +0000 (10:05 -0400)
committerLou Berger <lberger@labn.net>
Thu, 27 Jul 2017 15:02:31 +0000 (11:02 -0400)
Signed-off-by: Lou Berger <lberger@labn.net>
bgpd/rfapi/bgp_rfapi_cfg.c
bgpd/rfapi/bgp_rfapi_cfg.h
bgpd/rfapi/rfapi.c
bgpd/rfapi/rfapi_import.c
bgpd/rfapi/rfapi_private.h

index 8a93d3984efb42d2c91fd7008aba5360498b5125..4b55c20c1c8c6ca55e046ba5a93718faa6ccdc6b 100644 (file)
@@ -135,10 +135,10 @@ struct rfapi_nve_group_cfg *bgp_rfapi_cfg_match_group(struct rfapi_cfg *hc,
 
        switch (vn->family) {
        case AF_INET:
-               rt_vn = &(hc->nve_groups_vn[AFI_IP]);
+               rt_vn = hc->nve_groups_vn[AFI_IP];
                break;
        case AF_INET6:
-               rt_vn = &(hc->nve_groups_vn[AFI_IP6]);
+               rt_vn = hc->nve_groups_vn[AFI_IP6];
                break;
        default:
                return NULL;
@@ -146,10 +146,10 @@ struct rfapi_nve_group_cfg *bgp_rfapi_cfg_match_group(struct rfapi_cfg *hc,
 
        switch (un->family) {
        case AF_INET:
-               rt_un = &(hc->nve_groups_un[AFI_IP]);
+               rt_un = hc->nve_groups_un[AFI_IP];
                break;
        case AF_INET6:
-               rt_un = &(hc->nve_groups_un[AFI_IP6]);
+               rt_un = hc->nve_groups_un[AFI_IP6];
                break;
        default:
                return NULL;
@@ -2527,10 +2527,10 @@ DEFUN (vnc_nve_group_prefix,
        }
 
        if (argv[1]->arg[0] == 'u') {
-               rt = &(bgp->rfapi_cfg->nve_groups_un[afi]);
+               rt = bgp->rfapi_cfg->nve_groups_un[afi];
                is_un_prefix = 1;
        } else {
-               rt = &(bgp->rfapi_cfg->nve_groups_vn[afi]);
+               rt = bgp->rfapi_cfg->nve_groups_vn[afi];
        }
 
        rn = route_node_get(rt, &p); /* NB locks node */
@@ -3838,14 +3838,9 @@ struct rfapi_cfg *bgp_rfapi_cfg_new(struct rfapi_rfp_cfg *cfg)
 
        h->nve_groups_sequential = list_new();
        assert(h->nve_groups_sequential);
-
        for (afi = AFI_IP; afi < AFI_MAX; afi++) {
-               /* ugly, to deal with addition of delegates, part of 0.99.24.1
-                * merge */
-               h->nve_groups_vn[afi].delegate =
-                       route_table_get_default_delegate();
-               h->nve_groups_un[afi].delegate =
-                       route_table_get_default_delegate();
+               h->nve_groups_vn[afi] = route_table_init();
+               h->nve_groups_un[afi] = route_table_init();
        }
        h->default_response_lifetime =
                BGP_VNC_DEFAULT_RESPONSE_LIFETIME_DEFAULT;
@@ -3885,6 +3880,7 @@ struct rfapi_cfg *bgp_rfapi_cfg_new(struct rfapi_rfp_cfg *cfg)
 
 void bgp_rfapi_cfg_destroy(struct bgp *bgp, struct rfapi_cfg *h)
 {
+       int afi;
        if (h == NULL)
                return;
 
@@ -3901,6 +3897,10 @@ void bgp_rfapi_cfg_destroy(struct bgp *bgp, struct rfapi_cfg *h)
                ecommunity_free(&h->default_rt_import_list);
        if (h->default_rfp_cfg)
                XFREE(MTYPE_RFAPI_RFP_GROUP_CFG, h->default_rfp_cfg);
+       for (afi = AFI_IP; afi < AFI_MAX; afi++) {
+               route_table_finish(h->nve_groups_vn[afi]);
+               route_table_finish(h->nve_groups_un[afi]);
+       }
        XFREE(MTYPE_RFAPI_CFG, h);
 }
 
index d99aefa60ddefb7cc8bb074a96ebc67a8ecc9bff..a11b0992fa9343052f6565a2760f3b930ff88ef1 100644 (file)
@@ -135,8 +135,8 @@ struct rfapi_cfg {
        struct list *l2_groups; /* rfapi_l2_group_cfg list */
        /* three views into the same collection of rfapi_nve_group_cfg */
        struct list *nve_groups_sequential;
-       struct route_table nve_groups_vn[AFI_MAX];
-       struct route_table nve_groups_un[AFI_MAX];
+       struct route_table *nve_groups_vn[AFI_MAX];
+       struct route_table *nve_groups_un[AFI_MAX];
 
        /*
         * For Single VRF export to ordinary routing protocols. This is
index 3a2a608a7c6422b12b66e1d2098e0e20a152b071..29c114d9942ad33f7ff6fd3fdb6fbfe2fc1f38fd 100644 (file)
@@ -224,7 +224,7 @@ static int rfapi_find_node(struct bgp *bgp, struct rfapi_ip_addr *vn_addr,
        if ((rc = rfapiRaddr2Qprefix(un_addr, &p)))
                return rc;
 
-       rn = route_node_lookup(&h->un[afi], &p);
+       rn = route_node_lookup(h->un[afi], &p);
 
        if (!rn)
                return ENOENT;
@@ -1415,7 +1415,7 @@ int rfapi_init_and_open(struct bgp *bgp, struct rfapi_descriptor *rfd,
                assert(afi_vn && afi_un);
                assert(!rfapiRaddr2Qprefix(&rfd->un_addr, &pfx_un));
 
-               rn = route_node_get(&(h->un[afi_un]), &pfx_un);
+               rn = route_node_get(h->un[afi_un], &pfx_un);
                assert(rn);
                rfd->next = rn->info;
                rn->info = rfd;
index d0379e1ef8d1311dc5848149eebf38755ed5e42a..f156161ef9df4cb6d9dbab25b4599c8f24610bde 100644 (file)
@@ -4257,9 +4257,7 @@ struct rfapi *bgp_rfapi_new(struct bgp *bgp)
        h = (struct rfapi *)XCALLOC(MTYPE_RFAPI, sizeof(struct rfapi));
 
        for (afi = AFI_IP; afi < AFI_MAX; afi++) {
-               /* ugly, to deal with addition of delegates, part of 0.99.24.1
-                * merge */
-               h->un[afi].delegate = route_table_get_default_delegate();
+               h->un[afi] = route_table_init();
        }
 
        /*
@@ -4292,6 +4290,8 @@ struct rfapi *bgp_rfapi_new(struct bgp *bgp)
 
 void bgp_rfapi_destroy(struct bgp *bgp, struct rfapi *h)
 {
+       int afi;
+
        if (bgp == NULL || h == NULL)
                return;
 
@@ -4327,6 +4327,11 @@ void bgp_rfapi_destroy(struct bgp *bgp, struct rfapi *h)
 
        if (h->rfp != NULL)
                rfp_stop(h->rfp);
+
+       for (afi = AFI_IP; afi < AFI_MAX; afi++) {
+               route_table_finish(h->un[afi]);
+       }
+
        XFREE(MTYPE_RFAPI_IMPORTTABLE, h->it_ce);
        XFREE(MTYPE_RFAPI, h);
 }
index e7a3e5aae3e34184f5e2ddf8f7bc1a984c77e8f2..73c9312a64d1799c6d7e91d5d3fe4f90fb574636 100644 (file)
@@ -171,7 +171,7 @@ struct rfapi_global_stats {
  * check vn address to get exact match.
  */
 struct rfapi {
-       struct route_table un[AFI_MAX];
+       struct route_table *un[AFI_MAX];
        struct rfapi_import_table *imports; /* IPv4, IPv6 */
        struct list descriptors;            /* debug & resolve-nve imports */