summaryrefslogtreecommitdiffstats
path: root/bgpd/bgp_nexthop.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2020-09-16 23:48:15 +0200
committerDonald Sharp <sharpd@nvidia.com>2020-09-16 23:48:15 +0200
commit3584c85e92b8edfb3a306d26844066bb741a2074 (patch)
treed73deb4b46c2fc9c5238acc08212efc56c9da537 /bgpd/bgp_nexthop.c
parentMerge pull request #7107 from AnuradhaKaruppiah/mh-cleanup (diff)
downloadfrr-3584c85e92b8edfb3a306d26844066bb741a2074.tar.xz
frr-3584c85e92b8edfb3a306d26844066bb741a2074.zip
bgpd: Avoid memset when tip hash is empty
The tip hash is only used when we are dealing with evpn. In bgp_nexthop_self we are doing a memset irrelevant of whether we will ever find data. Yes hash_lookup will return pretty quickly. Modify the code to avoid doing a memset in the case where the tip hash is empty as that we know we'll never find anything. With full BGP feeds this small memset does take some time. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
Diffstat (limited to 'bgpd/bgp_nexthop.c')
-rw-r--r--bgpd/bgp_nexthop.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/bgpd/bgp_nexthop.c b/bgpd/bgp_nexthop.c
index ed026a2ff..0d8214e4d 100644
--- a/bgpd/bgp_nexthop.c
+++ b/bgpd/bgp_nexthop.c
@@ -563,7 +563,7 @@ bool bgp_nexthop_self(struct bgp *bgp, afi_t afi, uint8_t type,
if (addr)
return true;
- if (new_afi == AF_INET) {
+ if (new_afi == AF_INET && hashcount(bgp->tip_hash)) {
memset(&tmp_tip, 0, sizeof(struct tip_addr));
tmp_tip.addr = attr->nexthop;