diff options
author | Ondrej Zajicek <santiago@crfreenet.org> | 2009-04-23 12:36:24 +0200 |
---|---|---|
committer | Ondrej Zajicek <santiago@crfreenet.org> | 2009-04-23 12:36:24 +0200 |
commit | b9539e78d8ebfa9e13d7b61ec9278b76abefdac3 (patch) | |
tree | 58dab387dfc432d609ed45947e5976bf496d625a | |
parent | e366625c0ef21d02caf2dab1935862ace1e10fed (diff) | |
download | bird-b9539e78d8ebfa9e13d7b61ec9278b76abefdac3.tar bird-b9539e78d8ebfa9e13d7b61ec9278b76abefdac3.zip |
Fixes bug in BGPv6 causing crash by checking missing attributes.
-rw-r--r-- | proto/bgp/attrs.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/proto/bgp/attrs.c b/proto/bgp/attrs.c index b7c5f2e..57dce14 100644 --- a/proto/bgp/attrs.c +++ b/proto/bgp/attrs.c @@ -1359,17 +1359,19 @@ bgp_decode_attrs(struct bgp_conn *conn, byte *attr, unsigned int len, struct lin mandatory = 1; #endif + + /* If there is no (reachability) NLRI, we should exit now */ + if (! mandatory) + return a; + /* Check if all mandatory attributes are present */ - if (mandatory) + for(i=0; i < ARRAY_SIZE(bgp_mandatory_attrs); i++) { - for(i=0; i < ARRAY_SIZE(bgp_mandatory_attrs); i++) + code = bgp_mandatory_attrs[i]; + if (!(seen[code/8] & (1 << (code%8)))) { - code = bgp_mandatory_attrs[i]; - if (!(seen[code/8] & (1 << (code%8)))) - { - bgp_error(conn, 3, 3, &bgp_mandatory_attrs[i], 1); - return NULL; - } + bgp_error(conn, 3, 3, &bgp_mandatory_attrs[i], 1); + return NULL; } } |