diff options
author | Denis Ovsienko <infrastation@yandex.ru> | 2011-10-22 22:32:26 +0400 |
---|---|---|
committer | Denis Ovsienko <infrastation@yandex.ru> | 2011-10-22 22:32:26 +0400 |
commit | b4cd2421518be7e18046e974e25b9bf4cf769bd2 (patch) | |
tree | 43a94afcebc8b878040f771de5f0e542bb6bc440 /bgpd/bgp_attr.c | |
parent | bbb04bf3bb03be27fbf17b6b3ee903b168201cf0 (diff) |
bgpd: check AGGREGATOR attr flags (BZ#678)
* bgp_attr.c
* bgp_attr_aggregator(): check Optional/Transitive flag bits
Diffstat (limited to 'bgpd/bgp_attr.c')
-rw-r--r-- | bgpd/bgp_attr.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c index d7eeec1f..75b7c797 100644 --- a/bgpd/bgp_attr.c +++ b/bgpd/bgp_attr.c @@ -1160,6 +1160,23 @@ bgp_attr_aggregator (struct peer *peer, bgp_size_t length, bgp_size_t total; total = length + (CHECK_FLAG (flag, BGP_ATTR_FLAG_EXTLEN) ? 4 : 3); + /* Flags check. */ + if (! CHECK_FLAG (flag, BGP_ATTR_FLAG_OPTIONAL)) + { + zlog (peer->log, LOG_ERR, + "AGGREGATOR attribute must be flagged as \"optional\" (%u)", flag); + return bgp_attr_malformed (peer, BGP_ATTR_AGGREGATOR, flag, + BGP_NOTIFY_UPDATE_ATTR_FLAG_ERR, + startp, total); + } + if (! CHECK_FLAG (flag, BGP_ATTR_FLAG_TRANS)) + { + zlog (peer->log, LOG_ERR, + "AGGREGATOR attribute must be flagged as \"transitive\" (%u)", flag); + return bgp_attr_malformed (peer, BGP_ATTR_AGGREGATOR, flag, + BGP_NOTIFY_UPDATE_ATTR_FLAG_ERR, + startp, total); + } /* peer with AS4 will send 4 Byte AS, peer without will send 2 Byte */ if (CHECK_FLAG (peer->cap, PEER_CAP_AS4_RCV)) wantedlen = 8; |