]> The Tcpdump Group git mirrors - tcpdump/commitdiff
LDP: add support for the Path Vector and Hop Count TLV as per RFC 5036
authorHannes Gredler <[email protected]>
Wed, 16 Aug 2023 12:34:17 +0000 (12:34 +0000)
committerfxlb <[email protected]>
Sat, 9 Sep 2023 06:27:30 +0000 (06:27 +0000)
print-ldp.c
tests/ldp-common-session.out

index f09c5a6e84a63219372324eba55a23cd46706904..b75b36199d8db84df4bb1d3bb1199fae7ecadb04 100644 (file)
@@ -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:
index 7f775fd6af3049754e8302259c8d2af4efc356f5..e5d3f0ad9acf674745fcdfafb2f04b82484869f5 100644 (file)
            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)
            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
            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