BGP attributes are used to keep track of route-specific information
such as path information, route preference, the next-hop, and
aggregation information, which are used in by BGP to filter and
choose the best route . Every UPDATE message has a variable-length
sequence of path attributes in the variable length form
<attribute type, attribute length, attribute value>. The
attribute type is a 2-byte field that consists of a 1-byte attribute
flag and a 1-byte attribute type code. The figure illustrates the
general form of the path attribute type field.
Path attributes fall under four categories: well-known mandatory,
well-known discretionary, optional transitive, and optional
nontransitive. These four categories are described by the first two
bits of the path attribute flags field.
If the first bit of the flag field is 0, the attribute is
well-known; if it's a 1, the attribute is optional. If the second
bit of the flag field is 0, the attribute is non-transitive; if it's
a 1, the attribute is transitive. Well-known attributes are always
transitive.
The following descriptions elaborate on the significance of each
attribute category:
- Well-known mandatory -- An attribute that has to exist in
the BGP UPDATE packet. It must be recognized by all BGP
implementations. If a well-known attribute is missing, a
notification error will be generated; this ensures that all BGP
implementations agree on a standard set of attributes. An
example of a well-known mandatory attribute is the AS_path
attribute.
- Well-known discretionary -- An attribute that is
recognized by all BGP implementations, but may or may not be
sent in the BGP UPDATE message. An example of a well-known
discretionary attribute is the LOCAL_PREF.
In addition to the well-known attributes, a path can contain one
or more optional attributes; BGP implementations aren't required to
support optional attributes Optional attributes can be transitive or
nontransitive.
- Optional transitive -- If the attribute is transitive,
BGP should accept and advertise the attribute even if it isn't
recognized.
- Optional nontransitive -- When an optional attribute is
not recognized and the transitive flag is not set -- the attribute
is nontransitive -- the attribute should be quietly ignored and not
passed along to other BGP peers.
The attribute type code byte contains the attribute code.
Currently, the following attributes are defined:
1 -- ORIGIN (well-known mandatory, type code 1)
2-- AS_path (well-known mandatory, type code 2)
3 -- NEXT_HOP (well-known mandatory, type code 3)
4 -- MULTI_EXIT_DISC (optional nontransitive, type code 4)
5 -- LOCAL_PREF (well-known discretionary, type code 5)
6 -- ATOMIC_AGGREGATE (well-known discretionary, type code 6)
7 -- AGGREGATOR (optional transitive, type code 7)
8 -- COMMUNITY (optional transitive, type code 8, Cisco
defined)
9 -- ORIGINATOR_ID (optional nontransitive, type code 9,
Cisco defined)
10 -- Cluster List (optional nontransitive, Type code 10,
Cisco defined)
11 -- Destination Preference (MCI defined)
12 -- Advertiser (Baynet defined)
13 -- rcid_path (Baynet defined)
255 -- Reserved for development
Several of these attributes will be discussed in detail in the
next section. Attributes 11, 12, and 13 are not implemented by Cisco
because they do not add additional functionality. These attributes
are not covered.
Finally, the third bit in the attributes flag indicates whether
the information in the optional transitive attribute is partial (1)
or complete (0). The fourth bit defines whether the attribute length
is 1 byte (0) or 2 bytes (1). The other four bits in the flags field
are always set to 0.