From 36a8e8cd6a59ed1860de316ce926ddd1275d46dd Mon Sep 17 00:00:00 2001 From: Christoph Schwarz Date: Tue, 5 Mar 2024 14:03:44 -0800 Subject: [PATCH] ldp: decode PW Status TLV --- print-ldp.c | 22 ++++++++++++++++++++++ tests/TESTLIST | 1 + tests/ldp-pw-status.out | 10 ++++++++++ tests/ldp-pw-status.pcap | Bin 0 -> 272 bytes 4 files changed, 33 insertions(+) create mode 100644 tests/ldp-pw-status.out create mode 100644 tests/ldp-pw-status.pcap diff --git a/print-ldp.c b/print-ldp.c index 60fe01053..22e2bdb8b 100644 --- a/print-ldp.c +++ b/print-ldp.c @@ -145,6 +145,7 @@ static const struct tok ldp_msg_values[] = { #define LDP_TLV_LABEL_REQUEST_MSG_ID 0x0600 #define LDP_TLV_MTU 0x0601 /* rfc 3988 */ #define LDP_TLV_DUAL_STACK_CAP 0x0701 /* rfc 7552 */ +#define LDP_TLV_PW_STATUS 0x096a /* rfc 8077 */ static const struct tok ldp_tlv_values[] = { { LDP_TLV_FEC, "FEC" }, @@ -170,6 +171,7 @@ static const struct tok ldp_tlv_values[] = { { LDP_TLV_LABEL_REQUEST_MSG_ID, "Label Request Message ID" }, { LDP_TLV_MTU, "MTU" }, { LDP_TLV_DUAL_STACK_CAP, "Dual-Stack Capability" }, + { LDP_TLV_PW_STATUS, "PW Status" }, { 0, NULL} }; @@ -255,6 +257,19 @@ static const struct tok ldp_dual_stack_transport_pref_values[] = { { 0, NULL} }; +static const struct tok ldp_pw_status_flags[] = { + /* rfc 8077 */ + { 0x01, "NF" }, /* Pseudowire Not Forwarding */ + { 0x02, "AC-RF" }, /* Local Attachment Circuit (ingress) Receive Fault */ + { 0x04, "AC-TF" }, /* Local Attachment Circuit (egress) Transmit Fault */ + { 0x08, "PSN-RF" }, /* Local PSN-facing PW (ingress) Receive Fault */ + { 0x10, "PSN-TF" }, /* Local PSN-facing PW (egress) Transmit Fault */ + /* rfc 6870 */ + { 0x20, "PF" }, /* PW Preferential Forwarding Status */ + { 0x40, "RS" }, /* PW Request Switchover Status */ + { 0, NULL} +}; + static u_int ldp_pdu_print(netdissect_options *, const u_char *); /* @@ -589,6 +604,13 @@ ldp_tlv_print(netdissect_options *ndo, transport_pref)); break; + case LDP_TLV_PW_STATUS: + ND_ICHECKMSG_U("tlv length", tlv_tlen, <, 4); + ND_PRINT("\n\t PW Status: 0x%02x [%s]", + GET_BE_U_4(tptr), + bittok2str(ldp_pw_status_flags, "none", GET_BE_U_4(tptr))); + break; + /* * FIXME those are the defined TLVs that lack a decoder * you are welcome to contribute code ;-) diff --git a/tests/TESTLIST b/tests/TESTLIST index 6ba1f53c9..8678aa9ea 100644 --- a/tests/TESTLIST +++ b/tests/TESTLIST @@ -121,6 +121,7 @@ lmp lmp.pcap lmp.out -T lmp mpls-ldp-hello mpls-ldp-hello.pcap mpls-ldp-hello.out -v ldp-common-session ldp-common-session.pcap ldp-common-session.out -v ldp_infloop ldp-infinite-loop.pcap ldp_infloop.out +ldp-pw-status ldp-pw-status.pcap ldp-pw-status.out -v lspping-fec-ldp lspping-fec-ldp.pcap lspping-fec-ldp.out lspping-fec-ldp-v lspping-fec-ldp.pcap lspping-fec-ldp-v.out -v lspping-fec-ldp-vv lspping-fec-ldp.pcap lspping-fec-ldp-vv.out -vv diff --git a/tests/ldp-pw-status.out b/tests/ldp-pw-status.out new file mode 100644 index 000000000..f023051cf --- /dev/null +++ b/tests/ldp-pw-status.out @@ -0,0 +1,10 @@ + 1 00:30:47.522169 IP (tos 0xc0, ttl 64, id 944, offset 0, flags [DF], proto TCP (6), length 108) + 2.2.2.2.45781 > 1.1.1.1.646: Flags [P.], cksum 0xd2d9 (correct), seq 4026114102:4026114158, ack 1839823399, win 128, options [nop,nop,TS val 2533630089 ecr 3448755034], length 56 + LDP, Label-Space-ID: 2.2.2.2:0, pdu-length: 52 + Notification Message (0x0001), length: 42, Message ID: 0x0000002d, Flags: [ignore if unknown] + Status TLV (0x0300), length: 10, Flags: [ignore and don't forward if unknown] + Status Code: Unknown, Flags: [Advisory Notification and don't forward] + PW Status TLV (0x096a), length: 4, Flags: [continue processing and don't forward if unknown] + PW Status: 0x06 [AC-RF, AC-TF] + FEC TLV (0x0100), length: 12, Flags: [ignore and don't forward if unknown] + Martini VC FEC (0x80): Ethernet, no control word, group-ID 0, VC-ID 1, VC-info-length: 4 diff --git a/tests/ldp-pw-status.pcap b/tests/ldp-pw-status.pcap new file mode 100644 index 0000000000000000000000000000000000000000..4945beae0b6a7cbc5bf7dbe9665cb611f9e33235 GIT binary patch literal 272 zcmd<$<>g9XU|{gI(UxKa(*L1=g~5u!H6^noIk7-NBRsPxwKyZOC|gs(SkFk$SV6-* zvqYf`!Y)Wm&Q45EO;JcJhREs~Y61-cf&?H2nJEIL85mf=Y&IZ&4iJODA|W=0%Fh#L zRRP%`%)r15(!#*Z#K6G8;Cg@|hk1hog9Dp^I1>;s0>P%MOl|LfE-=eoS*6|}!O(E& zCeRi}4zB4e3Y};BFGm5bGy$mv8p6n+1tfKu85p>Lv<46ZL1z}w84L_;Kx=p!7+67U K5CC#PZUO+4o-+La literal 0 HcmV?d00001