summaryrefslogtreecommitdiffstats
path: root/bgpd
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2018-08-15 21:27:01 +0200
committerDonald Sharp <sharpd@cumulusnetworks.com>2018-08-15 23:53:09 +0200
commit0a1a07cbcfe7d307f1ed1ef32480f1981e96bfbf (patch)
treeca17bf3658315126177eb238df8c0e0839ed28c3 /bgpd
parentlib: routemap.c trust backet->data (diff)
downloadfrr-0a1a07cbcfe7d307f1ed1ef32480f1981e96bfbf.tar.xz
frr-0a1a07cbcfe7d307f1ed1ef32480f1981e96bfbf.zip
bgpd: Trust backet->data in bgp_evpn.c
backet->data must be non-NULL( look at hash_get ) as such we do not need to check for NULL values for this when we retrieve data from the backet. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'bgpd')
-rw-r--r--bgpd/bgp_evpn.c29
1 files changed, 4 insertions, 25 deletions
diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c
index 73f225784..71fb9d8b3 100644
--- a/bgpd/bgp_evpn.c
+++ b/bgpd/bgp_evpn.c
@@ -3526,14 +3526,7 @@ static int delete_withdraw_vni_routes(struct bgp *bgp, struct bgpevpn *vpn)
*/
static void update_router_id_vni(struct hash_backet *backet, struct bgp *bgp)
{
- struct bgpevpn *vpn;
-
- vpn = (struct bgpevpn *)backet->data;
-
- if (!vpn) {
- zlog_warn("%s: VNI hash entry for VNI not found", __FUNCTION__);
- return;
- }
+ struct bgpevpn *vpn = (struct bgpevpn *)backet->data;
/* Skip VNIs with configured RD. */
if (is_rd_configured(vpn))
@@ -3551,14 +3544,7 @@ static void update_router_id_vni(struct hash_backet *backet, struct bgp *bgp)
*/
static void withdraw_router_id_vni(struct hash_backet *backet, struct bgp *bgp)
{
- struct bgpevpn *vpn;
-
- vpn = (struct bgpevpn *)backet->data;
-
- if (!vpn) {
- zlog_warn("%s: VNI hash entry for VNI not found", __FUNCTION__);
- return;
- }
+ struct bgpevpn *vpn = (struct bgpevpn *)backet->data;
/* Skip VNIs with configured RD. */
if (is_rd_configured(vpn))
@@ -3993,9 +3979,8 @@ static void cleanup_vni_on_disable(struct hash_backet *backet, struct bgp *bgp)
*/
static void free_vni_entry(struct hash_backet *backet, struct bgp *bgp)
{
- struct bgpevpn *vpn;
+ struct bgpevpn *vpn = (struct bgpevpn *)backet->data;
- vpn = (struct bgpevpn *)backet->data;
delete_all_vni_routes(bgp, vpn);
bgp_evpn_free(bgp, vpn);
}
@@ -4067,11 +4052,6 @@ static void update_autort_vni(struct hash_backet *backet, struct bgp *bgp)
{
struct bgpevpn *vpn = backet->data;
- if (!vpn) {
- zlog_warn("%s: VNI hash entry for VNI not found", __PRETTY_FUNCTION__);
- return;
- }
-
if (!is_import_rt_configured(vpn)) {
if (is_vni_live(vpn))
bgp_evpn_uninstall_routes(bgp, vpn);
@@ -5221,13 +5201,12 @@ int bgp_evpn_local_macip_add(struct bgp *bgp, vni_t vni, struct ethaddr *mac,
static void link_l2vni_hash_to_l3vni(struct hash_backet *backet,
struct bgp *bgp_vrf)
{
- struct bgpevpn *vpn = NULL;
+ struct bgpevpn *vpn = (struct bgpevpn *)backet->data;
struct bgp *bgp_def = NULL;
bgp_def = bgp_get_default();
assert(bgp_def);
- vpn = (struct bgpevpn *)backet->data;
if (vpn->tenant_vrf_id == bgp_vrf->vrf_id)
bgpevpn_link_to_l3vni(vpn);
}