]> git.puffer.fish Git - matthieu/frr.git/commitdiff
bgpd: forge bgp flowspec packets to be sent
authorPhilippe Guibert <philippe.guibert@6wind.com>
Tue, 21 Jan 2020 12:17:45 +0000 (13:17 +0100)
committerPhilippe Guibert <philippe.guibert@6wind.com>
Tue, 4 Feb 2020 16:40:11 +0000 (17:40 +0100)
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 <philippe.guibert@6wind.com>
bgpd/bgp_attr.c

index a0c34f58c3f8bccc67be1a191173eff1cae1d471..f1c91382a45148e32e3fe076ea53796bbd35b4a4 100644 (file)
@@ -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);
 }