summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHannes Gredler <hannes@juniper.net>2014-10-02 19:59:44 +0200
committerHannes Gredler <hannes@juniper.net>2014-10-02 19:59:44 +0200
commit94e23e3b7b7b6d9fcab9565b65613fd1bd47f018 (patch)
tree1f3690e5e2f2e0b8bec173efca44b74dc0d683d2
parent29d83dbb61be640899d969357f2a8e1c3e02c7ee (diff)
downloadtcpdump-bare.tar.gz
add support for the BGP AIGP attribute.bare
-rw-r--r--print-bgp.c57
1 files changed, 57 insertions, 0 deletions
diff --git a/print-bgp.c b/print-bgp.c
index 2ad7cbcb..e145487f 100644
--- a/print-bgp.c
+++ b/print-bgp.c
@@ -138,6 +138,7 @@ struct bgp_route_refresh {
#define BGPTYPE_AS4_PATH 17 /* RFC4893 */
#define BGPTYPE_AGGREGATOR4 18 /* RFC4893 */
#define BGPTYPE_PMSI_TUNNEL 22 /* draft-ietf-l3vpn-2547bis-mcast-bgp-02.txt */
+#define BGPTYPE_AIGP 26 /* RFC7311 */
#define BGPTYPE_ATTR_SET 128 /* draft-marques-ppvpn-ibgp */
#define BGP_MP_NLRI_MINSIZE 3 /* End of RIB Marker detection */
@@ -162,6 +163,7 @@ static const struct tok bgp_attr_values[] = {
{ BGPTYPE_MP_UNREACH_NLRI, "Multi-Protocol Unreach NLRI"},
{ BGPTYPE_EXTD_COMMUNITIES, "Extended Community"},
{ BGPTYPE_PMSI_TUNNEL, "PMSI Tunnel"},
+ { BGPTYPE_AIGP, "Accumulated IGP Metric"},
{ BGPTYPE_ATTR_SET, "Attribute Set"},
{ 255, "Reserved for development"},
{ 0, NULL}
@@ -324,6 +326,13 @@ static const struct tok bgp_pmsi_flag_values[] = {
{ 0, NULL}
};
+#define BGP_AIGP_TLV 1
+
+static const struct tok bgp_aigp_values[] = {
+ { BGP_AIGP_TLV, "AIGP"},
+ { 0, NULL}
+};
+
/* Subsequent address family identifier, RFC2283 section 7 */
#define SAFNUM_RES 0
@@ -2136,6 +2145,54 @@ bgp_attr_print(u_int atype, const u_char *pptr, u_int len)
}
break;
}
+ case BGPTYPE_AIGP:
+ {
+ u_int8_t type;
+ u_int16_t length;
+
+ TCHECK2(tptr[0], 3);
+
+ tlen = len;
+
+ while (tlen >= 3) {
+
+ type = *tptr;
+ length = EXTRACT_16BITS(tptr+1);
+
+ printf("\n\t %s TLV (%u), length %u",
+ tok2str(bgp_aigp_values, "Unknown", type),
+ type, length);
+
+
+ /*
+ * Check if we can read the TLV data.
+ */
+ TCHECK2(tptr[3], length - 3);
+
+ switch (type) {
+
+ case BGP_AIGP_TLV:
+ printf(", metric %" PRIu64, EXTRACT_64BITS(tptr+3));
+ break;
+
+ default:
+ if (vflag <= 1) {
+ print_unknown_data(tptr+3,"\n\t ", length-3);
+ }
+ }
+
+ /*
+ * Header length includes TLV overhead.
+ */
+ if (length < 3) {
+ break;
+ }
+
+ tptr += length;
+ tlen -= length;
+ }
+ break;
+ }
case BGPTYPE_ATTR_SET:
TCHECK2(tptr[0], 4);
if (len < 4)