summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--print-bgp.c37
-rw-r--r--tests/TESTLIST1
-rw-r--r--tests/bgp-role.out125
-rw-r--r--tests/bgp-role.pcapngbin0 -> 1644 bytes
4 files changed, 163 insertions, 0 deletions
diff --git a/print-bgp.c b/print-bgp.c
index fe4292df..c4c79b2d 100644
--- a/print-bgp.c
+++ b/print-bgp.c
@@ -174,6 +174,7 @@ static const struct tok bgp_route_refresh_subtype_values[] = {
#define BGPTYPE_ENTROPY_LABEL 28 /* RFC6790 */
#define BGPTYPE_LARGE_COMMUNITY 32 /* draft-ietf-idr-large-community-05 */
#define BGPTYPE_BGPSEC_PATH 33 /* RFC8205 */
+#define BGPTYPE_OTC 35 /* RFC9234 */
#define BGPTYPE_ATTR_SET 128 /* RFC6368 */
#define BGP_MP_NLRI_MINSIZE 3 /* End of RIB Marker detection */
@@ -203,6 +204,7 @@ static const struct tok bgp_attr_values[] = {
{ BGPTYPE_ENTROPY_LABEL, "Entropy Label"},
{ BGPTYPE_LARGE_COMMUNITY, "Large Community"},
{ BGPTYPE_BGPSEC_PATH, "BGPsec Path"},
+ { BGPTYPE_OTC, "Only to Customer (OTC)"},
{ BGPTYPE_ATTR_SET, "Attribute Set"},
{ 255, "Reserved for development"},
{ 0, NULL}
@@ -249,6 +251,7 @@ static const struct tok bgp_opt_values[] = {
#define BGP_CAPCODE_EXT_MSG 6 /* RFC8654 */
#define BGP_CAPCODE_BGPSEC 7 /* RFC8205 */
#define BGP_CAPCODE_ML 8 /* RFC8277 */
+#define BGP_CAPCODE_ROLE 9 /* RFC9234 */
#define BGP_CAPCODE_RESTART 64 /* RFC4724 */
#define BGP_CAPCODE_AS_NEW 65 /* RFC6793 */
#define BGP_CAPCODE_DYN_CAP 67 /* draft-ietf-idr-dynamic-cap */
@@ -275,6 +278,7 @@ static const struct tok bgp_capcode_values[] = {
{ BGP_CAPCODE_ENH_RR, "Enhanced Route Refresh"},
{ BGP_CAPCODE_LLGR, "Long-lived Graceful Restart"},
{ BGP_CAPCODE_RR_CISCO, "Route Refresh (Cisco)"},
+ { BGP_CAPCODE_ROLE, "Role Capability"},
{ 0, NULL}
};
@@ -405,6 +409,21 @@ static const struct tok bgp_aigp_values[] = {
{ 0, NULL}
};
+#define BGP_ROLE_PROVIDER 0
+#define BGP_ROLE_RS 1
+#define BGP_ROLE_RS_CLIENT 2
+#define BGP_ROLE_CUSTOMER 3
+#define BGP_ROLE_PEER 4
+
+static const struct tok bgp_role_values[] = {
+ { BGP_ROLE_PROVIDER, "Provider"},
+ { BGP_ROLE_RS, "RS"},
+ { BGP_ROLE_RS_CLIENT, "RS-Client"},
+ { BGP_ROLE_CUSTOMER, "Customer"},
+ { BGP_ROLE_PEER, "Peer"},
+ { 0, NULL}
+};
+
/* Subsequent address family identifier, RFC2283 section 7 */
#define SAFNUM_RES 0
#define SAFNUM_UNICAST 1
@@ -2654,6 +2673,15 @@ bgp_attr_print(netdissect_options *ndo,
}
break;
}
+ case BGPTYPE_OTC:
+ {
+ if (len < 4) {
+ ND_PRINT("invalid len");
+ break;
+ }
+ ND_PRINT("\n\t OTC %u", GET_BE_U_4(pptr));
+ break;
+ }
default:
ND_TCHECK_LEN(pptr, len);
ND_PRINT("\n\t no Attribute %u decoder", atype); /* we have no decoder for the attribute */
@@ -2766,6 +2794,15 @@ bgp_capabilities_print(netdissect_options *ndo,
cap_offset += 4;
}
break;
+ case BGP_CAPCODE_ROLE:
+ if (cap_len < 1) {
+ ND_PRINT(" (too short, < 1)");
+ return;
+ }
+ ND_PRINT("\n\t\tRole name %s (%u)",
+ tok2str(bgp_role_values, "Unassigned",
+ GET_U_1(opt + i + 2)), GET_U_1(opt + i + 2));
+ break;
case BGP_CAPCODE_RR:
case BGP_CAPCODE_LLGR:
case BGP_CAPCODE_RR_CISCO:
diff --git a/tests/TESTLIST b/tests/TESTLIST
index 8341e188..e0663892 100644
--- a/tests/TESTLIST
+++ b/tests/TESTLIST
@@ -72,6 +72,7 @@ bgp-bfd-cease bgp-bfd-cease.pcap bgp-bfd-cease.out -v
bgp-orf bgp-orf.pcapng bgp-orf.out -v
bgp-bgpsec bgp-bgpsec.pcap bgp-bgpsec.out -v
bgp-ovs bgp-ovs.pcapng bgp-ovs.out -v
+bgp-role bgp-role.pcapng bgp-role.out -v
# Broadcom tag tests
brcmtag brcm-tag.pcap brcm-tag.out
diff --git a/tests/bgp-role.out b/tests/bgp-role.out
new file mode 100644
index 00000000..e430711d
--- /dev/null
+++ b/tests/bgp-role.out
@@ -0,0 +1,125 @@
+ 1 20:08:52.541413 IP (tos 0xc0, ttl 1, id 17240, offset 0, flags [DF], proto TCP (6), length 159)
+ 192.168.10.17.179 > 192.168.10.124.53580: Flags [P.], cksum 0x966f (incorrect -> 0x2000), seq 3763129203:3763129310, ack 4158499266, win 128, options [nop,nop,TS val 2413434737 ecr 2257657437], length 107: BGP
+ Open Message (1), length: 107
+ Version 4, my AS 65002, Holdtime 180s, ID 192.168.10.17
+ Optional parameters, length: 78
+ Option Capabilities Advertisement (2), length: 6
+ Multiprotocol Extensions (1), length: 4
+ AFI IPv4 (1), SAFI Unicast (1)
+ Option Capabilities Advertisement (2), length: 2
+ Route Refresh (Cisco) (128), length: 0
+ Option Capabilities Advertisement (2), length: 2
+ Route Refresh (2), length: 0
+ Option Capabilities Advertisement (2), length: 2
+ Enhanced Route Refresh (70), length: 0
+ Option Capabilities Advertisement (2), length: 6
+ 32-Bit AS Number (65), length: 4
+ 4 Byte AS 65002
+ Option Capabilities Advertisement (2), length: 2
+ BGP Extended Message (6), length: 0
+ Option Capabilities Advertisement (2), length: 3
+ Role Capability (9), length: 1
+ Role name Customer (3)
+ Option Capabilities Advertisement (2), length: 6
+ Multiple Paths (69), length: 4
+ AFI IPv4 (1), SAFI Unicast (1), Send/Receive: Receive
+ Option Capabilities Advertisement (2), length: 14
+ Unknown (73), length: 12
+ no decoder for Capability 73
+ 0x0000: 0a64 6f6e 6174 6173 2d70 6300
+ Option Capabilities Advertisement (2), length: 4
+ Graceful Restart (64), length: 2
+ Restart Flags: [N], Restart Time 120s
+ Option Capabilities Advertisement (2), length: 9
+ Long-lived Graceful Restart (71), length: 7
+ 2 20:08:53.642401 IP (tos 0xc0, ttl 1, id 17245, offset 0, flags [DF], proto TCP (6), length 75)
+ 192.168.10.17.179 > 192.168.10.124.53580: Flags [P.], cksum 0x961b (incorrect -> 0x69a0), seq 145:168, ack 39, win 128, options [nop,nop,TS val 2413435838 ecr 2257658439], length 23: BGP
+ Update Message (2), length: 23
+ End-of-Rib Marker (empty NLRI)
+ 3 20:08:53.642524 IP (tos 0xc0, ttl 1, id 43436, offset 0, flags [DF], proto TCP (6), length 52)
+ 192.168.10.124.53580 > 192.168.10.17.179: Flags [.], cksum 0x69e6 (correct), ack 168, win 502, options [nop,nop,TS val 2257658538 ecr 2413435838], length 0
+ 4 20:08:53.643391 IP (tos 0xc0, ttl 1, id 43437, offset 0, flags [DF], proto TCP (6), length 550)
+ 192.168.10.124.53580 > 192.168.10.17.179: Flags [P.], cksum 0x24c3 (correct), seq 39:537, ack 168, win 502, options [nop,nop,TS val 2257658539 ecr 2413435838], length 498: BGP
+ Update Message (2), length: 62
+ Origin (1), length: 1, Flags [T]: Incomplete
+ AS Path (2), length: 6, Flags [TE]: 65001
+ Next Hop (3), length: 4, Flags [T]: 192.168.10.124
+ Multi Exit Discriminator (4), length: 4, Flags [O]: 0
+ Only to Customer (OTC) (35), length: 4, Flags [OT]:
+ OTC 65001
+ Updated routes:
+ 10.0.2.0/24
+ Update Message (2), length: 62
+ Origin (1), length: 1, Flags [T]: IGP
+ AS Path (2), length: 6, Flags [TE]: 65001
+ Next Hop (3), length: 4, Flags [T]: 192.168.10.124
+ Multi Exit Discriminator (4), length: 4, Flags [O]: 0
+ Only to Customer (OTC) (35), length: 4, Flags [OT]:
+ OTC 65001
+ Updated routes:
+ 10.10.100.0/24
+ Update Message (2), length: 83
+ Origin (1), length: 1, Flags [T]: Incomplete
+ AS Path (2), length: 6, Flags [TE]: 65001
+ Next Hop (3), length: 4, Flags [T]: 192.168.10.124
+ Multi Exit Discriminator (4), length: 4, Flags [O]: 0
+ Only to Customer (OTC) (35), length: 4, Flags [OT]:
+ OTC 65001
+ Updated routes:
+ 172.16.31.1/32
+ 200.200.200.202/32
+ 200.200.200.201/32
+ 172.16.31.3/32
+ 172.16.31.2/32
+ Update Message (2), length: 62
+ Origin (1), length: 1, Flags [T]: Incomplete
+ AS Path (2), length: 6, Flags [TE]: 65001
+ Next Hop (3), length: 4, Flags [T]: 192.168.10.124
+ Multi Exit Discriminator (4), length: 4, Flags [O]: 0
+ Only to Customer (OTC) (35), length: 4, Flags [OT]:
+ OTC 65001
+ Updated routes:
+ 192.168.0.0/24
+ Update Message (2), length: 62
+ Origin (1), length: 1, Flags [T]: Incomplete
+ AS Path (2), length: 6, Flags [TE]: 65001
+ Next Hop (3), length: 4, Flags [T]: 192.168.10.124
+ Multi Exit Discriminator (4), length: 4, Flags [O]: 0
+ Only to Customer (OTC) (35), length: 4, Flags [OT]:
+ OTC 65001
+ Updated routes:
+ 192.168.1.0/24
+ Update Message (2), length: 62
+ Origin (1), length: 1, Flags [T]: Incomplete
+ AS Path (2), length: 6, Flags [TE]: 65001
+ Next Hop (3), length: 4, Flags [T]: 192.168.10.124
+ Multi Exit Discriminator (4), length: 4, Flags [O]: 0
+ Only to Customer (OTC) (35), length: 4, Flags [OT]:
+ OTC 65001
+ Updated routes:
+ 192.168.10.0/24
+ Update Message (2), length: 82
+ Origin (1), length: 1, Flags [T]: Incomplete
+ AS Path (2), length: 10, Flags [TE]: 65001 65010
+ Next Hop (3), length: 4, Flags [T]: 192.168.10.124
+ Multi Exit Discriminator (4), length: 4, Flags [O]: 0
+ Large Community (32), length: 12, Flags [OT]:
+ 65001:65001:1
+ Only to Customer (OTC) (35), length: 4, Flags [OT]:
+ OTC 65001
+ Updated routes:
+ 200.200.200.200/32
+ Update Message (2), length: 23
+ End-of-Rib Marker (empty NLRI)
+ 5 20:08:53.643398 IP (tos 0xc0, ttl 1, id 17246, offset 0, flags [DF], proto TCP (6), length 52)
+ 192.168.10.17.179 > 192.168.10.124.53580: Flags [.], cksum 0x9604 (incorrect -> 0x6968), ack 537, win 128, options [nop,nop,TS val 2413435839 ecr 2257658539], length 0
+ 6 20:08:54.542570 IP (tos 0xc0, ttl 1, id 17247, offset 0, flags [DF], proto TCP (6), length 71)
+ 192.168.10.17.179 > 192.168.10.124.53580: Flags [P.], cksum 0x9617 (incorrect -> 0x61b6), seq 168:187, ack 537, win 128, options [nop,nop,TS val 2413436739 ecr 2257658539], length 19: BGP
+ Keepalive Message (4), length: 19
+ 7 20:08:54.542789 IP (tos 0xc0, ttl 1, id 43438, offset 0, flags [DF], proto TCP (6), length 52)
+ 192.168.10.124.53580 > 192.168.10.17.179: Flags [.], cksum 0x60d7 (correct), ack 187, win 502, options [nop,nop,TS val 2257659439 ecr 2413436739], length 0
+ 8 20:08:54.542863 IP (tos 0xc0, ttl 1, id 43439, offset 0, flags [DF], proto TCP (6), length 71)
+ 192.168.10.124.53580 > 192.168.10.17.179: Flags [P.], cksum 0x5ca9 (correct), seq 537:556, ack 187, win 502, options [nop,nop,TS val 2257659439 ecr 2413436739], length 19: BGP
+ Keepalive Message (4), length: 19
+ 9 20:08:54.542871 IP (tos 0xc0, ttl 1, id 17248, offset 0, flags [DF], proto TCP (6), length 52)
+ 192.168.10.17.179 > 192.168.10.124.53580: Flags [.], cksum 0x9604 (incorrect -> 0x623a), ack 556, win 128, options [nop,nop,TS val 2413436739 ecr 2257659439], length 0
diff --git a/tests/bgp-role.pcapng b/tests/bgp-role.pcapng
new file mode 100644
index 00000000..6c8e4712
--- /dev/null
+++ b/tests/bgp-role.pcapng
Binary files differ