From e7d2ac4401be8aaf9629e248cad6a74498a6be24 Mon Sep 17 00:00:00 2001 From: Ondrej Zajicek Date: Tue, 26 Nov 2013 22:37:24 +0100 Subject: Finishes add-path. Fixes some bugs and uses generic hash implementation. --- proto/bgp/packets.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'proto/bgp/packets.c') 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; -- cgit v1.2.3