From: Ondrej Zajicek Date: Thu, 23 Apr 2009 12:44:02 +0000 (+0200) Subject: Fixes BGPv6 bug - mandatory attributes weren't validated; X-Git-Tag: v1.2.0~117 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f307842ad85396f8186fa049d551b6cde9925484;p=thirdparty%2Fbird.git Fixes BGPv6 bug - mandatory attributes weren't validated; --- diff --git a/proto/bgp/attrs.c b/proto/bgp/attrs.c index 57dce1467..a015c2b37 100644 --- a/proto/bgp/attrs.c +++ b/proto/bgp/attrs.c @@ -1355,11 +1355,11 @@ bgp_decode_attrs(struct bgp_conn *conn, byte *attr, unsigned int len, struct lin } #ifdef IPV6 - if (seen[BA_MP_REACH_NLRI / 8] & (1 << (BA_MP_REACH_NLRI % 8))) + /* If we received MP_REACH_NLRI we should check mandatory attributes */ + if (bgp->mp_reach_len != 0) mandatory = 1; #endif - /* If there is no (reachability) NLRI, we should exit now */ if (! mandatory) return a; @@ -1374,7 +1374,7 @@ bgp_decode_attrs(struct bgp_conn *conn, byte *attr, unsigned int len, struct lin return NULL; } } - + /* When receiving attributes from non-AS4-aware BGP speaker, * we have to reconstruct 4B AS_PATH and AGGREGATOR attributes */ @@ -1396,6 +1396,7 @@ bgp_decode_attrs(struct bgp_conn *conn, byte *attr, unsigned int len, struct lin /* If there's no local preference, define one */ if (!(seen[0] & (1 << BA_LOCAL_PREF))) bgp_attach_attr(&a->eattrs, pool, BA_LOCAL_PREF, 0); + return a; loop: