]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: Set attr to NULL when passing NLRI_UPDATE with treat-as-withdraw
authorDonatas Abraitis <donatas@opensourcerouting.org>
Tue, 24 Jan 2023 08:32:13 +0000 (10:32 +0200)
committerDonatas Abraitis <donatas@opensourcerouting.org>
Wed, 1 Feb 2023 20:57:34 +0000 (22:57 +0200)
Before this patch, we always passed `struct attr` for NLRI_UPDATE, but if we
have a situation with treat-as-withdraw (for example: malformed attribute, or
using a command like `neighbor path-attribute treat-as-withdraw`) the route
MUST be withdrawn form the BGP table.

Hence, we MUST pass attr as NULL, in this case we already have this check
under NLRI_ATTR_ARG() macro, just reuse it properly.

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

index 9e7c75318e8a3384e504cbf2026fa4af1a278b57..080cf0ae40405ac1c05a6b4ef24d134f23d32ad7 100644 (file)
@@ -2033,7 +2033,8 @@ static int bgp_update_receive(struct peer *peer, bgp_size_t size)
                        break;
                case NLRI_WITHDRAW:
                case NLRI_MP_WITHDRAW:
-                       nlri_ret = bgp_nlri_parse(peer, &attr, &nlris[i], 1);
+                       nlri_ret = bgp_nlri_parse(peer, NLRI_ATTR_ARG,
+                                                 &nlris[i], 1);
                        break;
                default:
                        nlri_ret = BGP_NLRI_PARSE_ERROR;