Skip to content

A NOTIFICATION message is sent when an error condition is detected. The BGP connection is closed immediately after it is sent. In addition to the fixed-size BGP header, the NOTIFICATION message contains the following fields:

  0                   1                   2                   3
  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  | Error code    | Error subcode |   Data (variable)             |
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

  Error Code:
     This 1-octet unsigned integer indicates the type of
     NOTIFICATION.  The following Error Codes have been defined:
        Error Code       Symbolic Name               Reference
          1         Message Header Error             Section 6.1
          2         OPEN Message Error               Section 6.2
          3         UPDATE Message Error             Section 6.3
          4         Hold Timer Expired               Section 6.5
          5         Finite State Machine Error       Section 6.6
          6         Cease                            Section 6.7
  Error subcode:
     This 1-octet unsigned integer provides more specific
     information about the nature of the reported error.  Each Error
     Code may have one or more Error Subcodes associated with it.
     If no appropriate Error Subcode is defined, then a zero
     (Unspecific) value is used for the Error Subcode field.
  Message Header Error subcodes:
           1 - Connection Not Synchronized.
           2 - Bad Message Length.
           3 - Bad Message Type.

  OPEN Message Error subcodes:

           1 - Unsupported Version Number.
           2 - Bad Peer AS.
           3 - Bad BGP Identifier.
           4 - Unsupported Optional Parameter.
           5 - \[Deprecated - see Appendix A\].
           6 - Unacceptable Hold Time.

  UPDATE Message Error subcodes:

           1 - Malformed Attribute List.
           2 - Unrecognized Well-known Attribute.
           3 - Missing Well-known Attribute.
           4 - Attribute Flags Error.
           5 - Attribute Length Error.
           6 - Invalid ORIGIN Attribute.
           7 - \[Deprecated - see Appendix A\].
           8 - Invalid NEXT_HOP Attribute.
           9 - Optional Attribute Error.
          10 - Invalid Network Field.
          11 - Malformed AS_PATH.

  Data:

     This variable-length field is used to diagnose the reason for
     the NOTIFICATION.  The contents of the Data field depend upon
     the Error Code and Error Subcode.  See Section 6 for more
     details.

     Note that the length of the Data field can be determined from
     the message Length field by the formula:

              Message Length = 21 + Data Length

The minimum length of the NOTIFICATION message is 21 octets (including message header).

object bgp_notification_message = {
    type this = struct {
        error_code: bgp_error_code,
        error_subcode: bgp_error_subcode,
        data: stream_data # TODO for now we cannot knwo the size of the message, use envvar ?
    }
}


action   bgp_notification_message_event(src:bgp_id,dst:bgp_id,bgp_message:bgp_notification_message) = {}
relation is_errored(C:bgp_id)

around bgp_notification_message_event(src:bgp_id,dst:bgp_id,bgp_message:bgp_notification_message) {
    require isup(bgpid_to_endpoint(src));
    require open_message_recv(src) & open_message_recv(dst);
    require is_errored(src);
    require bgp_message.error_code = bgp_error_code.header_mess_error |
            bgp_message.error_code = bgp_error_code.open_mess_error   |
            bgp_message.error_code = bgp_error_code.update_mess_error   |
            bgp_message.error_code = bgp_error_code.hold_timer_expire   |
            bgp_message.error_code = bgp_error_code.fsm_error   |
            bgp_message.error_code = bgp_error_code.cease_error;
TODO modify the deser/ser require bgp_message.error_code = bgp_error_code.header_mess_error -> (bgp_message.error_subcode = bgp_error_subcode.type_bgp_header_error_subcode.code.connection_not_synchronized | bgp_message.error_subcode = bgp_error_subcode.type_bgp_header_error_subcode.code.bad_message_length | bgp_message.error_subcode = bgp_error_subcode.type_bgp_header_error_subcode.code.bad_message_type);

require bgp_message.error_code = bgp_error_code.open_mess_error -> (bgp_message.error_subcode = bgp_open_error_subcode.unsupported_version_number | bgp_message.error_subcode = bgp_open_error_subcode.bad_peer_as | bgp_message.error_subcode = bgp_open_error_subcode.bad_bgp_identifier | bgp_message.error_subcode = bgp_open_error_subcode.unsupported_optional_parameter | bgp_message.error_subcode = bgp_open_error_subcode.unacceptable_hold_time | bgp_message.error_subcode = bgp_open_error_subcode.unsupported_capability);

require bgp_message.error_code = 3 -> (bgp_message.error_subcode >= 1 & bgp_message.error_subcode <= 11);ยค

    ...
    require isup(bgpid_to_endpoint(src));
}