mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-08 09:30:30 +00:00
bgpd: Set AS4 capability received flag only if parsed correctly
If we receive a malformed packet, we might end-up with a bad state. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
This commit is contained in:
parent
49cacc3184
commit
b571176aea
@ -622,8 +622,6 @@ static int bgp_capability_llgr(struct peer *peer,
|
|||||||
/* Unlike other capability parsing routines, this one returns 0 on error */
|
/* Unlike other capability parsing routines, this one returns 0 on error */
|
||||||
static as_t bgp_capability_as4(struct peer *peer, struct capability_header *hdr)
|
static as_t bgp_capability_as4(struct peer *peer, struct capability_header *hdr)
|
||||||
{
|
{
|
||||||
SET_FLAG(peer->cap, PEER_CAP_AS4_RCV);
|
|
||||||
|
|
||||||
if (hdr->length != CAPABILITY_CODE_AS4_LEN) {
|
if (hdr->length != CAPABILITY_CODE_AS4_LEN) {
|
||||||
flog_err(EC_BGP_PKT_OPEN,
|
flog_err(EC_BGP_PKT_OPEN,
|
||||||
"%s AS4 capability has incorrect data length %d",
|
"%s AS4 capability has incorrect data length %d",
|
||||||
@ -633,6 +631,8 @@ static as_t bgp_capability_as4(struct peer *peer, struct capability_header *hdr)
|
|||||||
|
|
||||||
as_t as4 = stream_getl(BGP_INPUT(peer));
|
as_t as4 = stream_getl(BGP_INPUT(peer));
|
||||||
|
|
||||||
|
SET_FLAG(peer->cap, PEER_CAP_AS4_RCV);
|
||||||
|
|
||||||
if (BGP_DEBUG(as4, AS4))
|
if (BGP_DEBUG(as4, AS4))
|
||||||
zlog_debug(
|
zlog_debug(
|
||||||
"%s [AS4] about to set cap PEER_CAP_AS4_RCV, got as4 %u",
|
"%s [AS4] about to set cap PEER_CAP_AS4_RCV, got as4 %u",
|
||||||
|
Loading…
Reference in New Issue
Block a user