summaryrefslogtreecommitdiffstats
path: root/bgpd
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas@opensourcerouting.org>2023-02-08 09:07:07 +0100
committerGitHub <noreply@github.com>2023-02-08 09:07:07 +0100
commite7765b81ce66c5b728393ccc9636dafadf999b92 (patch)
tree8f042dca6bace2b3405b9bfea24ed9f6f368138b /bgpd
parentMerge pull request #12654 from Pdoijode/evpn-evi-detail-json-changes (diff)
parentbgpd: fix use-after-free crash for evpn (diff)
downloadfrr-e7765b81ce66c5b728393ccc9636dafadf999b92.tar.xz
frr-e7765b81ce66c5b728393ccc9636dafadf999b92.zip
Merge pull request #12761 from anlancs/fix/bgpd-crash-evpn-vni-both-rts
bgpd: fix use-after-free crash for evpn
Diffstat (limited to 'bgpd')
-rw-r--r--bgpd/bgp_evpn_vty.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/bgpd/bgp_evpn_vty.c b/bgpd/bgp_evpn_vty.c
index 0b5f81ccb..6b63c6e3a 100644
--- a/bgpd/bgp_evpn_vty.c
+++ b/bgpd/bgp_evpn_vty.c
@@ -6896,15 +6896,17 @@ DEFUN (bgp_evpn_vni_rt,
return CMD_WARNING;
}
- ecomadd = ecommunity_str2com(argv[2]->arg, ECOMMUNITY_ROUTE_TARGET, 0);
- if (!ecomadd) {
- vty_out(vty, "%% Malformed Route Target list\n");
- return CMD_WARNING;
- }
- ecommunity_str(ecomadd);
-
/* Add/update the import route-target */
if (rt_type == RT_TYPE_BOTH || rt_type == RT_TYPE_IMPORT) {
+ /* Note that first of the two RTs is created for "both" type */
+ ecomadd = ecommunity_str2com(argv[2]->arg,
+ ECOMMUNITY_ROUTE_TARGET, 0);
+ if (!ecomadd) {
+ vty_out(vty, "%% Malformed Route Target list\n");
+ return CMD_WARNING;
+ }
+ ecommunity_str(ecomadd);
+
/* Do nothing if we already have this import route-target */
if (!bgp_evpn_rt_matches_existing(vpn->import_rtl, ecomadd))
evpn_configure_import_rt(bgp, vpn, ecomadd);
@@ -6912,6 +6914,15 @@ DEFUN (bgp_evpn_vni_rt,
/* Add/update the export route-target */
if (rt_type == RT_TYPE_BOTH || rt_type == RT_TYPE_EXPORT) {
+ /* Note that second of the two RTs is created for "both" type */
+ ecomadd = ecommunity_str2com(argv[2]->arg,
+ ECOMMUNITY_ROUTE_TARGET, 0);
+ if (!ecomadd) {
+ vty_out(vty, "%% Malformed Route Target list\n");
+ return CMD_WARNING;
+ }
+ ecommunity_str(ecomadd);
+
/* Do nothing if we already have this export route-target */
if (!bgp_evpn_rt_matches_existing(vpn->export_rtl, ecomadd))
evpn_configure_export_rt(bgp, vpn, ecomadd);