]> 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>
Tue, 29 May 2018 18:07:03 +0000 (20:07 +0200)
commitd27a91dc564d113ce38715c35b8514a6562aef57
tree482db1495ab0cbdb4224dbe6736794eb079ddc39
parent41e5abf816ddd63dbbd4ce91eacbcd03e2ee2b71
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>
(cherry picked from commit 2b8e62f2db185e5c2c11d691523b3f734d224e95)
bgpd/bgp_snmp.c