From: Andreas Jaggi Date: Fri, 8 Sep 2017 11:46:20 +0000 (-0400) Subject: bgpd: Fix AS_PATH size calculation for long paths X-Git-Tag: frr-4.0-dev~321^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=refs%2Fpull%2F1154%2Fhead;p=mirror%2Ffrr.git bgpd: Fix AS_PATH size calculation for long paths 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 Signed-off-by: Donald Sharp --- diff --git a/bgpd/bgp_aspath.c b/bgpd/bgp_aspath.c index 2ce52d92a5..2b776d2182 100644 --- a/bgpd/bgp_aspath.c +++ b/bgpd/bgp_aspath.c @@ -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