bgpd: Allow filtering Prefix-SID attribute

Filtering this attribute via `path-attribute discard/treat-as-widthraw`.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
This commit is contained in:
Donatas Abraitis 2024-08-25 19:03:05 +03:00
parent 05c17eff06
commit f390253ca7

View file

@ -3300,6 +3300,9 @@ enum bgp_attr_parse_ret bgp_attr_prefix_sid(struct bgp_attr_parser_args *args)
size_t headersz = sizeof(type) + sizeof(length);
size_t psid_parsed_length = 0;
if (peer->discard_attrs[args->type] || peer->withdraw_attrs[args->type])
goto prefix_sid_ignore;
while (STREAM_READABLE(peer->curr) > 0
&& psid_parsed_length < args->length) {
@ -3347,6 +3350,11 @@ 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;
prefix_sid_ignore:
stream_forward_getp(peer->curr, args->length);
return bgp_attr_ignore(peer, args->type);
}
/* PMSI tunnel attribute (RFC 6514)