From 82a79586e5810af2f0338cb4c5982e085b5c5292 Mon Sep 17 00:00:00 2001 From: Ondrej Zajicek Date: Fri, 27 Feb 2009 15:24:46 +0100 Subject: Better handling of too long attributes This patch extends the length for attributes from 1024 to 2048 (because both AS_PATH and AS4_PATH attributes take 2+4 B per AS). If there is not enough space for attributes, Bird skips that route group. Old behavior (skipping remaining attributes) leads to skipping required attributes and session drop. --- proto/bgp/attrs.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'proto/bgp/attrs.c') diff --git a/proto/bgp/attrs.c b/proto/bgp/attrs.c index d8a6aad4..91d4d064 100644 --- a/proto/bgp/attrs.c +++ b/proto/bgp/attrs.c @@ -347,7 +347,7 @@ bgp_get_attr_len(eattr *a) * The bgp_encode_attrs() function takes a list of extended attributes * and converts it to its BGP representation (a part of an Update message). * - * Result: Length of the attribute block generated. + * Result: Length of the attribute block generated or -1 if not enough space. */ unsigned int bgp_encode_attrs(struct bgp_proto *p, byte *w, ea_list *attrs, int remains) @@ -488,8 +488,7 @@ bgp_encode_attrs(struct bgp_proto *p, byte *w, ea_list *attrs, int remains) return w - start; err_no_buffer: - log(L_ERR "BGP: attribute list too long, ignoring the remaining attributes"); - return w - start; + return -1; } static void -- cgit v1.2.3