Skip to content

Commit a7476a1

Browse files
committed
DHCPv6: Print the details of the Vendor-specific Information Option
Print the enterprise number and the sub-options (RFC 8415 section 21.17). Add a test file. Update two test outputs accordingly.
1 parent 5c19156 commit a7476a1

6 files changed

+50
-7
lines changed

print-dhcp6.c

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -845,6 +845,47 @@ dhcp6opt_print(netdissect_options *ndo,
845845
ND_PRINT(")");
846846
break;
847847

848+
case DH6OPT_VENDOR_OPTS:
849+
/* RFC 8415 section 21.17 */
850+
if (optlen < 4) {
851+
ND_PRINT(" ?)");
852+
break;
853+
}
854+
tp = (const u_char *)(dh6o + 1);
855+
remain_len = optlen;
856+
ND_PRINT(" enterprise %u", GET_BE_U_4(tp));
857+
remain_len -= 4;
858+
tp += 4;
859+
while (remain_len >= 4) {
860+
/* there are sub-options */
861+
ND_PRINT(" (code %u", GET_BE_U_2(tp));
862+
tp += 2;
863+
subopt_len = GET_BE_U_2(tp);
864+
ND_PRINT(" len %u", subopt_len);
865+
tp += 2;
866+
remain_len -= 4;
867+
if (subopt_len > remain_len) {
868+
ND_PRINT(" ?");
869+
break;
870+
}
871+
if (subopt_len > 0) {
872+
ND_PRINT(" data ");
873+
for (i = 0; i < subopt_len && i < 10; i++)
874+
ND_PRINT("%02x",
875+
GET_U_1(tp + i));
876+
if (i < subopt_len)
877+
ND_PRINT("...");
878+
ND_PRINT(")");
879+
tp += subopt_len;
880+
remain_len -= subopt_len;
881+
}
882+
ND_PRINT(")");
883+
}
884+
if (remain_len != 0)
885+
ND_PRINT(" ?");
886+
ND_PRINT(")");
887+
break;
888+
848889
default:
849890
ND_PRINT(")");
850891
break;

tests/TESTLIST

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ dhcpv6-sip-server-d dhcpv6-sip-server-d.pcap dhcpv6-sip-server-d.out -v
265265
dhcpv6-domain-list dhcpv6-domain-list.pcap dhcpv6-domain-list.out -v
266266
dhcpv6-mud dhcpv6-mud.pcap dhcpv6-mud.out -vv
267267
dhcpv6-rfc6355-duid-uuid dhcpv6-rfc6355-duid-uuid.pcap dhcpv6-rfc6355-duid-uuid.out -v
268+
dhcpv6-vendor-specific-information dhcpv6-vendor-specific-information.pcap dhcpv6-vendor-specific-information.out -v
268269

269270
# ZeroMQ/PGM tests
270271
# ZMTP/1.0 over TCP

tests/dhcpv4v6-rfc5970-rfc8572.out

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
1 13:35:23.334910 IP6 (flowlabel 0x03f85, hlim 1, next-header UDP (17) payload length: 80) fe80::200:1ff:fe01:0.546 > ff02::1:2.547: [udp sum ok] dhcp6 solicit (xid=6aebe6 (vendor-specific-info) (client-ID hwaddr/time type 1 time 701530515 000001010000) (option-request SZTP-redirect DNS-search-list DNS-server) (elapsed-time 703) (IA_NA IAID:16842752 T1:3600 T2:5400))
2-
2 13:35:45.614434 IP6 (flowlabel 0x03f85, hlim 1, next-header UDP (17) payload length: 80) fe80::200:1ff:fe01:0.546 > ff02::1:2.547: [udp sum ok] dhcp6 solicit (xid=aca407 (vendor-specific-info) (client-ID hwaddr/time type 1 time 701530515 000001010000) (option-request SZTP-redirect DNS-search-list DNS-server) (elapsed-time 0) (IA_NA IAID:16842752 T1:3600 T2:5400))
1+
1 13:35:23.334910 IP6 (flowlabel 0x03f85, hlim 1, next-header UDP (17) payload length: 80) fe80::200:1ff:fe01:0.546 > ff02::1:2.547: [udp sum ok] dhcp6 solicit (xid=6aebe6 (vendor-specific-info enterprise 30065 (code 1 len 6 data 417269737461))) (client-ID hwaddr/time type 1 time 701530515 000001010000) (option-request SZTP-redirect DNS-search-list DNS-server) (elapsed-time 703) (IA_NA IAID:16842752 T1:3600 T2:5400))
2+
2 13:35:45.614434 IP6 (flowlabel 0x03f85, hlim 1, next-header UDP (17) payload length: 80) fe80::200:1ff:fe01:0.546 > ff02::1:2.547: [udp sum ok] dhcp6 solicit (xid=aca407 (vendor-specific-info enterprise 30065 (code 1 len 6 data 417269737461))) (client-ID hwaddr/time type 1 time 701530515 000001010000) (option-request SZTP-redirect DNS-search-list DNS-server) (elapsed-time 0) (IA_NA IAID:16842752 T1:3600 T2:5400))
33
3 13:35:45.618584 IP6 (flowlabel 0xe612c, hlim 64, next-header UDP (17) payload length: 281) fe80::cc0d:b4ff:fe8a:3384.547 > fe80::200:1ff:fe01:0.546: [udp sum ok] dhcp6 advertise (xid=aca407 (IA_NA IAID:16842752 T1:0 T2:0 (IA_ADDR 1234:5678::4 pltime:18000 vltime:28800)) (client-ID hwaddr/time type 1 time 701530515 000001010000) (server-ID hwaddr/time type 1 time 701530524 ce0db48a3384) (SZTP-redirect https://sztp1.download.com,https://sztp2.download.com:8080,https://10.10.0.0,https://10.10.0.0:8000,https://[2001:4860:4860::8888]:8080) (DNS-search-list aristanetworks.com.) (DNS-server 1234:5678::2))
4-
4 13:35:46.635774 IP6 (flowlabel 0x03f85, hlim 1, next-header UDP (17) payload length: 126) fe80::200:1ff:fe01:0.546 > ff02::1:2.547: [udp sum ok] dhcp6 request (xid=5f98e6 (vendor-specific-info) (client-ID hwaddr/time type 1 time 701530515 000001010000) (server-ID hwaddr/time type 1 time 701530524 ce0db48a3384) (option-request SZTP-redirect DNS-search-list DNS-server) (elapsed-time 0) (IA_NA IAID:16842752 T1:3600 T2:5400 (IA_ADDR 1234:5678::4 pltime:7200 vltime:7500)))
4+
4 13:35:46.635774 IP6 (flowlabel 0x03f85, hlim 1, next-header UDP (17) payload length: 126) fe80::200:1ff:fe01:0.546 > ff02::1:2.547: [udp sum ok] dhcp6 request (xid=5f98e6 (vendor-specific-info enterprise 30065 (code 1 len 6 data 417269737461))) (client-ID hwaddr/time type 1 time 701530515 000001010000) (server-ID hwaddr/time type 1 time 701530524 ce0db48a3384) (option-request SZTP-redirect DNS-search-list DNS-server) (elapsed-time 0) (IA_NA IAID:16842752 T1:3600 T2:5400 (IA_ADDR 1234:5678::4 pltime:7200 vltime:7500)))
55
5 13:35:46.638223 IP6 (flowlabel 0xe612c, hlim 64, next-header UDP (17) payload length: 281) fe80::cc0d:b4ff:fe8a:3384.547 > fe80::200:1ff:fe01:0.546: [udp sum ok] dhcp6 reply (xid=5f98e6 (IA_NA IAID:16842752 T1:0 T2:0 (IA_ADDR 1234:5678::4 pltime:7200 vltime:28800)) (client-ID hwaddr/time type 1 time 701530515 000001010000) (server-ID hwaddr/time type 1 time 701530524 ce0db48a3384) (SZTP-redirect https://sztp1.download.com,https://sztp2.download.com:8080,https://10.10.0.0,https://10.10.0.0:8000,https://[2001:4860:4860::8888]:8080) (DNS-search-list aristanetworks.com.) (DNS-server 1234:5678::2))
66
6 13:56:39.000073 IP (tos 0x10, ttl 128, id 0, offset 0, flags [none], proto UDP (17), length 328)
77
0.0.0.0.68 > 255.255.255.255.67: [udp sum ok] BOOTP/DHCP, Request from 00:00:44:01:00:00, length 300, xid 0x796a827d, Flags [none] (0x0000)
@@ -69,8 +69,8 @@
6969
length 17: "https://10.10.0.0"
7070
length 22: "https://10.10.0.0:8000"
7171
length 35: "https://[2001:4860:4860::8888]:8080"
72-
10 14:15:10.112658 IP6 (flowlabel 0x03f85, hlim 1, next-header UDP (17) payload length: 80) fe80::200:1ff:fe01:0.546 > ff02::1:2.547: [udp sum ok] dhcp6 solicit (xid=28792a (vendor-specific-info) (client-ID hwaddr/time type 1 time 701792102 000001010000) (option-request Bootfile-URL DNS-search-list DNS-server) (elapsed-time 754) (IA_NA IAID:16842752 T1:3600 T2:5400))
72+
10 14:15:10.112658 IP6 (flowlabel 0x03f85, hlim 1, next-header UDP (17) payload length: 80) fe80::200:1ff:fe01:0.546 > ff02::1:2.547: [udp sum ok] dhcp6 solicit (xid=28792a (vendor-specific-info enterprise 30065 (code 1 len 6 data 417269737461))) (client-ID hwaddr/time type 1 time 701792102 000001010000) (option-request Bootfile-URL DNS-search-list DNS-server) (elapsed-time 754) (IA_NA IAID:16842752 T1:3600 T2:5400))
7373
11 14:15:33.148466 IP6 (flowlabel 0x1570c, hlim 64, next-header UDP (17) payload length: 157) fe80::40d3:61ff:fe62:3810.547 > fe80::200:1ff:fe01:0.546: [udp sum ok] dhcp6 advertise (xid=654242 (IA_NA IAID:16842752 T1:0 T2:0 (IA_ADDR 1234:5678::4 pltime:18000 vltime:28800)) (client-ID hwaddr/time type 1 time 701792102 000001010000) (server-ID hwaddr/time type 1 time 701792110 42d361623810) (Bootfile-URL my-startup-config) (DNS-search-list aristanetworks.com.) (DNS-server 1234:5678::2))
74-
12 14:15:34.152941 IP6 (flowlabel 0x03f85, hlim 1, next-header UDP (17) payload length: 126) fe80::200:1ff:fe01:0.546 > ff02::1:2.547: [udp sum ok] dhcp6 request (xid=becafa (vendor-specific-info) (client-ID hwaddr/time type 1 time 701792102 000001010000) (server-ID hwaddr/time type 1 time 701792110 42d361623810) (option-request Bootfile-URL DNS-search-list DNS-server) (elapsed-time 0) (IA_NA IAID:16842752 T1:3600 T2:5400 (IA_ADDR 1234:5678::4 pltime:7200 vltime:7500)))
74+
12 14:15:34.152941 IP6 (flowlabel 0x03f85, hlim 1, next-header UDP (17) payload length: 126) fe80::200:1ff:fe01:0.546 > ff02::1:2.547: [udp sum ok] dhcp6 request (xid=becafa (vendor-specific-info enterprise 30065 (code 1 len 6 data 417269737461))) (client-ID hwaddr/time type 1 time 701792102 000001010000) (server-ID hwaddr/time type 1 time 701792110 42d361623810) (option-request Bootfile-URL DNS-search-list DNS-server) (elapsed-time 0) (IA_NA IAID:16842752 T1:3600 T2:5400 (IA_ADDR 1234:5678::4 pltime:7200 vltime:7500)))
7575
13 14:15:34.156427 IP6 (flowlabel 0x1570c, hlim 64, next-header UDP (17) payload length: 157) fe80::40d3:61ff:fe62:3810.547 > fe80::200:1ff:fe01:0.546: [udp sum ok] dhcp6 reply (xid=becafa (IA_NA IAID:16842752 T1:0 T2:0 (IA_ADDR 1234:5678::4 pltime:7200 vltime:28800)) (client-ID hwaddr/time type 1 time 701792102 000001010000) (server-ID hwaddr/time type 1 time 701792110 42d361623810) (Bootfile-URL my-startup-config) (DNS-search-list aristanetworks.com.) (DNS-server 1234:5678::2))
76-
14 08:08:32.009292 IP6 (flowlabel 0x09903, hlim 1, next-header UDP (17) payload length: 138) fe80::200:44ff:fe01:0.546 > ff02::1:2.547: [udp sum ok] dhcp6 inf-req (xid=b5fcf (vendor-specific-info) (client-ID hwaddr type 1 000044010000) (option-request Bootfile-URL DNS-search-list DNS-server) (elapsed-time 331) (user-class Arista;Test-Dhcpv6Discover;4.21.XX))
76+
14 08:08:32.009292 IP6 (flowlabel 0x09903, hlim 1, next-header UDP (17) payload length: 138) fe80::200:44ff:fe01:0.546 > ff02::1:2.547: [udp sum ok] dhcp6 inf-req (xid=b5fcf (vendor-specific-info enterprise 30065 (code 1 len 44 data 4172697374613b546573...))) (client-ID hwaddr type 1 000044010000) (option-request Bootfile-URL DNS-search-list DNS-server) (elapsed-time 331) (user-class Arista;Test-Dhcpv6Discover;4.21.XX))

