]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: Allow filtering Encap attribute
authorDonatas Abraitis <donatas@opensourcerouting.org>
Sun, 25 Aug 2024 16:11:01 +0000 (19:11 +0300)
committerDonatas Abraitis <donatas@opensourcerouting.org>
Sun, 25 Aug 2024 16:11:01 +0000 (19:11 +0300)
Filtering this attribute via `path-attribute discard/treat-as-widthraw`.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
bgpd/bgp_attr.c

index cc4a0d203264cac092e60b43127647e6d9c97810..9a42ea81990c9988cfbf8b5710456d77a17338ce 100644 (file)
@@ -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);
 }