Changeset View
Changeset View
Standalone View
Standalone View
contrib/tcpdump/print-bgp.c
Show First 20 Lines • Show All 126 Lines • ▼ Show 20 Lines | |||||
#define BGPTYPE_ADVERTISERS 12 /* RFC1863 */ | #define BGPTYPE_ADVERTISERS 12 /* RFC1863 */ | ||||
#define BGPTYPE_RCID_PATH 13 /* RFC1863 */ | #define BGPTYPE_RCID_PATH 13 /* RFC1863 */ | ||||
#define BGPTYPE_MP_REACH_NLRI 14 /* RFC2283 */ | #define BGPTYPE_MP_REACH_NLRI 14 /* RFC2283 */ | ||||
#define BGPTYPE_MP_UNREACH_NLRI 15 /* RFC2283 */ | #define BGPTYPE_MP_UNREACH_NLRI 15 /* RFC2283 */ | ||||
#define BGPTYPE_EXTD_COMMUNITIES 16 /* draft-ietf-idr-bgp-ext-communities */ | #define BGPTYPE_EXTD_COMMUNITIES 16 /* draft-ietf-idr-bgp-ext-communities */ | ||||
#define BGPTYPE_AS4_PATH 17 /* RFC4893 */ | #define BGPTYPE_AS4_PATH 17 /* RFC4893 */ | ||||
#define BGPTYPE_AGGREGATOR4 18 /* RFC4893 */ | #define BGPTYPE_AGGREGATOR4 18 /* RFC4893 */ | ||||
#define BGPTYPE_PMSI_TUNNEL 22 /* draft-ietf-l3vpn-2547bis-mcast-bgp-02.txt */ | #define BGPTYPE_PMSI_TUNNEL 22 /* draft-ietf-l3vpn-2547bis-mcast-bgp-02.txt */ | ||||
#define BGPTYPE_LARGE_COMMUNITIES 32 /* draft-ietf-idr-large-community */ | |||||
#define BGPTYPE_ATTR_SET 128 /* draft-marques-ppvpn-ibgp */ | #define BGPTYPE_ATTR_SET 128 /* draft-marques-ppvpn-ibgp */ | ||||
#define BGP_MP_NLRI_MINSIZE 3 /* End of RIB Marker detection */ | #define BGP_MP_NLRI_MINSIZE 3 /* End of RIB Marker detection */ | ||||
static const struct tok bgp_attr_values[] = { | static const struct tok bgp_attr_values[] = { | ||||
{ BGPTYPE_ORIGIN, "Origin"}, | { BGPTYPE_ORIGIN, "Origin"}, | ||||
{ BGPTYPE_AS_PATH, "AS Path"}, | { BGPTYPE_AS_PATH, "AS Path"}, | ||||
{ BGPTYPE_AS4_PATH, "AS4 Path"}, | { BGPTYPE_AS4_PATH, "AS4 Path"}, | ||||
Show All 9 Lines | static const struct tok bgp_attr_values[] = { | ||||
{ BGPTYPE_DPA, "DPA"}, | { BGPTYPE_DPA, "DPA"}, | ||||
{ BGPTYPE_ADVERTISERS, "Advertisers"}, | { BGPTYPE_ADVERTISERS, "Advertisers"}, | ||||
{ BGPTYPE_RCID_PATH, "RCID Path / Cluster ID"}, | { BGPTYPE_RCID_PATH, "RCID Path / Cluster ID"}, | ||||
{ BGPTYPE_MP_REACH_NLRI, "Multi-Protocol Reach NLRI"}, | { BGPTYPE_MP_REACH_NLRI, "Multi-Protocol Reach NLRI"}, | ||||
{ BGPTYPE_MP_UNREACH_NLRI, "Multi-Protocol Unreach NLRI"}, | { BGPTYPE_MP_UNREACH_NLRI, "Multi-Protocol Unreach NLRI"}, | ||||
{ BGPTYPE_EXTD_COMMUNITIES, "Extended Community"}, | { BGPTYPE_EXTD_COMMUNITIES, "Extended Community"}, | ||||
{ BGPTYPE_PMSI_TUNNEL, "PMSI Tunnel"}, | { BGPTYPE_PMSI_TUNNEL, "PMSI Tunnel"}, | ||||
{ BGPTYPE_ATTR_SET, "Attribute Set"}, | { BGPTYPE_ATTR_SET, "Attribute Set"}, | ||||
{ BGPTYPE_LARGE_COMMUNITIES, "Large Community"}, | |||||
{ 255, "Reserved for development"}, | { 255, "Reserved for development"}, | ||||
{ 0, NULL} | { 0, NULL} | ||||
}; | }; | ||||
#define BGP_AS_SET 1 | #define BGP_AS_SET 1 | ||||
#define BGP_AS_SEQUENCE 2 | #define BGP_AS_SEQUENCE 2 | ||||
#define BGP_CONFED_AS_SEQUENCE 3 /* draft-ietf-idr-rfc3065bis-01 */ | #define BGP_CONFED_AS_SEQUENCE 3 /* draft-ietf-idr-rfc3065bis-01 */ | ||||
#define BGP_CONFED_AS_SET 4 /* draft-ietf-idr-rfc3065bis-01 */ | #define BGP_CONFED_AS_SET 4 /* draft-ietf-idr-rfc3065bis-01 */ | ||||
▲ Show 20 Lines • Show All 1,287 Lines • ▼ Show 20 Lines | while (tlen>0) { | ||||
ND_PRINT((ndo, "%u:%u%s", | ND_PRINT((ndo, "%u:%u%s", | ||||
(comm >> 16) & 0xffff, | (comm >> 16) & 0xffff, | ||||
comm & 0xffff, | comm & 0xffff, | ||||
(tlen>4) ? ", " : "")); | (tlen>4) ? ", " : "")); | ||||
break; | break; | ||||
} | } | ||||
tlen -=4; | tlen -=4; | ||||
tptr +=4; | tptr +=4; | ||||
} | |||||
break; | |||||
case BGPTYPE_LARGE_COMMUNITIES: | |||||
if (len == 0 || len % 12) { | |||||
ND_PRINT((ndo, "invalid len")); | |||||
break; | |||||
} | |||||
while (tlen>0) { | |||||
ND_TCHECK2(tptr[0], 12); | |||||
ND_PRINT((ndo, "%u:%u:%u%s", | |||||
EXTRACT_32BITS(tptr), | |||||
EXTRACT_32BITS(tptr + 4), | |||||
EXTRACT_32BITS(tptr + 8), | |||||
(tlen>12) ? ", " : "")); | |||||
tlen -= 12; | |||||
tptr += 12; | |||||
} | } | ||||
break; | break; | ||||
case BGPTYPE_ORIGINATOR_ID: | case BGPTYPE_ORIGINATOR_ID: | ||||
if (len != 4) { | if (len != 4) { | ||||
ND_PRINT((ndo, "invalid len")); | ND_PRINT((ndo, "invalid len")); | ||||
break; | break; | ||||
} | } | ||||
ND_TCHECK2(tptr[0], 4); | ND_TCHECK2(tptr[0], 4); | ||||
▲ Show 20 Lines • Show All 1,313 Lines • Show Last 20 Lines |