Merge pull request #16293 from FRRouting/mergify/bp/stable/9.1/pr-16214

bgpd: A couple more fixes for Tunnel encapsulation handling (backport #16214)
This commit is contained in:
Russ White 2024-06-25 07:40:43 -04:00 committed by GitHub
commit dca6ed0d2c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2700,17 +2700,20 @@ static int bgp_attr_encap(struct bgp_attr_parser_args *args)
}
}
while (length >= 4) {
while (STREAM_READABLE(BGP_INPUT(peer)) >= 4) {
uint16_t subtype = 0;
uint16_t sublength = 0;
struct bgp_attr_encap_subtlv *tlv;
if (BGP_ATTR_ENCAP == type) {
subtype = stream_getc(BGP_INPUT(peer));
sublength = (subtype < 128)
? stream_getc(BGP_INPUT(peer))
: stream_getw(BGP_INPUT(peer));
length -= 2;
if (subtype < 128) {
sublength = stream_getc(BGP_INPUT(peer));
length -= 2;
} else {
sublength = stream_getw(BGP_INPUT(peer));
length -= 3;
}
#ifdef ENABLE_BGP_VNC
} else {
subtype = stream_getw(BGP_INPUT(peer));