Skip to content

Commit 1e3b959

Browse files
committed
DHCPv6: Add DUID-UUID printing (RFC6355)
Define DUID_LLT, DUID_EN, DUID_LL and DUID_UUID. Add a test file.
1 parent 46c1b8d commit 1e3b959

File tree

4 files changed

+23
-3
lines changed

4 files changed

+23
-3
lines changed

print-dhcp6.c

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,10 @@ struct dhcp6_relay {
121121
/* options */
122122
#define DH6OPT_CLIENTID 1
123123
#define DH6OPT_SERVERID 2
124+
# define DUID_LLT 1 /* RFC8415 */
125+
# define DUID_EN 2 /* RFC8415 */
126+
# define DUID_LL 3 /* RFC8415 */
127+
# define DUID_UUID 4 /* RFC6355 */
124128
#define DH6OPT_IA_NA 3
125129
#define DH6OPT_IA_TA 4
126130
#define DH6OPT_IA_ADDR 5
@@ -320,7 +324,7 @@ dhcp6opt_print(netdissect_options *ndo,
320324
}
321325
tp = (const u_char *)(dh6o + 1);
322326
switch (GET_BE_U_2(tp)) {
323-
case 1:
327+
case DUID_LLT:
324328
if (optlen >= 2 + 6) {
325329
ND_PRINT(" hwaddr/time type %u time %u ",
326330
GET_BE_U_2(tp + 2),
@@ -335,7 +339,7 @@ dhcp6opt_print(netdissect_options *ndo,
335339
ND_PRINT(" ?)");
336340
}
337341
break;
338-
case 2:
342+
case DUID_EN:
339343
if (optlen >= 2 + 4) {
340344
ND_PRINT(" enterprise %u ", GET_BE_U_4(tp + 2));
341345
for (i = 2 + 4; i < optlen; i++)
@@ -348,7 +352,7 @@ dhcp6opt_print(netdissect_options *ndo,
348352
ND_PRINT(" ?)");
349353
}
350354
break;
351-
case 3:
355+
case DUID_LL:
352356
if (optlen >= 2 + 2) {
353357
ND_PRINT(" hwaddr type %u ",
354358
GET_BE_U_2(tp + 2));
@@ -362,6 +366,19 @@ dhcp6opt_print(netdissect_options *ndo,
362366
ND_PRINT(" ?)");
363367
}
364368
break;
369+
case DUID_UUID:
370+
ND_PRINT(" uuid ");
371+
if (optlen == 2 + 16) {
372+
for (i = 2; i < optlen; i++)
373+
ND_PRINT("%02x",
374+
GET_U_1(tp + i));
375+
/*(*/
376+
ND_PRINT(")");
377+
} else {
378+
/*(*/
379+
ND_PRINT(" ?)");
380+
}
381+
break;
365382
default:
366383
ND_PRINT(" type %u)", GET_BE_U_2(tp));
367384
break;

tests/TESTLIST

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@ dhcpv6-ntp-server dhcpv6-ntp-server.pcap dhcpv6-ntp-server.out -v
259259
dhcpv6-sip-server-d dhcpv6-sip-server-d.pcap dhcpv6-sip-server-d.out -v
260260
dhcpv6-domain-list dhcpv6-domain-list.pcap dhcpv6-domain-list.out -v
261261
dhcpv6-mud dhcpv6-mud.pcap dhcpv6-mud.out -vv
262+
dhcpv6-rfc6355-duid-uuid dhcpv6-rfc6355-duid-uuid.pcap dhcpv6-rfc6355-duid-uuid.out -v
262263

263264
# ZeroMQ/PGM tests
264265
# ZMTP/1.0 over TCP

tests/dhcpv6-rfc6355-duid-uuid.out

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
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+
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))

tests/dhcpv6-rfc6355-duid-uuid.pcap

416 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)