From e066d6d0f26bc66bd3e1a63f40010f9bcd087c21 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Tue, 20 Mar 2018 19:19:54 -0400 Subject: [PATCH] bgpd: Clean up irt a tiny bit This commit does these 2 things: 1) irt->vrfs is never NULL so no need to test for it 2) No need to check for a good irt value returned from vrf_import_rt_new as that the alloc operation will dump if memory allocation fails. Signed-off-by: Donald Sharp --- bgpd/bgp_evpn.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c index b3d6f388b9..a03b067344 100644 --- a/bgpd/bgp_evpn.c +++ b/bgpd/bgp_evpn.c @@ -367,15 +367,12 @@ static void map_vrf_to_rt(struct bgp *bgp_vrf, struct ecommunity_val *eval) mask_ecom_global_admin(&eval_tmp, eval); irt = lookup_vrf_import_rt(&eval_tmp); - if (irt && irt->vrfs) - if (is_vrf_present_in_irt_vrfs(irt->vrfs, bgp_vrf)) - /* Already mapped. */ - return; + if (irt && is_vrf_present_in_irt_vrfs(irt->vrfs, bgp_vrf)) + /* Already mapped. */ + return; - if (!irt) { + if (!irt) irt = vrf_import_rt_new(&eval_tmp); - assert(irt); - } /* Add VRF to the list for this RT. */ listnode_add(irt->vrfs, bgp_vrf); -- 2.39.5