-/* $OpenBSD: print-bgp.c,v 1.30 2021/06/17 15:59:23 job Exp $ */
+/* $OpenBSD: print-bgp.c,v 1.31 2022/05/25 14:26:27 job Exp $ */
/*
* Copyright (C) 1999 WIDE Project.
#define BGPTYPE_AS4_PATH 17 /* RFC4893 */
#define BGPTYPE_AGGREGATOR4 18 /* RFC4893 */
#define BGPTYPE_LARGE_COMMUNITIES 32 /* draft-ietf-idr-large-community */
+#define BGPTYPE_ONLY_TO_CUSTOMER 35 /* RFC9234 */
#define BGP_AS_SET 1
#define BGP_AS_SEQUENCE 2
#define BGP_CAPCODE_MP 1
#define BGP_CAPCODE_REFRESH 2
+#define BGP_CAPCODE_BGPROLE 9 /* RFC9234 */
#define BGP_CAPCODE_RESTART 64 /* draft-ietf-idr-restart-05 */
#define BGP_CAPCODE_AS4 65 /* RFC4893 */
/* 3: RFC5291 */ "OUTBOUND_ROUTE_FILTERING",
/* 4: RFC3107 */ "MULTIPLE_ROUTES",
/* 5: RFC5549 */ "EXTENDED_NEXTHOP_ENCODING",
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0,
+ /* 9: RFC9234 */ "BGP_ROLE",
+ 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 69: [draft-ietf-idr-add-paths] */ "ADD-PATH",
/* 70: RFC7313 */ "ENHANCED_ROUTE_REFRESH"
};
-
#define bgp_capcode(x) \
num_or_str(bgp_capcode, sizeof(bgp_capcode)/sizeof(bgp_capcode[0]), (x))
+static const char *bgp_roletype[] = {
+ "Provider", "Route Server", "RS Client", "Customer", "Lateral Peer"
+};
+#define bgp_roletype(x) \
+ num_or_str(bgp_roletype, \
+ sizeof(bgp_roletype)/sizeof(bgp_roletype[0]), (x))
+
#define BGP_NOTIFY_MAJOR_CEASE 6
static const char *bgpnotify_major[] = {
NULL, "Message Header Error",
NULL, "Unsupported Version Number",
"Bad Peer AS", "Bad BGP Identifier",
"Unsupported Optional Parameter", "Authentication Failure",
- "Unacceptable Hold Time", "Unsupported Capability",
+ "Unacceptable Hold Time", "Unsupported Capability", NULL,
+ NULL, NULL, "Role Mismatch"
};
static const char *bgpnotify_minor_update[] = {
"ADVERTISERS", "RCID_PATH", "MP_REACH_NLRI", "MP_UNREACH_NLRI",
"EXTD_COMMUNITIES", "AS4_PATH", "AGGREGATOR4", NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- "LARGE_COMMUNITIES",
+ "LARGE_COMMUNITIES", NULL, NULL, "ONLY_TO_CUSTOMER"
};
#define bgp_attr_type(x) \
num_or_str(bgpattr_type, \
p += 12;
}
break;
+ case BGPTYPE_ONLY_TO_CUSTOMER:
+ if (len != 4) {
+ printf(" invalid len");
+ break;
+ }
+ TCHECK2(p[0], 4);
+ printf(" AS%u", EXTRACT_32BITS(p));
+ break;
case BGPTYPE_ORIGINATOR_ID:
if (len != 4) {
printf(" invalid len");
break;
}
break;
+ case BGP_CAPCODE_BGPROLE:
+ if (cap_len != 1) {
+ printf(" BAD ENCODING");
+ break;
+ }
+ printf(" [%s]", bgp_roletype(opt[i]));
+ break;
case BGP_CAPCODE_RESTART:
if (cap_len < 2 || (cap_len - 2) % 4) {
printf(" BAD ENCODING");