mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-07-27 05:28:51 +00:00
bgpd: Fix error handling when receiving BGP Prefix SID attribute
Without this patch, we always set the BGP Prefix SID attribute flag without
checking if it's malformed or not. RFC8669 says that this attribute MUST be discarded.
Also, this fixes the bgpd crash when a malformed Prefix SID attribute is received,
with malformed transitive flags and/or TLVs.
Reported-by: Iggy Frankovic <iggyfran@amazon.com>
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit ba6a8f1a31
)
This commit is contained in:
parent
930fb97b29
commit
1cf60e53a4
@ -1390,6 +1390,7 @@ bgp_attr_malformed(struct bgp_attr_parser_args *args, uint8_t subcode,
|
|||||||
case BGP_ATTR_AS4_AGGREGATOR:
|
case BGP_ATTR_AS4_AGGREGATOR:
|
||||||
case BGP_ATTR_AGGREGATOR:
|
case BGP_ATTR_AGGREGATOR:
|
||||||
case BGP_ATTR_ATOMIC_AGGREGATE:
|
case BGP_ATTR_ATOMIC_AGGREGATE:
|
||||||
|
case BGP_ATTR_PREFIX_SID:
|
||||||
return BGP_ATTR_PARSE_PROCEED;
|
return BGP_ATTR_PARSE_PROCEED;
|
||||||
|
|
||||||
/* Core attributes, particularly ones which may influence route
|
/* Core attributes, particularly ones which may influence route
|
||||||
@ -3144,8 +3145,6 @@ enum bgp_attr_parse_ret bgp_attr_prefix_sid(struct bgp_attr_parser_args *args)
|
|||||||
struct attr *const attr = args->attr;
|
struct attr *const attr = args->attr;
|
||||||
enum bgp_attr_parse_ret ret;
|
enum bgp_attr_parse_ret ret;
|
||||||
|
|
||||||
attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_PREFIX_SID);
|
|
||||||
|
|
||||||
uint8_t type;
|
uint8_t type;
|
||||||
uint16_t length;
|
uint16_t length;
|
||||||
size_t headersz = sizeof(type) + sizeof(length);
|
size_t headersz = sizeof(type) + sizeof(length);
|
||||||
@ -3195,6 +3194,8 @@ enum bgp_attr_parse_ret bgp_attr_prefix_sid(struct bgp_attr_parser_args *args)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SET_FLAG(attr->flag, ATTR_FLAG_BIT(BGP_ATTR_PREFIX_SID));
|
||||||
|
|
||||||
return BGP_ATTR_PARSE_PROCEED;
|
return BGP_ATTR_PARSE_PROCEED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user