summaryrefslogtreecommitdiff
path: root/proto/bgp/packets.c
diff options
context:
space:
mode:
authorOndrej Zajicek <santiago@crfreenet.org>2013-11-26 22:37:24 +0100
committerOndrej Zajicek <santiago@crfreenet.org>2013-12-01 13:49:42 +0100
commite7d2ac4401be8aaf9629e248cad6a74498a6be24 (patch)
tree43fc2a026bb83c56d614e8551701ce9feaef71f2 /proto/bgp/packets.c
parent283c7dfada53a6dee6a8a17ecab492ffafd44b66 (diff)
Finishes add-path.
Fixes some bugs and uses generic hash implementation.
Diffstat (limited to 'proto/bgp/packets.c')
-rw-r--r--proto/bgp/packets.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/proto/bgp/packets.c b/proto/bgp/packets.c
index 42064332..649d8078 100644
--- a/proto/bgp/packets.c
+++ b/proto/bgp/packets.c
@@ -244,7 +244,7 @@ bgp_encode_prefixes(struct bgp_proto *p, byte *w, struct bgp_bucket *buck, unsig
ip_addr a;
int bytes;
- while (!EMPTY_LIST(buck->prefixes) && remains >= (1+sizeof(ip_addr)))
+ while (!EMPTY_LIST(buck->prefixes) && (remains >= (5+sizeof(ip_addr))))
{
struct bgp_prefix *px = SKIP_BACK(struct bgp_prefix, bucket_node, HEAD(buck->prefixes));
DBG("\tDequeued route %I/%d\n", px->n.prefix, px->n.pxlen);
@@ -253,6 +253,7 @@ bgp_encode_prefixes(struct bgp_proto *p, byte *w, struct bgp_bucket *buck, unsig
{
put_u32(w, px->path_id);
w += 4;
+ remains -= 4;
}
*w++ = px->n.pxlen;