From f92d1b2647bfb5937f1e5f131350a300f1224136 Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Tue, 24 Jan 2023 10:32:13 +0200 Subject: [PATCH] bgpd: Set attr to NULL when passing NLRI_UPDATE with treat-as-withdraw 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 --- bgpd/bgp_packet.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c index 9e7c75318e..080cf0ae40 100644 --- a/bgpd/bgp_packet.c +++ b/bgpd/bgp_packet.c @@ -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; -- 2.39.5