Skip to content

Commit

Permalink
Merge pull request #15036 from opensourcerouting/fix/use_constants_fo…
Browse files Browse the repository at this point in the history
…r_addpath_cap_length

bgpd: Use CAPABILITY_CODE_ADDPATH_LEN instead of numeric value
  • Loading branch information
donaldsharp authored Dec 18, 2023
2 parents b3e5ee5 + 66c78c6 commit 490928b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bgpd/bgp_open.c
Original file line number Diff line number Diff line change
Expand Up @@ -665,15 +665,15 @@ static int bgp_capability_addpath(struct peer *peer,
SET_FLAG(peer->cap, PEER_CAP_ADDPATH_RCV);

/* Verify length is a multiple of 4 */
if (hdr->length % 4) {
if (hdr->length % CAPABILITY_CODE_ADDPATH_LEN) {
flog_warn(
EC_BGP_CAPABILITY_INVALID_LENGTH,
"Add Path: Received invalid length %d, non-multiple of 4",
hdr->length);
return -1;
}

while (stream_get_getp(s) + 4 <= end) {
while (stream_get_getp(s) + CAPABILITY_CODE_ADDPATH_LEN <= end) {
afi_t afi;
safi_t safi;
iana_afi_t pkt_afi = stream_getw(s);
Expand Down

0 comments on commit 490928b

Please sign in to comment.