]> git.proxmox.com Git - mirror_frr.git/commitdiff
bgpd: Add support for flowspec prefixes in bgp_packet_mpattr_prefix_size
authorStephane Poignant <stephane.poignant@proton.ch>
Thu, 15 Dec 2022 13:53:48 +0000 (14:53 +0100)
committerStephane Poignant <stephane.poignant@proton.ch>
Thu, 15 Dec 2022 13:53:48 +0000 (14:53 +0100)
Currently, bgp_packet_mpattr_prefix_size (bgpd/bgp_attr.c:3978) always returns zero for Flowspec prefixes.
This is because, for flowspec prefixes, the prefixlen attribute of the prefix struct is always set to 0, and the actual length is bytes is set inside the flowspec_prefix struct instead (see lib/prefix.h:293 and lib/prefix.h:178).
Because of this, with a large number of flowspec NLRIs, bgpd ends up building update messages that exceed the maximum size and cause the peer to drop the connection (bgpd/bgp_updgrp_packet.c:L719).
The proposed change allows the bgp_packet_mpattr_prefix_size to return correct result for flowspec prefixes.

Signed-off-by: Stephane Poignant <stephane.poignant@proton.ch>
bgpd/bgp_attr.c

index 06fff413782dc860143b9f10f097ffdd166f6c45..337a82b9456ce93d0424eacf0c99ea0416da6433 100644 (file)
@@ -3986,6 +3986,8 @@ size_t bgp_packet_mpattr_prefix_size(afi_t afi, safi_t safi,
        else if (afi == AFI_L2VPN && safi == SAFI_EVPN)
                size += 232; // TODO: Maximum possible for type-2, type-3 and
                             // type-5
+       else if (safi == SAFI_FLOWSPEC)
+               size = ((struct prefix_fs *)p)->prefix.prefixlen;
        return size;
 }