tests/dhcpv6-rfc8415-duid-type2.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
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)))
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 enterprise 30065 (code 1 len 18 data 4172697374613b485348...))) (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)))
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1 23:25:55.136477 IP6 (hlim 64, next-header UDP (17) payload length: 595) fc00:502:411:1::1.546 > fc00:502:400:0:10:32:0:69.547: [udp sum ok] dhcp6 relay-fwd (linkaddr=fc00:502:411:1::1 peeraddr=fc00:502:411:1::1 (interface-ID 54d46ffa109a) (vendor-specific-info enterprise 4491 (code 38 len 4 data 01020300)) (code 39 len 6 data 54d46ffa109a))) (relay-message (dhcp6 request (xid=d98c5d (reconfigure-accept) (vendor-class) (option-request vendor-specific-info) (vendor-specific-info enterprise 4491 (code 1 len 16 data 00200021002200250026...)) (code 2 len 3 data 45434d)) (code 3 len 12 data 45434d3a454d54413a45...)) (code 4 len 10 data 445247373930382d3533)) (code 5 len 3 data 312e30)) (code 6 len 26 data 647267373930382d5031...)) (code 7 len 5 data 322e332e31)) (code 8 len 6 data 353444343646)) (code 9 len 7 data 44524737393038)) (code 10 len 5 data 436973636f)) (code 35 len 122 data 05780101010201030301...)) (code 36 len 6 data 54d46ffa109a))) (client-ID hwaddr type 1 54d46ffa109a) (server-ID hwaddr/time type 1 time 336091266 000c290f1c3b) (IA_NA IAID:1878659226 T1:0 T2:0 (IA_ADDR fc00:502:411:1::31 pltime:27000 vltime:43200) (vendor-specific-info enterprise 4491 (code 32 len 16 data fc000502040000000010...)) (code 2170 len 16 data 000200040a2000450001...)) (code 3 len 4 data 00000001)) (code 37 len 16 data fc000502040000000010...)) (code 38 len 4 data 00000000)) (code 33 len 13 data 73616d706c65636d362e...)) (code 34 len 16 data fc000502040000000010...)))) (elapsed-time 0))))
689 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)