Skip to content

Commit 490928b

Browse files
authored
Merge pull request FRRouting#15036 from opensourcerouting/fix/use_constants_for_addpath_cap_length
bgpd: Use CAPABILITY_CODE_ADDPATH_LEN instead of numeric value
2 parents b3e5ee5 + 66c78c6 commit 490928b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

bgpd/bgp_open.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -665,15 +665,15 @@ static int bgp_capability_addpath(struct peer *peer,
665665
SET_FLAG(peer->cap, PEER_CAP_ADDPATH_RCV);
666666

667667
/* Verify length is a multiple of 4 */
668-
if (hdr->length % 4) {
668+
if (hdr->length % CAPABILITY_CODE_ADDPATH_LEN) {
669669
flog_warn(
670670
EC_BGP_CAPABILITY_INVALID_LENGTH,
671671
"Add Path: Received invalid length %d, non-multiple of 4",
672672
hdr->length);
673673
return -1;
674674
}
675675

676-
while (stream_get_getp(s) + 4 <= end) {
676+
while (stream_get_getp(s) + CAPABILITY_CODE_ADDPATH_LEN <= end) {
677677
afi_t afi;
678678
safi_t safi;
679679
iana_afi_t pkt_afi = stream_getw(s);

0 commit comments

Comments
 (0)