summaryrefslogtreecommitdiffstats
path: root/bgpd
diff options
context:
space:
mode:
authorRenato Westphal <renato@openbsd.org>2018-05-24 04:17:02 +0200
committerGitHub <noreply@github.com>2018-05-24 04:17:02 +0200
commit19300af8f26be3b34041f90944c6fc07ad138fe1 (patch)
treeb9644ff915f668fabe77b535b43fea737424e7e5 /bgpd
parentMerge pull request #2278 from donaldsharp/uninited_variable (diff)
parentbgpd: Ensure virt->vrfs is valid (diff)
downloadfrr-19300af8f26be3b34041f90944c6fc07ad138fe1.tar.xz
frr-19300af8f26be3b34041f90944c6fc07ad138fe1.zip
Merge pull request #2279 from donaldsharp/evpn_moo_moo
Evpn SA/CI issues found
Diffstat (limited to 'bgpd')
-rw-r--r--bgpd/bgp_evpn.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c
index b924562bd..9f3fb3498 100644
--- a/bgpd/bgp_evpn.c
+++ b/bgpd/bgp_evpn.c
@@ -164,6 +164,7 @@ static void vrf_import_rt_free(struct vrf_irt_node *irt)
}
hash_release(bgp_def->vrf_import_rt_hash, irt);
+ list_delete_and_null(&irt->vrfs);
XFREE(MTYPE_BGP_EVPN_VRF_IMPORT_RT, irt);
}
@@ -265,6 +266,7 @@ static struct irt_node *import_rt_new(struct bgp *bgp,
static void import_rt_free(struct bgp *bgp, struct irt_node *irt)
{
hash_release(bgp->import_rt_hash, irt);
+ list_delete_and_null(&irt->vnis);
XFREE(MTYPE_BGP_EVPN_IMPORT_RT, irt);
}
@@ -393,7 +395,6 @@ static void unmap_vrf_from_rt(struct bgp *bgp_vrf, struct vrf_irt_node *irt)
/* Delete VRF from list for this RT. */
listnode_delete(irt->vrfs, bgp_vrf);
if (!listnode_head(irt->vrfs)) {
- list_delete_and_null(&irt->vrfs);
vrf_import_rt_free(irt);
}
}
@@ -416,7 +417,7 @@ static void map_vni_to_rt(struct bgp *bgp, struct bgpevpn *vpn,
mask_ecom_global_admin(&eval_tmp, eval);
irt = lookup_import_rt(bgp, &eval_tmp);
- if (irt && irt->vnis)
+ if (irt)
if (is_vni_present_in_irt_vnis(irt->vnis, vpn))
/* Already mapped. */
return;
@@ -440,7 +441,6 @@ static void unmap_vni_from_rt(struct bgp *bgp, struct bgpevpn *vpn,
/* Delete VNI from hash list for this RT. */
listnode_delete(irt->vnis, vpn);
if (!listnode_head(irt->vnis)) {
- list_delete_and_null(&irt->vnis);
import_rt_free(bgp, irt);
}
}
@@ -771,8 +771,11 @@ static void add_mac_mobility_to_attr(uint32_t seq_num, struct attr *attr)
ecom_tmp.size = 1;
ecom_tmp.val = (uint8_t *)eval.val;
- attr->ecommunity =
- ecommunity_merge(attr->ecommunity, &ecom_tmp);
+ if (attr->ecommunity)
+ attr->ecommunity =
+ ecommunity_merge(attr->ecommunity, &ecom_tmp);
+ else
+ attr->ecommunity = ecommunity_dup(&ecom_tmp);
}
}
@@ -2107,7 +2110,7 @@ static int is_route_matching_for_vrf(struct bgp *bgp_vrf, struct bgp_info *ri)
/* See if this RT matches specified VNIs import RTs */
irt = lookup_vrf_import_rt(eval);
- if (irt && irt->vrfs)
+ if (irt)
if (is_vrf_present_in_irt_vrfs(irt->vrfs, bgp_vrf))
return 1;
@@ -2125,7 +2128,7 @@ static int is_route_matching_for_vrf(struct bgp *bgp_vrf, struct bgp_info *ri)
mask_ecom_global_admin(&eval_tmp, eval);
irt = lookup_vrf_import_rt(&eval_tmp);
}
- if (irt && irt->vrfs)
+ if (irt)
if (is_vrf_present_in_irt_vrfs(irt->vrfs, bgp_vrf))
return 1;
}
@@ -2174,7 +2177,7 @@ static int is_route_matching_for_vni(struct bgp *bgp, struct bgpevpn *vpn,
/* See if this RT matches specified VNIs import RTs */
irt = lookup_import_rt(bgp, eval);
- if (irt && irt->vnis)
+ if (irt)
if (is_vni_present_in_irt_vnis(irt->vnis, vpn))
return 1;
@@ -2192,7 +2195,7 @@ static int is_route_matching_for_vni(struct bgp *bgp, struct bgpevpn *vpn,
mask_ecom_global_admin(&eval_tmp, eval);
irt = lookup_import_rt(bgp, &eval_tmp);
}
- if (irt && irt->vnis)
+ if (irt)
if (is_vni_present_in_irt_vnis(irt->vnis, vpn))
return 1;
}
@@ -2546,7 +2549,7 @@ static int install_uninstall_evpn_route(struct bgp *bgp, afi_t afi, safi_t safi,
* into l2vni table)
*/
irt = lookup_import_rt(bgp, eval);
- if (irt && irt->vnis)
+ if (irt)
install_uninstall_route_in_vnis(bgp, afi, safi, evp, ri,
irt->vnis, import);
@@ -2554,7 +2557,7 @@ static int install_uninstall_evpn_route(struct bgp *bgp, afi_t afi, safi_t safi,
* into l3vni/vrf table)
*/
vrf_irt = lookup_vrf_import_rt(eval);
- if (vrf_irt && vrf_irt->vrfs)
+ if (vrf_irt)
install_uninstall_route_in_vrfs(bgp, afi, safi, evp, ri,
vrf_irt->vrfs, import);
@@ -2574,10 +2577,10 @@ static int install_uninstall_evpn_route(struct bgp *bgp, afi_t afi, safi_t safi,
irt = lookup_import_rt(bgp, &eval_tmp);
vrf_irt = lookup_vrf_import_rt(&eval_tmp);
}
- if (irt && irt->vnis)
+ if (irt)
install_uninstall_route_in_vnis(bgp, afi, safi, evp, ri,
irt->vnis, import);
- if (vrf_irt && vrf_irt->vrfs)
+ if (vrf_irt)
install_uninstall_route_in_vrfs(bgp, afi, safi, evp, ri,
vrf_irt->vrfs, import);
}