From: Eamon Doyle Date: Tue, 18 Apr 2023 09:39:50 +0000 (+0100) Subject: DHCPv6: client-id/server-id DUID type 2 correction X-Git-Tag: tcpdump-4.99.5~187 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/481fe6080d17dc7e820ba0f335454f6b9dcc5a02 DHCPv6: client-id/server-id DUID type 2 correction 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) --- diff --git a/print-dhcp6.c b/print-dhcp6.c index 7e7d1246..8dfcb7bf 100644 --- a/print-dhcp6.c +++ b/print-dhcp6.c @@ -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)); /*(*/ diff --git a/tests/TESTLIST b/tests/TESTLIST index c189d1c1..a713a1c7 100644 --- a/tests/TESTLIST +++ b/tests/TESTLIST @@ -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 index 00000000..42acd277 --- /dev/null +++ b/tests/dhcpv6-rfc8415-duid-type2.out @@ -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 index 00000000..16364646 Binary files /dev/null and b/tests/dhcpv6-rfc8415-duid-type2.pcap differ