]> The Tcpdump Group git mirrors - tcpdump/commitdiff
DHCPv6: Add DUID-UUID printing (RFC6355)
authorFrancois-Xavier Le Bail <[email protected]>
Fri, 7 Jul 2023 14:00:28 +0000 (16:00 +0200)
committerFrancois-Xavier Le Bail <[email protected]>
Fri, 7 Jul 2023 17:49:40 +0000 (19:49 +0200)
Define DUID_LLT, DUID_EN, DUID_LL and DUID_UUID.

Add a test file.

print-dhcp6.c
tests/TESTLIST
tests/dhcpv6-rfc6355-duid-uuid.out [new file with mode: 0644]
tests/dhcpv6-rfc6355-duid-uuid.pcap [new file with mode: 0644]

index 533e34d9b5e0739dc33b042f88eead3302007c50..ba9569e306b5115dce8c3890f9616c2957d704ad 100644 (file)
@@ -121,6 +121,10 @@ struct dhcp6_relay {
 /* options */
 #define DH6OPT_CLIENTID        1
 #define DH6OPT_SERVERID        2
+#  define DUID_LLT  1 /* RFC8415 */
+#  define DUID_EN   2 /* RFC8415 */
+#  define DUID_LL   3 /* RFC8415 */
+#  define DUID_UUID 4 /* RFC6355 */
 #define DH6OPT_IA_NA 3
 #define DH6OPT_IA_TA 4
 #define DH6OPT_IA_ADDR 5
@@ -320,7 +324,7 @@ dhcp6opt_print(netdissect_options *ndo,
                        }
                        tp = (const u_char *)(dh6o + 1);
                        switch (GET_BE_U_2(tp)) {
-                       case 1:
+                       case DUID_LLT:
                                if (optlen >= 2 + 6) {
                                        ND_PRINT(" hwaddr/time type %u time %u ",
                                            GET_BE_U_2(tp + 2),
@@ -335,7 +339,7 @@ dhcp6opt_print(netdissect_options *ndo,
                                        ND_PRINT(" ?)");
                                }
                                break;
-                       case 2:
+                       case DUID_EN:
                                if (optlen >= 2 + 4) {
                                        ND_PRINT(" enterprise %u ", GET_BE_U_4(tp + 2));
                                        for (i = 2 + 4; i < optlen; i++)
@@ -348,7 +352,7 @@ dhcp6opt_print(netdissect_options *ndo,
                                        ND_PRINT(" ?)");
                                }
                                break;
-                       case 3:
+                       case DUID_LL:
                                if (optlen >= 2 + 2) {
                                        ND_PRINT(" hwaddr type %u ",
                                            GET_BE_U_2(tp + 2));
@@ -362,6 +366,19 @@ dhcp6opt_print(netdissect_options *ndo,
                                        ND_PRINT(" ?)");
                                }
                                break;
+                       case DUID_UUID:
+                               ND_PRINT(" uuid ");
+                               if (optlen == 2 + 16) {
+                                       for (i = 2; i < optlen; i++)
+                                               ND_PRINT("%02x",
+                                                        GET_U_1(tp + i));
+                                       /*(*/
+                                       ND_PRINT(")");
+                               } else {
+                                       /*(*/
+                                       ND_PRINT(" ?)");
+                               }
+                               break;
                        default:
                                ND_PRINT(" type %u)", GET_BE_U_2(tp));
                                break;
index c590f67cfcc30752020d82744b0705ac283865b0..6f478e53dc8c0b97f0b4d1c1f7b8a7080d9305a4 100644 (file)
@@ -259,6 +259,7 @@ dhcpv6-ntp-server   dhcpv6-ntp-server.pcap  dhcpv6-ntp-server.out   -v
 dhcpv6-sip-server-d    dhcpv6-sip-server-d.pcap        dhcpv6-sip-server-d.out -v
 dhcpv6-domain-list     dhcpv6-domain-list.pcap dhcpv6-domain-list.out  -v
 dhcpv6-mud     dhcpv6-mud.pcap         dhcpv6-mud.out -vv
+dhcpv6-rfc6355-duid-uuid dhcpv6-rfc6355-duid-uuid.pcap dhcpv6-rfc6355-duid-uuid.out -v
 
 # ZeroMQ/PGM tests
 # ZMTP/1.0 over TCP
diff --git a/tests/dhcpv6-rfc6355-duid-uuid.out b/tests/dhcpv6-rfc6355-duid-uuid.out
new file mode 100644 (file)
index 0000000..87acd04
--- /dev/null
@@ -0,0 +1,2 @@
+    1  11:19:08.826971 IP6 (flowlabel 0xd92bc, hlim 1, next-header UDP (17) payload length: 112) fe80::7e39:bc67:f367:8def.546 > ff02::1:2.547: [udp sum ok] dhcp6 renew (xid=9f56b (client-ID uuid a256e92e40abd0d2a3ab3b3ff2ff8998) (server-ID hwaddr type 1 a021b7e0d871) (option-request DNS-server DNS-search-list DNS-server DNS-search-list client-ID) (elapsed-time 0) (IA_NA IAID:971445380 T1:3600 T2:5400 (IA_ADDR 2a02:2788:7c8:4dd:4a5b:39ff:fee7:1484 pltime:7200 vltime:7500)))
+    2  11:19:08.827665 IP6 (hlim 128, next-header UDP (17) payload length: 140) fe80::a221:b7ff:fee0:d871.547 > fe80::7e39:bc67:f367:8def.546: [udp sum ok] dhcp6 reply (xid=9f56b (client-ID uuid a256e92e40abd0d2a3ab3b3ff2ff8998) (IA_NA IAID:971445380 T1:15 T2:45 (IA_ADDR 2a02:2788:7c8:4dd:4a5b:39ff:fee7:1484 pltime:30 vltime:60)) (DNS-server 2a02:2788:fff0:7::3 2a02:2788:fff0:5::140) (DNS-search-list voo.be.) (server-ID hwaddr type 1 a021b7e0d871))
diff --git a/tests/dhcpv6-rfc6355-duid-uuid.pcap b/tests/dhcpv6-rfc6355-duid-uuid.pcap
new file mode 100644 (file)
index 0000000..dea8967
Binary files /dev/null and b/tests/dhcpv6-rfc6355-duid-uuid.pcap differ