From 66c78c6c58539a4ed5132adbc5a5b1d86194b90c Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Sun, 17 Dec 2023 12:03:36 +0200 Subject: [PATCH] bgpd: Use CAPABILITY_CODE_ADDPATH_LEN instead of numeric value Signed-off-by: Donatas Abraitis --- bgpd/bgp_open.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bgpd/bgp_open.c b/bgpd/bgp_open.c index 44cf8343c6be..4180c7d3454f 100644 --- a/bgpd/bgp_open.c +++ b/bgpd/bgp_open.c @@ -665,7 +665,7 @@ 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", @@ -673,7 +673,7 @@ static int bgp_capability_addpath(struct peer *peer, 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);