From b713df85bd818fa653a2e06ba7e74d94972e0e51 Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Sun, 25 Aug 2024 19:11:01 +0300 Subject: [PATCH] bgpd: Allow filtering Encap attribute Filtering this attribute via `path-attribute discard/treat-as-widthraw`. Signed-off-by: Donatas Abraitis --- bgpd/bgp_attr.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c index cc4a0d2032..9a42ea8199 100644 --- a/bgpd/bgp_attr.c +++ b/bgpd/bgp_attr.c @@ -2790,6 +2790,9 @@ static int bgp_attr_encap(struct bgp_attr_parser_args *args) uint8_t type = args->type; uint8_t flag = args->flags; + if (peer->discard_attrs[args->type] || peer->withdraw_attrs[args->type]) + goto encap_ignore; + if (!CHECK_FLAG(flag, BGP_ATTR_FLAG_TRANS) || !CHECK_FLAG(flag, BGP_ATTR_FLAG_OPTIONAL)) { zlog_err("Tunnel Encap attribute flag isn't optional and transitive %d", @@ -2908,7 +2911,12 @@ static int bgp_attr_encap(struct bgp_attr_parser_args *args) args->total); } - return 0; + return BGP_ATTR_PARSE_PROCEED; + +encap_ignore: + stream_forward_getp(peer->curr, length); + + return bgp_attr_ignore(peer, type); } -- 2.39.5