From f1af8f04e7a46d04b8fdc742aa0633aac6514157 Mon Sep 17 00:00:00 2001 From: Philippe Guibert Date: Tue, 21 Jan 2020 13:17:45 +0100 Subject: [PATCH] bgpd: forge bgp flowspec packets to be sent bgp flowspec packets are being forged correctly. There is no need to check for bgp length, as the bgp nlri length is checked at reception. Signed-off-by: Philippe Guibert --- bgpd/bgp_attr.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c index a0c34f58c3..f1c91382a4 100644 --- a/bgpd/bgp_attr.c +++ b/bgpd/bgp_attr.c @@ -3097,13 +3097,9 @@ void bgp_packet_mpattr_prefix(struct stream *s, afi_t afi, safi_t safi, stream_put_labeled_prefix(s, p, label, addpath_encode, addpath_tx_id); } else if (safi == SAFI_FLOWSPEC) { - if (PSIZE (p->prefixlen)+2 < FLOWSPEC_NLRI_SIZELIMIT) - stream_putc(s, PSIZE (p->prefixlen)+2); - else - stream_putw(s, (PSIZE (p->prefixlen)+2)|(0xf<<12)); - stream_putc(s, 2);/* Filter type */ - stream_putc(s, p->prefixlen);/* Prefix length */ - stream_put(s, &p->u.prefix, PSIZE (p->prefixlen)); + stream_putc(s, p->u.prefix_flowspec.prefixlen); + stream_put(s, (const void *)p->u.prefix_flowspec.ptr, + p->u.prefix_flowspec.prefixlen); } else stream_put_prefix_addpath(s, p, addpath_encode, addpath_tx_id); }