From f0bb2626ef2c847638393a366f1f894e9874d081 Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Sun, 25 Aug 2024 19:05:53 +0300 Subject: [PATCH] bgpd: Allow filtering PMSI Tunnel attribute Filtering this attribute via `path-attribute discard/treat-as-widthraw`. Signed-off-by: Donatas Abraitis --- bgpd/bgp_attr.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c index 9ce15d016b..cc4a0d2032 100644 --- a/bgpd/bgp_attr.c +++ b/bgpd/bgp_attr.c @@ -3369,6 +3369,9 @@ bgp_attr_pmsi_tunnel(struct bgp_attr_parser_args *args) uint8_t tnl_type; int attr_parse_len = 2 + BGP_LABEL_BYTES; + if (peer->discard_attrs[args->type] || peer->withdraw_attrs[args->type]) + goto pmsi_tunnel_ignore; + /* Verify that the receiver is expecting "ingress replication" as we * can only support that. */ @@ -3405,6 +3408,11 @@ bgp_attr_pmsi_tunnel(struct bgp_attr_parser_args *args) stream_forward_getp(peer->curr, length - attr_parse_len); return BGP_ATTR_PARSE_PROCEED; + +pmsi_tunnel_ignore: + stream_forward_getp(peer->curr, length); + + return bgp_attr_ignore(peer, args->type); } /* AIGP attribute (rfc7311) */ -- 2.39.5