#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-bgp.c,v 1.72.2.2 2003-11-16 08:51:13 guy Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-bgp.c,v 1.72.2.3 2004-01-16 10:07:20 hannes Exp $";
#endif
#include <tcpdump-stdinc.h>
{ 0, NULL}
};
+#define BGP_AS_SET 1
+#define BGP_AS_SEQUENCE 2
+#define BGP_CONFED_AS_SEQUENCE 3 /* draft-ietf-idr-rfc3065bis-01 */
+#define BGP_CONFED_AS_SET 4 /* draft-ietf-idr-rfc3065bis-01 */
+
+static struct tok bgp_as_path_segment_open_values[] = {
+ { BGP_AS_SEQUENCE, ""},
+ { BGP_AS_SET, "{ "},
+ { BGP_CONFED_AS_SEQUENCE, "( "},
+ { BGP_CONFED_AS_SET, "({ "},
+ { 0, NULL}
+};
+
+static struct tok bgp_as_path_segment_close_values[] = {
+ { BGP_AS_SEQUENCE, ""},
+ { BGP_AS_SET, "}"},
+ { BGP_CONFED_AS_SEQUENCE, ")"},
+ { BGP_CONFED_AS_SET, "})"},
+ { 0, NULL}
+};
+
#define BGP_OPT_AUTH 1
#define BGP_OPT_CAP 2
printf("empty");
break;
}
+
while (tptr < pptr + len) {
- /*
- * under RFC1965, p[0] means:
- * 1: AS_SET 2: AS_SEQUENCE
- * 3: AS_CONFED_SET 4: AS_CONFED_SEQUENCE
- */
- if (tptr[0] == 3 || tptr[0] == 4)
- printf("confed");
- printf("%s", (tptr[0] & 1) ? "{" : "");
- for (i = 0; i < tptr[1] * 2; i += 2) {
- printf("%s%u", i == 0 ? "" : " ",
- EXTRACT_16BITS(&tptr[2 + i]));
- }
- printf("%s", (tptr[0] & 1) ? "}" : "");
- tptr += 2 + tptr[1] * 2;
+ printf("%s", tok2str(bgp_as_path_segment_open_values, "?", tptr[0]));
+ for (i = 0; i < tptr[1] * 2; i += 2) {
+ printf("%u ", EXTRACT_16BITS(&tptr[2 + i]));
+ }
+ printf("%s", tok2str(bgp_as_path_segment_close_values, "?", tptr[0]));
+ tptr += 2 + tptr[1] * 2;
}
break;
case BGPTYPE_NEXT_HOP: