mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-07 20:34:33 +00:00
bgpd: Do not check against aspath seg
which is already checked before
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
This commit is contained in:
parent
707bb5a09c
commit
9c73cd41f7
@ -910,7 +910,6 @@ size_t aspath_put(struct stream *s, struct aspath *as, int use32bit)
|
|||||||
if (!seg || seg->length == 0)
|
if (!seg || seg->length == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (seg) {
|
|
||||||
/*
|
/*
|
||||||
* Hey, what do we do when we have > STREAM_WRITABLE(s) here?
|
* Hey, what do we do when we have > STREAM_WRITABLE(s) here?
|
||||||
* At the moment, we would write out a partial aspath, and our
|
* At the moment, we would write out a partial aspath, and our
|
||||||
@ -920,8 +919,7 @@ size_t aspath_put(struct stream *s, struct aspath *as, int use32bit)
|
|||||||
* The general assumption here is that many things tested will
|
* The general assumption here is that many things tested will
|
||||||
* never happen. And, in real live, up to now, they have not.
|
* never happen. And, in real live, up to now, they have not.
|
||||||
*/
|
*/
|
||||||
while (seg && (ASSEGMENT_LEN(seg, use32bit)
|
while (seg && (ASSEGMENT_LEN(seg, use32bit) <= STREAM_WRITEABLE(s))) {
|
||||||
<= STREAM_WRITEABLE(s))) {
|
|
||||||
struct assegment *next = seg->next;
|
struct assegment *next = seg->next;
|
||||||
int written = 0;
|
int written = 0;
|
||||||
int asns_packed = 0;
|
int asns_packed = 0;
|
||||||
@ -929,13 +927,11 @@ size_t aspath_put(struct stream *s, struct aspath *as, int use32bit)
|
|||||||
|
|
||||||
/* Overlength segments have to be split up */
|
/* Overlength segments have to be split up */
|
||||||
while ((seg->length - written) > AS_SEGMENT_MAX) {
|
while ((seg->length - written) > AS_SEGMENT_MAX) {
|
||||||
assegment_header_put(s, seg->type,
|
assegment_header_put(s, seg->type, AS_SEGMENT_MAX);
|
||||||
AS_SEGMENT_MAX);
|
assegment_data_put(s, (seg->as + written),
|
||||||
assegment_data_put(s, (seg->as + written), AS_SEGMENT_MAX,
|
AS_SEGMENT_MAX, use32bit);
|
||||||
use32bit);
|
|
||||||
written += AS_SEGMENT_MAX;
|
written += AS_SEGMENT_MAX;
|
||||||
bytes += ASSEGMENT_SIZE(AS_SEGMENT_MAX,
|
bytes += ASSEGMENT_SIZE(AS_SEGMENT_MAX, use32bit);
|
||||||
use32bit);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* write the final segment, probably is also the first
|
/* write the final segment, probably is also the first
|
||||||
@ -965,23 +961,20 @@ size_t aspath_put(struct stream *s, struct aspath *as, int use32bit)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* Next segment's data can fit in this one */
|
/* Next segment's data can fit in this one */
|
||||||
assegment_data_put(s, next->as, next->length,
|
assegment_data_put(s, next->as, next->length, use32bit);
|
||||||
use32bit);
|
|
||||||
|
|
||||||
/* update the length of the segment header */
|
/* update the length of the segment header */
|
||||||
stream_putc_at(s, lenp,
|
stream_putc_at(s, lenp,
|
||||||
seg->length - written
|
seg->length - written + next->length);
|
||||||
+ next->length);
|
|
||||||
asns_packed += next->length;
|
asns_packed += next->length;
|
||||||
|
|
||||||
next = next->next;
|
next = next->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
bytes += ASSEGMENT_SIZE(
|
bytes += ASSEGMENT_SIZE(seg->length - written + asns_packed,
|
||||||
seg->length - written + asns_packed, use32bit);
|
use32bit);
|
||||||
seg = next;
|
seg = next;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return bytes;
|
return bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user