summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Ovsienko <infrastation@yandex.ru>2011-09-20 10:54:25 +0400
committerDenis Ovsienko <infrastation@yandex.ru>2011-09-27 21:19:44 +0400
commit2cfadf09a810e3b660a47a1eb898d0d7c8813c08 (patch)
tree135d9df7af95fed3ffaaa380a22c4a93897f5263
parent0ea968d21f194b3960a73aa47a5b06f160632907 (diff)
bgpd: check MULTI_EXIT_DISC attr flags (BZ#677)
* bgp_attr.c * bgp_attr_med(): add checks for "optional", "transitive" and "partial" bits, log each error condition independently
-rw-r--r--bgpd/bgp_attr.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c
index 337ddb7c..a9866994 100644
--- a/bgpd/bgp_attr.c
+++ b/bgpd/bgp_attr.c
@@ -1004,6 +1004,38 @@ bgp_attr_med (struct peer *peer, bgp_size_t length,
total = length + (CHECK_FLAG (flag, BGP_ATTR_FLAG_EXTLEN) ? 4 : 3);
+ /* Flag checks. */
+ if (! CHECK_FLAG (flag, BGP_ATTR_FLAG_OPTIONAL))
+ {
+ zlog (peer->log, LOG_ERR,
+ "MULTI_EXIT_DISC 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,
+ "MULTI_EXIT_DISC attribute must not 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;
+ }
+ if (CHECK_FLAG (flag, BGP_ATTR_FLAG_PARTIAL))
+ {
+ zlog (peer->log, LOG_ERR,
+ "MULTI_EXIT_DISC attribute must not be flagged as \"partial\" (%u)", flag);
+ bgp_notify_send_with_data (peer,
+ BGP_NOTIFY_UPDATE_ERR,
+ BGP_NOTIFY_UPDATE_ATTR_FLAG_ERR,
+ startp, total);
+ return -1;
+ }
+
/* Length check. */
if (length != 4)
{