]> git.puffer.fish Git - mirror/frr.git/commit
bgpd: rework BGP_MAX_PACKET_SIZE & friends 8581/head
authorQuentin Young <qlyoung@nvidia.com>
Tue, 27 Apr 2021 20:20:27 +0000 (16:20 -0400)
committerQuentin Young <qlyoung@nvidia.com>
Thu, 6 May 2021 15:54:02 +0000 (11:54 -0400)
commit556beacf106ac75043f63d4e10d5d3046f1d2163
tree58fad225b1074538fa806e992e81e6e00ea49c55
parent38861dab3c6825c65fefc351a1cc3b8b398cbc87
bgpd: rework BGP_MAX_PACKET_SIZE & friends

BGP_MAX_PACKET_SIZE no longer represented the absolute maximum BGP
packet size as it did before, instead it was defined as 4096 bytes,
which is the maximum unless extended message capability is negotiated,
in which case the maximum goes to 65k.

That introduced at least one bug - last_reset_cause was undersized for
extended messages, and when sending an extended message > 4096 bytes
back to a peer as part of NOTIFY data would trigger a bounds check
assert.

This patch redefines the macro to restore its previous meaning,
introduces a new macro - BGP_STANDARD_MESSAGE_MAX_PACKET_SIZE - to
represent the 4096 byte size, and renames the extended size to
BGP_EXTENDED_MESSAGE_MAX_PACKET_SIZE for consistency. Code locations
that definitely should use the small size have been updated, locations
that semantically always need whatever the max is, no matter what that
is, use BGP_MAX_PACKET_SIZE.

BGP_EXTENDED_MESSAGE_MAX_PACKET_SIZE should only be used as a constant
when storing what the negotiated max size is for use at runtime and to
define BGP_MAX_PACKET_SIZE. Unless there is a future standard that
introduces a third valid size it should not be used for any other
purpose.

Signed-off-by: Quentin Young <qlyoung@nvidia.com>
bgpd/bgp_dump.c
bgpd/bgp_open.c
bgpd/bgp_packet.c
bgpd/bgpd.c
bgpd/bgpd.h
tests/bgpd/test_aspath.c
tests/bgpd/test_capability.c
tests/bgpd/test_mp_attr.c