diff options
author | Ondrej Zajicek <santiago@crfreenet.org> | 2009-02-27 15:24:46 +0100 |
---|---|---|
committer | Ondrej Zajicek <santiago@crfreenet.org> | 2009-02-27 15:24:46 +0100 |
commit | 82a79586e5810af2f0338cb4c5982e085b5c5292 (patch) | |
tree | c25310da25f371ed78028f406eeb55e2587e7077 /proto/bgp/attrs.c | |
parent | cb5303927188de9504a6e18aedec299956a22b6f (diff) | |
download | bird-82a79586e5810af2f0338cb4c5982e085b5c5292.tar bird-82a79586e5810af2f0338cb4c5982e085b5c5292.zip |
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.
Diffstat (limited to 'proto/bgp/attrs.c')
-rw-r--r-- | proto/bgp/attrs.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/proto/bgp/attrs.c b/proto/bgp/attrs.c index d8a6aad..91d4d06 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 |