Skip to content

Commit

Permalink
Merge pull request FRRouting#16214 from opensourcerouting/fix/attr_en…
Browse files Browse the repository at this point in the history
…cap_handling

bgpd: A couple more fixes for Tunnel encapsulation handling
  • Loading branch information
riw777 committed Jun 25, 2024
2 parents 58ecc77 + 9929486 commit aeeceef
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions bgpd/bgp_attr.c
Original file line number Diff line number Diff line change
Expand Up @@ -2721,17 +2721,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));
Expand Down

0 comments on commit aeeceef

Please sign in to comment.