]> The Tcpdump Group git mirrors - tcpdump/commitdiff
DHCPv6: client-id/server-id DUID type 2 correction
authorEamon Doyle <[email protected]>
Tue, 18 Apr 2023 09:39:50 +0000 (10:39 +0100)
committerFrancois-Xavier Le Bail <[email protected]>
Thu, 12 Oct 2023 17:22:30 +0000 (19:22 +0200)
Explicitly print the enterprise as it is a separate field
per RFC8415, and allow variable lengths.

Add a test file.

(cherry picked from commit 46c1b8d227c8d0e1e65f9ab0c287ef9149056729)

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

index 7e7d1246fc0a2f970a41e0cb1023b1ce8e0335ef..8dfcb7bf036733a826558a8c0519f22ea53ec530 100644 (file)
@@ -336,9 +336,9 @@ dhcp6opt_print(netdissect_options *ndo,
                                }
                                break;
                        case 2:
-                               if (optlen >= 2 + 8) {
-                                       ND_PRINT(" vid ");
-                                       for (i = 2; i < 2 + 8; i++)
+                               if (optlen >= 2 + 4) {
+                                       ND_PRINT(" enterprise %u ", GET_BE_U_4(tp + 2));
+                                       for (i = 2 + 4; i < optlen; i++)
                                                ND_PRINT("%02x",
                                                         GET_U_1(tp + i));
                                        /*(*/
index c189d1c1636be0759e00c54d5b99881166383521..a713a1c71ae96d5a145a985edac22aaf64fb7cef 100644 (file)
@@ -852,6 +852,7 @@ lwres_with_extra lwres_with_extra.pcap lwres_with_extra.out
 
 # DHCP ZTP(RFC5970) and SZTP(RFC8572) tests
 dhcpv4v6-rfc5970-rfc8572 dhcpv4v6-rfc5970-rfc8572.pcap dhcpv4v6-rfc5970-rfc8572.out -vv
+dhcpv6-rfc8415-duid-type2 dhcpv6-rfc8415-duid-type2.pcap dhcpv6-rfc8415-duid-type2.out -v
 
 # Undefined behavior tests
 ip-snmp-leftshift-unsigned ip-snmp-leftshift-unsigned.pcap ip-snmp-leftshift-unsigned.out
diff --git a/tests/dhcpv6-rfc8415-duid-type2.out b/tests/dhcpv6-rfc8415-duid-type2.out
new file mode 100644 (file)
index 0000000..42acd27
--- /dev/null
@@ -0,0 +1 @@
+    1  16:59:07.188393 IP6 (flowlabel 0x38898, hlim 1, next-header UDP (17) payload length: 155) fe80::200:1ff:fe01:0.546 > ff02::1:2.547: [udp sum ok] dhcp6 request (xid=e4a4a3 (vendor-specific-info) (client-ID enterprise 30065 4853483134343235313438) (server-ID hwaddr/time type 1 time 721155524 828662a1defd) (option-request Bootfile-URL SZTP-redirect DNS-search-list DNS-server) (elapsed-time 0) (user-class Arista) (IA_NA IAID:16842752 T1:3600 T2:5400 (IA_ADDR 1234:5678::4 pltime:7200 vltime:7500)))
diff --git a/tests/dhcpv6-rfc8415-duid-type2.pcap b/tests/dhcpv6-rfc8415-duid-type2.pcap
new file mode 100644 (file)
index 0000000..1636464
Binary files /dev/null and b/tests/dhcpv6-rfc8415-duid-type2.pcap differ