From: Hannes Gredler Date: Wed, 16 Aug 2023 12:34:17 +0000 (+0000) Subject: LDP: add support for the Path Vector and Hop Count TLV as per RFC 5036 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/2b0812f316dfa2621ec6e0b594ba590265a02ddc?ds=sidebyside LDP: add support for the Path Vector and Hop Count TLV as per RFC 5036 --- diff --git a/print-ldp.c b/print-ldp.c index f09c5a6e..b75b3619 100644 --- a/print-ldp.c +++ b/print-ldp.c @@ -372,6 +372,23 @@ ldp_tlv_print(netdissect_options *ndo, } break; + case LDP_TLV_HOP_COUNT: + TLV_TCHECK(1); + ND_PRINT("\n\t Hop Count: %u", GET_U_1(tptr)); + break; + + case LDP_TLV_PATH_VECTOR: + TLV_TCHECK(4); + ND_PRINT("\n\t Path Vector: %s", GET_IPADDR_STRING(tptr)); + tptr += 4; + tlv_tlen -= 4; + while (tlv_tlen >= 4) { + ND_PRINT(", %s", GET_IPADDR_STRING(tptr)); + tptr += 4; + tlv_tlen -= 4; + } + break; + case LDP_TLV_COMMON_SESSION: TLV_TCHECK(14); ND_PRINT("\n\t Version: %u, Keepalive: %us, Flags: [Downstream %s, Loop Detection %s]", @@ -586,8 +603,6 @@ ldp_tlv_print(netdissect_options *ndo, * you are welcome to contribute code ;-) */ - case LDP_TLV_HOP_COUNT: - case LDP_TLV_PATH_VECTOR: case LDP_TLV_ATM_LABEL: case LDP_TLV_FR_LABEL: case LDP_TLV_EXTD_STATUS: diff --git a/tests/ldp-common-session.out b/tests/ldp-common-session.out index 7f775fd6..e5d3f0ad 100644 --- a/tests/ldp-common-session.out +++ b/tests/ldp-common-session.out @@ -76,45 +76,45 @@ Generic Label TLV (0x0200), length: 4, Flags: [ignore and don't forward if unknown] Label: 3 Hop Count TLV (0x0103), length: 1, Flags: [ignore and don't forward if unknown] - 0x0000: 01 + Hop Count: 1 Path Vector TLV (0x0104), length: 4, Flags: [ignore and don't forward if unknown] - 0x0000: c0a8 0002 + Path Vector: 192.168.0.2 Label Mapping Message (0x0400), length: 37, Message ID: 0x00000006, Flags: [ignore if unknown] FEC TLV (0x0100), length: 8, Flags: [ignore and don't forward if unknown] Prefix FEC (0x02): IPv4 prefix 192.168.1.2/32 Generic Label TLV (0x0200), length: 4, Flags: [ignore and don't forward if unknown] Label: 3 Hop Count TLV (0x0103), length: 1, Flags: [ignore and don't forward if unknown] - 0x0000: 01 + Hop Count: 1 Path Vector TLV (0x0104), length: 4, Flags: [ignore and don't forward if unknown] - 0x0000: c0a8 0002 + Path Vector: 192.168.0.2 Label Mapping Message (0x0400), length: 37, Message ID: 0x00000007, Flags: [ignore if unknown] FEC TLV (0x0100), length: 8, Flags: [ignore and don't forward if unknown] Prefix FEC (0x02): IPv4 prefix 192.168.2.2/32 Generic Label TLV (0x0200), length: 4, Flags: [ignore and don't forward if unknown] Label: 3 Hop Count TLV (0x0103), length: 1, Flags: [ignore and don't forward if unknown] - 0x0000: 01 + Hop Count: 1 Path Vector TLV (0x0104), length: 4, Flags: [ignore and don't forward if unknown] - 0x0000: c0a8 0002 + Path Vector: 192.168.0.2 Label Mapping Message (0x0400), length: 37, Message ID: 0x00000008, Flags: [ignore if unknown] FEC TLV (0x0100), length: 8, Flags: [ignore and don't forward if unknown] Prefix FEC (0x02): IPv4 prefix 192.168.3.2/32 Generic Label TLV (0x0200), length: 4, Flags: [ignore and don't forward if unknown] Label: 3 Hop Count TLV (0x0103), length: 1, Flags: [ignore and don't forward if unknown] - 0x0000: 01 + Hop Count: 1 Path Vector TLV (0x0104), length: 4, Flags: [ignore and don't forward if unknown] - 0x0000: c0a8 0002 + Path Vector: 192.168.0.2 Label Mapping Message (0x0400), length: 37, Message ID: 0x00000009, Flags: [ignore if unknown] FEC TLV (0x0100), length: 8, Flags: [ignore and don't forward if unknown] Prefix FEC (0x02): IPv4 prefix 192.168.4.2/32 Generic Label TLV (0x0200), length: 4, Flags: [ignore and don't forward if unknown] Label: 3 Hop Count TLV (0x0103), length: 1, Flags: [ignore and don't forward if unknown] - 0x0000: 01 + Hop Count: 1 Path Vector TLV (0x0104), length: 4, Flags: [ignore and don't forward if unknown] - 0x0000: c0a8 0002 + Path Vector: 192.168.0.2 11 12:24:11.929655 IP (tos 0xc0, ttl 255, id 1509, offset 0, flags [none], proto TCP (6), length 40) 192.168.0.2.58321 > 192.168.0.1.646: Flags [.], cksum 0x34ab (correct), ack 168, win 3020, length 0 12 12:24:11.929679 IP (tos 0xc0, ttl 255, id 1510, offset 0, flags [none], proto TCP (6), length 300) @@ -168,45 +168,45 @@ Generic Label TLV (0x0200), length: 4, Flags: [ignore and don't forward if unknown] Label: 20065 Hop Count TLV (0x0103), length: 1, Flags: [ignore and don't forward if unknown] - 0x0000: 02 + Hop Count: 2 Path Vector TLV (0x0104), length: 8, Flags: [ignore and don't forward if unknown] - 0x0000: c0a8 0001 c0a8 0002 + Path Vector: 192.168.0.1, 192.168.0.2 Label Mapping Message (0x0400), length: 41, Message ID: 0x00000010, Flags: [ignore if unknown] FEC TLV (0x0100), length: 8, Flags: [ignore and don't forward if unknown] Prefix FEC (0x02): IPv4 prefix 192.168.1.1/32 Generic Label TLV (0x0200), length: 4, Flags: [ignore and don't forward if unknown] Label: 20065 Hop Count TLV (0x0103), length: 1, Flags: [ignore and don't forward if unknown] - 0x0000: 02 + Hop Count: 2 Path Vector TLV (0x0104), length: 8, Flags: [ignore and don't forward if unknown] - 0x0000: c0a8 0001 c0a8 0002 + Path Vector: 192.168.0.1, 192.168.0.2 Label Mapping Message (0x0400), length: 41, Message ID: 0x00000011, Flags: [ignore if unknown] FEC TLV (0x0100), length: 8, Flags: [ignore and don't forward if unknown] Prefix FEC (0x02): IPv4 prefix 192.168.2.1/32 Generic Label TLV (0x0200), length: 4, Flags: [ignore and don't forward if unknown] Label: 20065 Hop Count TLV (0x0103), length: 1, Flags: [ignore and don't forward if unknown] - 0x0000: 02 + Hop Count: 2 Path Vector TLV (0x0104), length: 8, Flags: [ignore and don't forward if unknown] - 0x0000: c0a8 0001 c0a8 0002 + Path Vector: 192.168.0.1, 192.168.0.2 Label Mapping Message (0x0400), length: 41, Message ID: 0x00000012, Flags: [ignore if unknown] FEC TLV (0x0100), length: 8, Flags: [ignore and don't forward if unknown] Prefix FEC (0x02): IPv4 prefix 192.168.3.1/32 Generic Label TLV (0x0200), length: 4, Flags: [ignore and don't forward if unknown] Label: 20065 Hop Count TLV (0x0103), length: 1, Flags: [ignore and don't forward if unknown] - 0x0000: 02 + Hop Count: 2 Path Vector TLV (0x0104), length: 8, Flags: [ignore and don't forward if unknown] - 0x0000: c0a8 0001 c0a8 0002 + Path Vector: 192.168.0.1, 192.168.0.2 Label Mapping Message (0x0400), length: 41, Message ID: 0x00000013, Flags: [ignore if unknown] FEC TLV (0x0100), length: 8, Flags: [ignore and don't forward if unknown] Prefix FEC (0x02): IPv4 prefix 192.168.4.1/32 Generic Label TLV (0x0200), length: 4, Flags: [ignore and don't forward if unknown] Label: 20065 Hop Count TLV (0x0103), length: 1, Flags: [ignore and don't forward if unknown] - 0x0000: 02 + Hop Count: 2 Path Vector TLV (0x0104), length: 8, Flags: [ignore and don't forward if unknown] - 0x0000: c0a8 0001 c0a8 0002 + Path Vector: 192.168.0.1, 192.168.0.2 Label Withdraw Message (0x0402), length: 24, Message ID: 0x00000014, Flags: [ignore if unknown] FEC TLV (0x0100), length: 8, Flags: [ignore and don't forward if unknown] Prefix FEC (0x02): IPv4 prefix 192.168.0.3/32 @@ -253,45 +253,45 @@ Generic Label TLV (0x0200), length: 4, Flags: [ignore and don't forward if unknown] Label: 20066 Hop Count TLV (0x0103), length: 1, Flags: [ignore and don't forward if unknown] - 0x0000: 00 + Hop Count: 0 Path Vector TLV (0x0104), length: 4, Flags: [ignore and don't forward if unknown] - 0x0000: c0a8 0002 + Path Vector: 192.168.0.2 Label Mapping Message (0x0400), length: 37, Message ID: 0x0000001a, Flags: [ignore if unknown] FEC TLV (0x0100), length: 8, Flags: [ignore and don't forward if unknown] Prefix FEC (0x02): IPv4 prefix 192.168.1.3/32 Generic Label TLV (0x0200), length: 4, Flags: [ignore and don't forward if unknown] Label: 20066 Hop Count TLV (0x0103), length: 1, Flags: [ignore and don't forward if unknown] - 0x0000: 00 + Hop Count: 0 Path Vector TLV (0x0104), length: 4, Flags: [ignore and don't forward if unknown] - 0x0000: c0a8 0002 + Path Vector: 192.168.0.2 Label Mapping Message (0x0400), length: 37, Message ID: 0x0000001b, Flags: [ignore if unknown] FEC TLV (0x0100), length: 8, Flags: [ignore and don't forward if unknown] Prefix FEC (0x02): IPv4 prefix 192.168.2.3/32 Generic Label TLV (0x0200), length: 4, Flags: [ignore and don't forward if unknown] Label: 20066 Hop Count TLV (0x0103), length: 1, Flags: [ignore and don't forward if unknown] - 0x0000: 00 + Hop Count: 0 Path Vector TLV (0x0104), length: 4, Flags: [ignore and don't forward if unknown] - 0x0000: c0a8 0002 + Path Vector: 192.168.0.2 Label Mapping Message (0x0400), length: 37, Message ID: 0x0000001c, Flags: [ignore if unknown] FEC TLV (0x0100), length: 8, Flags: [ignore and don't forward if unknown] Prefix FEC (0x02): IPv4 prefix 192.168.3.3/32 Generic Label TLV (0x0200), length: 4, Flags: [ignore and don't forward if unknown] Label: 20066 Hop Count TLV (0x0103), length: 1, Flags: [ignore and don't forward if unknown] - 0x0000: 00 + Hop Count: 0 Path Vector TLV (0x0104), length: 4, Flags: [ignore and don't forward if unknown] - 0x0000: c0a8 0002 + Path Vector: 192.168.0.2 Label Mapping Message (0x0400), length: 37, Message ID: 0x0000001d, Flags: [ignore if unknown] FEC TLV (0x0100), length: 8, Flags: [ignore and don't forward if unknown] Prefix FEC (0x02): IPv4 prefix 192.168.4.3/32 Generic Label TLV (0x0200), length: 4, Flags: [ignore and don't forward if unknown] Label: 20066 Hop Count TLV (0x0103), length: 1, Flags: [ignore and don't forward if unknown] - 0x0000: 00 + Hop Count: 0 Path Vector TLV (0x0104), length: 4, Flags: [ignore and don't forward if unknown] - 0x0000: c0a8 0002 + Path Vector: 192.168.0.2 17 12:24:15.036359 IP (tos 0xc0, ttl 1, id 0, offset 0, flags [none], proto UDP (17), length 70) 12.1.3.2.646 > 224.0.0.2.646: LDP, Label-Space-ID: 172.168.0.2:0, pdu-length: 38