]> git.proxmox.com Git - mirror_frr.git/blobdiff - bgpd/rfapi/bgp_rfapi_cfg.c
Merge pull request #12798 from donaldsharp/rib_match_multicast
[mirror_frr.git] / bgpd / rfapi / bgp_rfapi_cfg.c
index eae9859ba188caa2d1f4560d7c5fd099fe863097..5b6961d18af56640d0115344a600fe80a1d1f42d 100644 (file)
@@ -1,21 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *
  * Copyright 2009-2016, LabN Consulting, L.L.C.
  *
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; see the file COPYING; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  */
 #include "lib/zebra.h"
 
@@ -423,6 +410,7 @@ DEFUN (vnc_defaults_rd,
 
        } else {
 
+               /* TODO: save RD format */
                ret = str2prefix_rd(argv[1]->arg, &prd);
                if (!ret) {
                        vty_out(vty, "%% Malformed rd\n");
@@ -2887,6 +2875,7 @@ DEFUN (vnc_nve_group_rd,
 
        } else {
 
+               /* TODO: save RD format */
                ret = str2prefix_rd(argv[1]->arg, &prd);
                if (!ret) {
                        vty_out(vty, "%% Malformed rd\n");
@@ -3359,6 +3348,7 @@ DEFUN (vnc_vrf_policy_rd,
 
        } else {
 
+               /* TODO: save RD format */
                ret = str2prefix_rd(argv[1]->arg, &prd);
                if (!ret) {
                        vty_out(vty, "%% Malformed rd\n");
@@ -3847,6 +3837,13 @@ struct rfapi_cfg *bgp_rfapi_cfg_new(struct rfapi_rfp_cfg *cfg)
        return h;
 }
 
+static void bgp_rfapi_rfgn_list_delete(void *data)
+{
+       struct rfapi_rfg_name *rfgn = data;
+       free(rfgn->name);
+       rfgn_free(rfgn);
+}
+
 void bgp_rfapi_cfg_destroy(struct bgp *bgp, struct rfapi_cfg *h)
 {
        afi_t afi;
@@ -3858,8 +3855,13 @@ void bgp_rfapi_cfg_destroy(struct bgp *bgp, struct rfapi_cfg *h)
        if (h->l2_groups != NULL)
                list_delete(&h->l2_groups);
        list_delete(&h->nve_groups_sequential);
+
+       h->rfg_export_direct_bgp_l->del = bgp_rfapi_rfgn_list_delete;
        list_delete(&h->rfg_export_direct_bgp_l);
+
+       h->rfg_export_zebra_l->del = bgp_rfapi_rfgn_list_delete;
        list_delete(&h->rfg_export_zebra_l);
+
        if (h->default_rt_export_list)
                ecommunity_free(&h->default_rt_export_list);
        if (h->default_rt_import_list)
@@ -3925,7 +3927,7 @@ int bgp_rfapi_cfg_write(struct vty *vty, struct bgp *bgp)
                                                value);
 
                                } else
-                                       vty_out(vty, "  rd %pRD\n", &rfg->rd);
+                                       vty_out(vty, "  rd %pRDP\n", &rfg->rd);
                        }
 
                        if (rfg->rt_import_list && rfg->rt_export_list
@@ -4145,7 +4147,7 @@ int bgp_rfapi_cfg_write(struct vty *vty, struct bgp *bgp)
                                                value);
 
                                } else
-                                       vty_out(vty, "  rd %pRD\n",
+                                       vty_out(vty, "  rd %pRDP\n",
                                                &hc->default_rd);
                        }
                        if (hc->default_response_lifetime
@@ -4225,7 +4227,7 @@ int bgp_rfapi_cfg_write(struct vty *vty, struct bgp *bgp)
                                                        value);
 
                                        } else
-                                               vty_out(vty, "  rd %pRD\n",
+                                               vty_out(vty, "  rd %pRDP\n",
                                                        &rfg->rd);
                                }
                                if (rfg->flags & RFAPI_RFG_RESPONSE_LIFETIME) {