]> git.proxmox.com Git - mirror_frr.git/commit - bgpd/bgp_nexthop.c
bgpd: optimize bgp_nexthop_self()
authorJorge Boncompte [DTI2] <jorge@dti2.net>
Mon, 7 May 2012 16:52:52 +0000 (16:52 +0000)
committerDavid Lamparter <equinox@opensourcerouting.org>
Tue, 22 May 2012 18:25:07 +0000 (20:25 +0200)
commit10f9bf3f2021f874e574e4ebae9413bee982ed2b
tree5102a98c91d7d60380c07c08d0aaa32aa19cdbdf
parentf669f7d25f0f491d5e487897227ff434aef20406
bgpd: optimize bgp_nexthop_self()

  This function scores 2nd, profiling a full internet table load. It's called
for every prefix received.
  Instead of looping in the interface lists comparing addresses use a hash
to mantain them.

* bgpd.c: Init the own address hash.
* bgp_nexthop.c: Introduce methods to maintain an own address hash.
  (bgp_connected_add) add addresses to the hash.
  (bgp_connected_delete) delete addresses from the hash.
  (bgp_nexthop_self) lookup addresses in the hash. Removed the unused afi_t
  parameter.
* bgp_route.c: (bgp_update_main) Micro-optimization, rearranged condition to
  not lookup the hash for bogus nexthops (0.0.0.0 or a class D/E address)

Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
bgpd/bgp_nexthop.c
bgpd/bgp_nexthop.h
bgpd/bgp_route.c
bgpd/bgpd.c
lib/memtypes.c