]> git.puffer.fish Git - matthieu/frr.git/commit
bgpd: fix and improve snmp peer lookups
authorPascal Mathis <mail@pascalmathis.com>
Thu, 10 May 2018 21:35:37 +0000 (23:35 +0200)
committerPascal Mathis <mail@pascalmathis.com>
Fri, 11 May 2018 11:54:57 +0000 (13:54 +0200)
commit2b8e62f2db185e5c2c11d691523b3f734d224e95
treee9383337428dd1cffa7a53aafaf92caf19e82c7f
parent3dc755e492093c42d0983620da810893c413c533
bgpd: fix and improve snmp peer lookups

The previous implementation of bgp_peer_lookup_next did not consider the
internal ordering of peers when using peer groups, which led to all
standalone peers being skipped that had a lower IP address than the
highest IP address of a peer belonging to a group.

As the ordering of peers can not be arbitrary due to SNMP requiring
increasing OIDs when walking an OID tree, this commit fixes the bug by
properly looping through all peers and detecting the next highest IP
address.

Additionally, this commit improved both bgp_peer_lookup_next and
peer_lookup_addr_ipv4 by using the socketunion stored within the peer
struct (peer->su) instead of calling inet_pton for each peer during
comparison.

Signed-off-by: Pascal Mathis <mail@pascalmathis.com>
bgpd/bgp_snmp.c