diff options
author | Denis Ovsienko <denis@ovsienko.info> | 2015-06-29 16:06:31 +0100 |
---|---|---|
committer | Denis Ovsienko <denis@ovsienko.info> | 2015-06-29 16:41:20 +0100 |
commit | c9c3d3cfdf3a926e02114cfe611ffe20167ab5f4 (patch) | |
tree | fede2f10b080ccd67ef51c85bdc637a0e67d032b | |
parent | 0938876cd1e52060a99ffa20a8c455a28385c727 (diff) | |
download | tcpdump-c9c3d3cfdf3a926e02114cfe611ffe20167ab5f4.tar.gz |
BGP: add decoding of ADD-PATH capability
This implements the capability part of draft-ietf-idr-add-paths-10 and
seems to work for a packet capture I am looking into. The problem with
the "extended NLRI encodings" defined in the same document is that they
are going to use a different structure for the two previously assigned
path attributes, which makes decoding of an UPDATE difficult without
having both relevant OPENs from the same session.
-rw-r--r-- | print-bgp.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/print-bgp.c b/print-bgp.c index 562de967..c4099f59 100644 --- a/print-bgp.c +++ b/print-bgp.c @@ -202,6 +202,7 @@ static const struct tok bgp_opt_values[] = { #define BGP_CAPCODE_RESTART 64 /* draft-ietf-idr-restart-05 */ #define BGP_CAPCODE_AS_NEW 65 /* XXX */ #define BGP_CAPCODE_DYN_CAP 67 /* XXX */ +#define BGP_CAPCODE_ADD_PATH 69 /* draft-ietf-idr-add-paths-10 */ #define BGP_CAPCODE_RR_CISCO 128 static const struct tok bgp_capcode_values[] = { @@ -211,6 +212,7 @@ static const struct tok bgp_capcode_values[] = { { BGP_CAPCODE_RESTART, "Graceful Restart"}, { BGP_CAPCODE_AS_NEW, "32-Bit AS Number"}, { BGP_CAPCODE_DYN_CAP, "Dynamic Capability"}, + { BGP_CAPCODE_ADD_PATH, "Multiple Paths"}, { BGP_CAPCODE_RR_CISCO, "Route Refresh (Cisco)"}, { 0, NULL} }; @@ -462,6 +464,14 @@ static const struct tok bgp_extd_comm_ospf_rtype_values[] = { { 0, NULL }, }; +/* ADD-PATH Send/Receive field values */ +static const struct tok bgp_add_path_recvsend[] = { + { 1, "Receive" }, + { 2, "Send" }, + { 3, "Both" }, + { 0, NULL }, +}; + static char astostr[20]; /* @@ -2320,6 +2330,28 @@ bgp_capabilities_print(netdissect_options *ndo, EXTRACT_32BITS(opt + i + 2)))); } break; + case BGP_CAPCODE_ADD_PATH: + cap_offset=2; + if (tcap_len == 0) { + ND_PRINT((ndo, " (bogus)")); /* length */ + break; + } + while (tcap_len > 0) { + if (tcap_len < 4) { + ND_PRINT((ndo, "\n\t\t(malformed)")); + break; + } + ND_PRINT((ndo, "\n\t\tAFI %s (%u), SAFI %s (%u), Send/Receive: %s", + tok2str(af_values,"Unknown",EXTRACT_16BITS(opt+i+cap_offset)), + EXTRACT_16BITS(opt+i+cap_offset), + tok2str(bgp_safi_values,"Unknown",opt[i+cap_offset+2]), + opt[i+cap_offset+2], + tok2str(bgp_add_path_recvsend,"Bogus (0x%02x)",opt[i+cap_offset+3]) + )); + tcap_len-=4; + cap_offset+=4; + } + break; default: ND_PRINT((ndo, "\n\t\tno decoder for Capability %u", cap_type)); |