From: Donald Sharp Date: Tue, 20 Mar 2018 23:19:54 +0000 (-0400) Subject: bgpd: Clean up irt a tiny bit X-Git-Tag: frr-5.0-dev~132^2~1 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=e066d6d0f26bc66bd3e1a63f40010f9bcd087c21;p=matthieu%2Ffrr.git 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 --- 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);