summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Ovsienko <infrastation@yandex.ru>2011-10-22 22:11:31 +0400
committerDenis Ovsienko <infrastation@yandex.ru>2011-11-21 18:32:45 +0400
commit12da1a188a5e5bfdfecb98c48ecca48ed38e2d89 (patch)
tree3f57640c9778fcd13434ef9f5b722e6e94bfc370
parentc6cb2d9151fc14f9c2b1b7618695874cc8d97286 (diff)
bgpd: check AGGREGATOR attr flags (BZ#678)
* bgp_attr.c * bgp_attr_aggregator(): check Optional/Transitive flag bits
-rw-r--r--bgpd/bgp_attr.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c
index 55691fda..7c94f7e0 100644
--- a/bgpd/bgp_attr.c
+++ b/bgpd/bgp_attr.c
@@ -1103,6 +1103,27 @@ 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);
+ bgp_notify_send_with_data (peer,
+ BGP_NOTIFY_UPDATE_ERR,
+ BGP_NOTIFY_UPDATE_ATTR_FLAG_ERR,
+ startp, total);
+ return -1;
+ }
+ if (! CHECK_FLAG (flag, BGP_ATTR_FLAG_TRANS))
+ {
+ zlog (peer->log, LOG_ERR,
+ "AGGREGATOR attribute must be flagged as \"transitive\" (%u)", flag);
+ bgp_notify_send_with_data (peer,
+ BGP_NOTIFY_UPDATE_ERR,
+ BGP_NOTIFY_UPDATE_ATTR_FLAG_ERR,
+ startp, total);
+ return -1;
+ }
/* 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;