0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-22 17:51:53 +00:00

BGP: Fix extended messages

Change attribute length limit to handle extended (64 kB) messages.

Do not mix updates and withdraws (RFC 7606).
This commit is contained in:
Ondrej Zajicek (work) 2016-07-11 20:41:32 +02:00
parent f0b822a831
commit ea0cb652e9

View File

@ -369,7 +369,7 @@ bgp_create_update(struct bgp_conn *conn, byte *buf)
} }
put_u16(buf, wd_size); put_u16(buf, wd_size);
if (remains >= 3072) if (!wd_size)
{ {
while ((buck = (struct bgp_bucket *) HEAD(p->bucket_queue))->send_node.next) while ((buck = (struct bgp_bucket *) HEAD(p->bucket_queue))->send_node.next)
{ {
@ -382,7 +382,7 @@ bgp_create_update(struct bgp_conn *conn, byte *buf)
} }
DBG("Processing bucket %p\n", buck); DBG("Processing bucket %p\n", buck);
a_size = bgp_encode_attrs(p, w+2, buck->eattrs, 2048); a_size = bgp_encode_attrs(p, w+2, buck->eattrs, remains - 1024);
if (a_size < 0) if (a_size < 0)
{ {
@ -461,8 +461,7 @@ bgp_create_update(struct bgp_conn *conn, byte *buf)
w += size; w += size;
remains -= size; remains -= size;
} }
else
if (remains >= 3072)
{ {
while ((buck = (struct bgp_bucket *) HEAD(p->bucket_queue))->send_node.next) while ((buck = (struct bgp_bucket *) HEAD(p->bucket_queue))->send_node.next)
{ {
@ -478,7 +477,7 @@ bgp_create_update(struct bgp_conn *conn, byte *buf)
rem_stored = remains; rem_stored = remains;
w_stored = w; w_stored = w;
size = bgp_encode_attrs(p, w, buck->eattrs, 2048); size = bgp_encode_attrs(p, w, buck->eattrs, remains - 1024);
if (size < 0) if (size < 0)
{ {
log(L_ERR "%s: Attribute list too long, skipping corresponding routes", p->p.name); log(L_ERR "%s: Attribute list too long, skipping corresponding routes", p->p.name);