IPv6: Print some header fields, even if the header is incomplete

Add a test file with a 39-byte header.

Moreover:
Fix an indentation.
This commit is contained in:
Francois-Xavier Le Bail 2023-08-27 11:20:58 +02:00
parent 7830dc93c7
commit f6ae03e299
4 changed files with 4 additions and 2 deletions

View File

@ -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:
@ -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.
@ -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) {

View File

@ -362,6 +362,7 @@ ipv6-srh-tlv-pad1-padn-5-v ipv6-srh-tlv-pad1-padn-5.pcap ipv6-srh-tlv-pad1-padn-
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

View File

@ -0,0 +1 @@
1 07:30:59.044880 IP6 (flowlabel 0x74111, hlim 64, next-header UDP (17) payload length: 64) [|ip6]

Binary file not shown.