]> The Tcpdump Group git mirrors - tcpdump/commitdiff
LDP: add support for Dual Stack Capability TLV as per RFC 7552
authorHannes Gredler <[email protected]>
Wed, 16 Aug 2023 08:58:56 +0000 (08:58 +0000)
committerfxlb <[email protected]>
Sat, 9 Sep 2023 06:27:30 +0000 (06:27 +0000)
Make Label Req, Label Rel, Label Abort Req Message Types use the generic
TLV printer.

print-ldp.c
tests/ldp-common-session.out

index 642feb241cb670eb946e63dd941b15e73516d1e7..1e8f87d3429afdd57f68f99c53baabbc02087240 100644 (file)
@@ -144,6 +144,7 @@ static const struct tok ldp_msg_values[] = {
 #define LDP_TLV_FT_SESSION          0x0503
 #define        LDP_TLV_LABEL_REQUEST_MSG_ID 0x0600
 #define LDP_TLV_MTU                  0x0601 /* rfc 3988 */
 #define LDP_TLV_FT_SESSION          0x0503
 #define        LDP_TLV_LABEL_REQUEST_MSG_ID 0x0600
 #define LDP_TLV_MTU                  0x0601 /* rfc 3988 */
+#define LDP_TLV_DUAL_STACK_CAP       0x0701 /* rfc 7552 */
 
 static const struct tok ldp_tlv_values[] = {
     { LDP_TLV_FEC,                  "FEC" },
 
 static const struct tok ldp_tlv_values[] = {
     { LDP_TLV_FEC,                  "FEC" },
@@ -167,6 +168,7 @@ static const struct tok ldp_tlv_values[] = {
     { LDP_TLV_FT_SESSION,            "Fault-Tolerant Session Parameters" },
     { LDP_TLV_LABEL_REQUEST_MSG_ID,  "Label Request Message ID" },
     { LDP_TLV_MTU,                   "MTU" },
     { LDP_TLV_FT_SESSION,            "Fault-Tolerant Session Parameters" },
     { LDP_TLV_LABEL_REQUEST_MSG_ID,  "Label Request Message ID" },
     { LDP_TLV_MTU,                   "MTU" },
+    { LDP_TLV_DUAL_STACK_CAP,        "Dual-Stack Capability" },
     { 0, NULL}
 };
 
     { 0, NULL}
 };
 
@@ -211,6 +213,16 @@ static const struct tok ldp_fec_martini_ifparm_vccv_cv_values[] = {
     { 0, NULL}
 };
 
     { 0, NULL}
 };
 
+/* rfc 7552 */
+#define LDP_DUAL_STACK_TRANSPORT_PREF_IPV4  0x40
+#define LDP_DUAL_STACK_TRANSPORT_PREF_IPV6  0x60
+
+static const struct tok ldp_dual_stack_transport_pref_values[] = {
+    { LDP_DUAL_STACK_TRANSPORT_PREF_IPV4, "IPv4" },
+    { LDP_DUAL_STACK_TRANSPORT_PREF_IPV6, "IPv6" },
+    { 0, NULL}
+};
+
 static u_int ldp_pdu_print(netdissect_options *, const u_char *);
 
 /*
 static u_int ldp_pdu_print(netdissect_options *, const u_char *);
 
 /*
@@ -249,7 +261,7 @@ ldp_tlv_print(netdissect_options *ndo,
 
     const struct ldp_tlv_header *ldp_tlv_header;
     u_short tlv_type,tlv_len,tlv_tlen,af,ft_flags;
 
     const struct ldp_tlv_header *ldp_tlv_header;
     u_short tlv_type,tlv_len,tlv_tlen,af,ft_flags;
-    u_char fec_type;
+    u_char fec_type, transport_pref;
     u_int ui,vc_info_len, vc_info_tlv_type, vc_info_tlv_len,idx;
     char buf[100];
     int i;
     u_int ui,vc_info_len, vc_info_tlv_type, vc_info_tlv_len,idx;
     char buf[100];
     int i;
@@ -517,6 +529,15 @@ ldp_tlv_print(netdissect_options *ndo,
        ND_PRINT("\n\t      MTU: %u", GET_BE_U_2(tptr));
        break;
 
        ND_PRINT("\n\t      MTU: %u", GET_BE_U_2(tptr));
        break;
 
+    case LDP_TLV_DUAL_STACK_CAP:
+       TLV_TCHECK(4);
+       transport_pref = GET_U_1(tptr);
+       ND_PRINT("\n\t      Transport Connection Preference: %s",
+                tok2str(ldp_dual_stack_transport_pref_values,
+                        "Unknown",
+                        transport_pref));
+       break;
+
 
     /*
      *  FIXME those are the defined TLVs that lack a decoder
 
     /*
      *  FIXME those are the defined TLVs that lack a decoder
@@ -667,6 +688,9 @@ ldp_pdu_print(netdissect_options *ndo,
         case LDP_MSG_LABEL_MAPPING:
         case LDP_MSG_ADDRESS_WITHDRAW:
         case LDP_MSG_LABEL_WITHDRAW:
         case LDP_MSG_LABEL_MAPPING:
         case LDP_MSG_ADDRESS_WITHDRAW:
         case LDP_MSG_LABEL_WITHDRAW:
+        case LDP_MSG_LABEL_REQUEST:
+        case LDP_MSG_LABEL_RELEASE:
+        case LDP_MSG_LABEL_ABORT_REQUEST:
             while(msg_tlen >= 4) {
                 processed = ldp_tlv_print(ndo, msg_tptr, msg_tlen);
                 if (processed == 0)
             while(msg_tlen >= 4) {
                 processed = ldp_tlv_print(ndo, msg_tptr, msg_tlen);
                 if (processed == 0)
@@ -676,15 +700,6 @@ ldp_pdu_print(netdissect_options *ndo,
             }
             break;
 
             }
             break;
 
-        /*
-         *  FIXME those are the defined messages that lack a decoder
-         *  you are welcome to contribute code ;-)
-         */
-
-        case LDP_MSG_LABEL_REQUEST:
-        case LDP_MSG_LABEL_RELEASE:
-        case LDP_MSG_LABEL_ABORT_REQUEST:
-
         default:
             if (ndo->ndo_vflag <= 1)
                 print_unknown_data(ndo, msg_tptr, "\n\t  ", msg_tlen);
         default:
             if (ndo->ndo_vflag <= 1)
                 print_unknown_data(ndo, msg_tptr, "\n\t  ", msg_tlen);
index 2668191a498a908810db4f1b849d7551cb379f96..8414fa360b54be9a9f482f066f81fe8be5ad09f5 100644 (file)
@@ -14,8 +14,8 @@
              Hold Time: 15s, Flags: [Link Hello]
            IPv4 Transport Address TLV (0x0401), length: 4, Flags: [ignore and don't forward if unknown]
              IPv4 Transport Address: 172.168.0.2
              Hold Time: 15s, Flags: [Link Hello]
            IPv4 Transport Address TLV (0x0401), length: 4, Flags: [ignore and don't forward if unknown]
              IPv4 Transport Address: 172.168.0.2
-           Unknown TLV (0x0701), length: 4, Flags: [continue processing and don't forward if unknown]
-             0x0000:  4000 0000
+           Dual-Stack Capability TLV (0x0701), length: 4, Flags: [continue processing and don't forward if unknown]
+             Transport Connection Preference: IPv4
     4  12:24:05.058942 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
     4  12:24:05.058942 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
@@ -24,8 +24,8 @@
              Hold Time: 15s, Flags: [Link Hello]
            IPv4 Transport Address TLV (0x0401), length: 4, Flags: [ignore and don't forward if unknown]
              IPv4 Transport Address: 172.168.0.2
              Hold Time: 15s, Flags: [Link Hello]
            IPv4 Transport Address TLV (0x0401), length: 4, Flags: [ignore and don't forward if unknown]
              IPv4 Transport Address: 172.168.0.2
-           Unknown TLV (0x0701), length: 4, Flags: [continue processing and don't forward if unknown]
-             0x0000:  4000 0000
+           Dual-Stack Capability TLV (0x0701), length: 4, Flags: [continue processing and don't forward if unknown]
+             Transport Connection Preference: IPv4
     5  12:24:08.049677 IP (tos 0xc0, ttl 1, id 0, offset 0, flags [none], proto UDP (17), length 70)
     12.0.0.2.646 > 224.0.0.2.646: 
        LDP, Label-Space-ID: 192.168.0.2:0, pdu-length: 38
     5  12:24:08.049677 IP (tos 0xc0, ttl 1, id 0, offset 0, flags [none], proto UDP (17), length 70)
     12.0.0.2.646 > 224.0.0.2.646: 
        LDP, Label-Space-ID: 192.168.0.2:0, pdu-length: 38
@@ -34,8 +34,8 @@
              Hold Time: 15s, Flags: [Link Hello]
            IPv4 Transport Address TLV (0x0401), length: 4, Flags: [ignore and don't forward if unknown]
              IPv4 Transport Address: 192.168.0.2
              Hold Time: 15s, Flags: [Link Hello]
            IPv4 Transport Address TLV (0x0401), length: 4, Flags: [ignore and don't forward if unknown]
              IPv4 Transport Address: 192.168.0.2
-           Unknown TLV (0x0701), length: 4, Flags: [continue processing and don't forward if unknown]
-             0x0000:  4000 0000
+           Dual-Stack Capability TLV (0x0701), length: 4, Flags: [continue processing and don't forward if unknown]
+             Transport Connection Preference: IPv4
     6  12:24:10.017949 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
     6  12:24:10.017949 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
@@ -44,8 +44,8 @@
              Hold Time: 15s, Flags: [Link Hello]
            IPv4 Transport Address TLV (0x0401), length: 4, Flags: [ignore and don't forward if unknown]
              IPv4 Transport Address: 172.168.0.2
              Hold Time: 15s, Flags: [Link Hello]
            IPv4 Transport Address TLV (0x0401), length: 4, Flags: [ignore and don't forward if unknown]
              IPv4 Transport Address: 172.168.0.2
-           Unknown TLV (0x0701), length: 4, Flags: [continue processing and don't forward if unknown]
-             0x0000:  4000 0000
+           Dual-Stack Capability TLV (0x0701), length: 4, Flags: [continue processing and don't forward if unknown]
+             Transport Connection Preference: IPv4
     7  12:24:11.046122 IP (tos 0x0, ttl 255, id 1505, offset 0, flags [none], proto TCP (6), length 48)
     192.168.0.2.58321 > 192.168.0.1.646: Flags [S], cksum 0x6df9 (correct), seq 110236, win 65535, options [mss 1420,nop,wscale 5], length 0
     8  12:24:11.046149 IP (tos 0xc0, ttl 255, id 1506, offset 0, flags [none], proto TCP (6), length 81)
     7  12:24:11.046122 IP (tos 0x0, ttl 255, id 1505, offset 0, flags [none], proto TCP (6), length 48)
     192.168.0.2.58321 > 192.168.0.1.646: Flags [S], cksum 0x6df9 (correct), seq 110236, win 65535, options [mss 1420,nop,wscale 5], length 0
     8  12:24:11.046149 IP (tos 0xc0, ttl 255, id 1506, offset 0, flags [none], proto TCP (6), length 81)
     192.168.0.2.58321 > 192.168.0.1.646: Flags [P.], cksum 0xbffe (correct), seq 406:666, ack 813, win 3000, length 260
        LDP, Label-Space-ID: 192.168.0.2:0, pdu-length: 48
          Label Release Message (0x0403), length: 38, Message ID: 0x0000000a, Flags: [ignore if unknown]
     192.168.0.2.58321 > 192.168.0.1.646: Flags [P.], cksum 0xbffe (correct), seq 406:666, ack 813, win 3000, length 260
        LDP, Label-Space-ID: 192.168.0.2:0, pdu-length: 48
          Label Release Message (0x0403), length: 38, Message ID: 0x0000000a, Flags: [ignore if unknown]
-         0x0000:  0100 0008 0200 0120 c0a8 0002 0200 0004
-         0x0010:  0000 4e62 0300 000a 0000 000b 0000 000f
-         0x0020:  0400
+           FEC TLV (0x0100), length: 8, Flags: [ignore and don't forward if unknown]
+             Prefix FEC (0x02): IPv4 prefix 192.168.0.2/32
+           Generic Label TLV (0x0200), length: 4, Flags: [ignore and don't forward if unknown]
+             Label: 20066
+           Status TLV (0x0300), length: 10, Flags: [ignore and don't forward if unknown]
+             Status: 0x0b, Flags: [Advisory Notification and don't forward], causing Message ID: 0x0000000f
        LDP, Label-Space-ID: 192.168.0.2:0, pdu-length: 48
          Label Release Message (0x0403), length: 38, Message ID: 0x0000000b, Flags: [ignore if unknown]
        LDP, Label-Space-ID: 192.168.0.2:0, pdu-length: 48
          Label Release Message (0x0403), length: 38, Message ID: 0x0000000b, Flags: [ignore if unknown]
-         0x0000:  0100 0008 0200 0120 c0a8 0102 0200 0004
-         0x0010:  0000 4e62 0300 000a 0000 000b 0000 0010
-         0x0020:  0400
+           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: 20066
+           Status TLV (0x0300), length: 10, Flags: [ignore and don't forward if unknown]
+             Status: 0x0b, Flags: [Advisory Notification and don't forward], causing Message ID: 0x00000010
        LDP, Label-Space-ID: 192.168.0.2:0, pdu-length: 48
          Label Release Message (0x0403), length: 38, Message ID: 0x0000000c, Flags: [ignore if unknown]
        LDP, Label-Space-ID: 192.168.0.2:0, pdu-length: 48
          Label Release Message (0x0403), length: 38, Message ID: 0x0000000c, Flags: [ignore if unknown]
-         0x0000:  0100 0008 0200 0120 c0a8 0202 0200 0004
-         0x0010:  0000 4e62 0300 000a 0000 000b 0000 0011
-         0x0020:  0400
+           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: 20066
+           Status TLV (0x0300), length: 10, Flags: [ignore and don't forward if unknown]
+             Status: 0x0b, Flags: [Advisory Notification and don't forward], causing Message ID: 0x00000011
        LDP, Label-Space-ID: 192.168.0.2:0, pdu-length: 48
          Label Release Message (0x0403), length: 38, Message ID: 0x0000000d, Flags: [ignore if unknown]
        LDP, Label-Space-ID: 192.168.0.2:0, pdu-length: 48
          Label Release Message (0x0403), length: 38, Message ID: 0x0000000d, Flags: [ignore if unknown]
-         0x0000:  0100 0008 0200 0120 c0a8 0302 0200 0004
-         0x0010:  0000 4e62 0300 000a 0000 000b 0000 0012
-         0x0020:  0400
+           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: 20066
+           Status TLV (0x0300), length: 10, Flags: [ignore and don't forward if unknown]
+             Status: 0x0b, Flags: [Advisory Notification and don't forward], causing Message ID: 0x00000012
        LDP, Label-Space-ID: 192.168.0.2:0, pdu-length: 48
          Label Release Message (0x0403), length: 38, Message ID: 0x0000000e, Flags: [ignore if unknown]
        LDP, Label-Space-ID: 192.168.0.2:0, pdu-length: 48
          Label Release Message (0x0403), length: 38, Message ID: 0x0000000e, Flags: [ignore if unknown]
-         0x0000:  0100 0008 0200 0120 c0a8 0402 0200 0004
-         0x0010:  0000 4e62 0300 000a 0000 000b 0000 0013
-         0x0020:  0400
+           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: 20066
+           Status TLV (0x0300), length: 10, Flags: [ignore and don't forward if unknown]
+             Status: 0x0b, Flags: [Advisory Notification and don't forward], causing Message ID: 0x00000013
    13  12:24:12.831754 IP (tos 0xc0, ttl 255, id 1520, offset 0, flags [none], proto TCP (6), length 415)
     192.168.0.2.58321 > 192.168.0.1.646: Flags [P.], cksum 0xef2a (correct), seq 666:1041, ack 813, win 3000, length 375
        LDP, Label-Space-ID: 192.168.0.2:0, pdu-length: 371
    13  12:24:12.831754 IP (tos 0xc0, ttl 255, id 1520, offset 0, flags [none], proto TCP (6), length 415)
     192.168.0.2.58321 > 192.168.0.1.646: Flags [P.], cksum 0xef2a (correct), seq 666:1041, ack 813, win 3000, length 375
        LDP, Label-Space-ID: 192.168.0.2:0, pdu-length: 371
              Hold Time: 15s, Flags: [Link Hello]
            IPv4 Transport Address TLV (0x0401), length: 4, Flags: [ignore and don't forward if unknown]
              IPv4 Transport Address: 192.168.0.2
              Hold Time: 15s, Flags: [Link Hello]
            IPv4 Transport Address TLV (0x0401), length: 4, Flags: [ignore and don't forward if unknown]
              IPv4 Transport Address: 192.168.0.2
-           Unknown TLV (0x0701), length: 4, Flags: [continue processing and don't forward if unknown]
-             0x0000:  4000 0000
+           Dual-Stack Capability TLV (0x0701), length: 4, Flags: [continue processing and don't forward if unknown]
+             Transport Connection Preference: IPv4
    15  12:24:13.058561 IP (tos 0xc0, ttl 255, id 1524, offset 0, flags [none], proto TCP (6), length 40)
     192.168.0.2.58321 > 192.168.0.1.646: Flags [.], cksum 0x2e0b (correct), ack 1263, win 2986, length 0
    16  12:24:13.833287 IP (tos 0xc0, ttl 255, id 1530, offset 0, flags [none], proto TCP (6), length 255)
    15  12:24:13.058561 IP (tos 0xc0, ttl 255, id 1524, offset 0, flags [none], proto TCP (6), length 40)
     192.168.0.2.58321 > 192.168.0.1.646: Flags [.], cksum 0x2e0b (correct), ack 1263, win 2986, length 0
    16  12:24:13.833287 IP (tos 0xc0, ttl 255, id 1530, offset 0, flags [none], proto TCP (6), length 255)
              Hold Time: 15s, Flags: [Link Hello]
            IPv4 Transport Address TLV (0x0401), length: 4, Flags: [ignore and don't forward if unknown]
              IPv4 Transport Address: 172.168.0.2
              Hold Time: 15s, Flags: [Link Hello]
            IPv4 Transport Address TLV (0x0401), length: 4, Flags: [ignore and don't forward if unknown]
              IPv4 Transport Address: 172.168.0.2
-           Unknown TLV (0x0701), length: 4, Flags: [continue processing and don't forward if unknown]
-             0x0000:  4000 0000
+           Dual-Stack Capability TLV (0x0701), length: 4, Flags: [continue processing and don't forward if unknown]
+             Transport Connection Preference: IPv4
    18  12:24:18.042950 IP (tos 0xc0, ttl 1, id 0, offset 0, flags [none], proto UDP (17), length 70)
     12.0.0.2.646 > 224.0.0.2.646: 
        LDP, Label-Space-ID: 192.168.0.2:0, pdu-length: 38
    18  12:24:18.042950 IP (tos 0xc0, ttl 1, id 0, offset 0, flags [none], proto UDP (17), length 70)
     12.0.0.2.646 > 224.0.0.2.646: 
        LDP, Label-Space-ID: 192.168.0.2:0, pdu-length: 38
              Hold Time: 15s, Flags: [Link Hello]
            IPv4 Transport Address TLV (0x0401), length: 4, Flags: [ignore and don't forward if unknown]
              IPv4 Transport Address: 192.168.0.2
              Hold Time: 15s, Flags: [Link Hello]
            IPv4 Transport Address TLV (0x0401), length: 4, Flags: [ignore and don't forward if unknown]
              IPv4 Transport Address: 192.168.0.2
-           Unknown TLV (0x0701), length: 4, Flags: [continue processing and don't forward if unknown]
-             0x0000:  4000 0000
+           Dual-Stack Capability TLV (0x0701), length: 4, Flags: [continue processing and don't forward if unknown]
+             Transport Connection Preference: IPv4
    19  12:24:20.052540 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
    19  12:24:20.052540 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
              Hold Time: 15s, Flags: [Link Hello]
            IPv4 Transport Address TLV (0x0401), length: 4, Flags: [ignore and don't forward if unknown]
              IPv4 Transport Address: 172.168.0.2
              Hold Time: 15s, Flags: [Link Hello]
            IPv4 Transport Address TLV (0x0401), length: 4, Flags: [ignore and don't forward if unknown]
              IPv4 Transport Address: 172.168.0.2
-           Unknown TLV (0x0701), length: 4, Flags: [continue processing and don't forward if unknown]
-             0x0000:  4000 0000
+           Dual-Stack Capability TLV (0x0701), length: 4, Flags: [continue processing and don't forward if unknown]
+             Transport Connection Preference: IPv4
    20  12:24:21.030795 IP (tos 0xc0, ttl 255, id 1534, offset 0, flags [none], proto TCP (6), length 58)
     192.168.0.2.58321 > 192.168.0.1.646: Flags [P.], cksum 0x6a3d (correct), seq 1256:1274, ack 1263, win 2986, length 18
    21  12:24:21.087477 IP (tos 0xc0, ttl 255, id 1535, offset 0, flags [none], proto TCP (6), length 40)
    20  12:24:21.030795 IP (tos 0xc0, ttl 255, id 1534, offset 0, flags [none], proto TCP (6), length 58)
     192.168.0.2.58321 > 192.168.0.1.646: Flags [P.], cksum 0x6a3d (correct), seq 1256:1274, ack 1263, win 2986, length 18
    21  12:24:21.087477 IP (tos 0xc0, ttl 255, id 1535, offset 0, flags [none], proto TCP (6), length 40)
              Hold Time: 15s, Flags: [Link Hello]
            IPv4 Transport Address TLV (0x0401), length: 4, Flags: [ignore and don't forward if unknown]
              IPv4 Transport Address: 192.168.0.2
              Hold Time: 15s, Flags: [Link Hello]
            IPv4 Transport Address TLV (0x0401), length: 4, Flags: [ignore and don't forward if unknown]
              IPv4 Transport Address: 192.168.0.2
-           Unknown TLV (0x0701), length: 4, Flags: [continue processing and don't forward if unknown]
-             0x0000:  4000 0000
+           Dual-Stack Capability TLV (0x0701), length: 4, Flags: [continue processing and don't forward if unknown]
+             Transport Connection Preference: IPv4