Skip to content
This repository has been archived by the owner on Nov 15, 2022. It is now read-only.

Commit

Permalink
IPv6: Print some header fields, even if the header is incomplete
Browse files Browse the repository at this point in the history
Add a test file with a 39-byte header.

Moreover:
Fix an indentation.

(cherry picked from commit f6ae03e)
  • Loading branch information
fxlb committed Oct 25, 2023
1 parent e0a1959 commit fd1fce9
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions print-ip6.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,6 @@ ip6_print(netdissect_options *ndo, const u_char *bp, u_int length)
ND_ICHECK_ZU(length, <, sizeof (struct ip6_hdr));
ND_ICHECKMSG_U("version", IP6_VERSION(ip6), !=, 6);

ND_TCHECK_SIZE(ip6);
payload_len = GET_BE_U_2(ip6->ip6_plen);
/*
* RFC 1883 says:
Expand Down Expand Up @@ -301,6 +300,7 @@ ip6_print(netdissect_options *ndo, const u_char *bp, u_int length)
nh,
payload_len);
}
ND_TCHECK_SIZE(ip6);

/*
* Cut off the snapshot length to the end of the IP payload.
Expand Down Expand Up @@ -328,7 +328,7 @@ ip6_print(netdissect_options *ndo, const u_char *bp, u_int length)
nh != IPPROTO_TCP && nh != IPPROTO_UDP &&
nh != IPPROTO_DCCP && nh != IPPROTO_SCTP) {
ND_PRINT("%s > %s: ", GET_IP6ADDR_STRING(ip6->ip6_src),
GET_IP6ADDR_STRING(ip6->ip6_dst));
GET_IP6ADDR_STRING(ip6->ip6_dst));
}

switch (nh) {
Expand Down
1 change: 1 addition & 0 deletions tests/TESTLIST
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ ipv6_jumbogram_1 ipv6_jumbogram_1.pcap ipv6_jumbogram_1.out -ev
ipv6_invalid_length ipv6_invalid_length.pcap ipv6_invalid_length.out
ipv6_invalid_length_2 ipv6_invalid_length_2.pcap ipv6_invalid_length_2.out -v
ipv6_jumbogram_invalid_length ipv6_jumbogram_invalid_length.pcap ipv6_jumbogram_invalid_length.out -v
ipv6_39_byte_header ipv6_39_byte_header.pcap ipv6_39_byte_header.out -v

# Loopback/CTP test case
loopback loopback.pcap loopback.out
Expand Down
1 change: 1 addition & 0 deletions tests/ipv6_39_byte_header.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1 07:30:59.044880 IP6 (flowlabel 0x74111, hlim 64, next-header UDP (17) payload length: 64) [|ip6]
Binary file added tests/ipv6_39_byte_header.pcap
Binary file not shown.

0 comments on commit fd1fce9

Please sign in to comment.