]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: Fix AS_PATH size calculation for long paths 1154/head
authorAndreas Jaggi <aj@open.ch>
Fri, 8 Sep 2017 11:46:20 +0000 (07:46 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 8 Sep 2017 11:54:03 +0000 (07:54 -0400)
If you have an AS_PATH with more entries than
what can be written into a single AS_SEGMENT_MAX
it needs to be broken up.  The code that noticed
that the AS_PATH needs to be broken up was not
correctly calculating the size of the resulting
message.  This patch addresses this issue.

This patch was built from an email that Andreas
sent to the dev alias for FRRouting.

Fixes: #1114
Signed-off-by: Andreas Jaggi <aj@open.ch>
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
bgpd/bgp_aspath.c

index 2ce52d92a5acb40d4eaa25db9216cf5192bec91f..2b776d218277ce7eadd2675d3288a1c6845cbfac 100644 (file)
@@ -892,7 +892,7 @@ size_t aspath_put(struct stream *s, struct aspath *as, int use32bit)
                                assegment_data_put(s, seg->as, AS_SEGMENT_MAX,
                                                   use32bit);
                                written += AS_SEGMENT_MAX;
-                               bytes += ASSEGMENT_SIZE(written, use32bit);
+                               bytes += ASSEGMENT_SIZE(AS_SEGMENT_MAX, use32bit);
                        }
 
                        /* write the final segment, probably is also the first