]> git.puffer.fish Git - matthieu/frr.git/commit
BGP: Rework iteration of peer_af_array
authorvivek <vivek@cumulusnetworks.com>
Fri, 22 Jan 2016 18:56:48 +0000 (10:56 -0800)
committervivek <vivek@cumulusnetworks.com>
Fri, 22 Jan 2016 18:56:48 +0000 (10:56 -0800)
commit96885f16b0838d3324db86153d50e27fe2cef3a6
tree48f7add4fe5fb036d43d6e8652d72bbf3eaa360c
parent385f703b16874a97e9edd93c0ece5e74535d0c6b
BGP: Rework iteration of peer_af_array

While processing references to the macro PEERAF_FOREACH(), aggressive loop
optimization by gcc 4.9.x (probably 4.8 and greater) was resulting in the
generated code not checking on the index as well as eliminating some code.
This was leading to a dereference of invalid memory when a BGP peer came up.

The fix is to scrap this convoluted macro. Two other changes done are to
eliminate overloading of "afindex" and make the loop iterator an integer.

Signed-off-by: Vivek Venkatraman <vivek@cumulusnetworks.com>
Reviewed-by: Dave Olson <olson@cumulusnetworks.com>
Reviewed-by: Donald Sharp <sharpd@cumulusnetworks.com>
Reviewed-by: Daniel Walton <dwalton@cumulusnetworks.com>
Ticket: CM-8889
Reviewed By: CCR-4018
Testing Done: Verified failure scenario

Note: This code was added as part of update-groups implementation; when
upstreaming update-groups, this patch should also be included.
bgpd/bgp_debug.c
bgpd/bgp_updgrp.h
bgpd/bgpd.c
bgpd/bgpd.h