Skip to content

Commit 0a035a4

Browse files
committed
IPv6: Use ND_ICHECKMSG_U() to print an invalid version
Update a test output accordingly.
1 parent a69b0d5 commit 0a035a4

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

print-ip6.c

+1-4
Original file line numberDiff line numberDiff line change
@@ -247,10 +247,7 @@ ip6_print(netdissect_options *ndo, const u_char *bp, u_int length)
247247
}
248248

249249
ND_ICHECK_ZU(length, <, sizeof (struct ip6_hdr));
250-
if (IP6_VERSION(ip6) != 6) {
251-
ND_PRINT("version error: %u != 6", IP6_VERSION(ip6));
252-
return;
253-
}
250+
ND_ICHECKMSG_U("version", IP6_VERSION(ip6), !=, 6);
254251

255252
ND_TCHECK_SIZE(ip6);
256253
payload_len = GET_BE_U_2(ip6->ip6_plen);

tests/ipv6-bad-version.out

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
1 15:15:01.278565 IP6 :: > ff02::1:ff76:6c14: ICMP6, neighbor solicitation, who has fe80::20c:29ff:fe76:6c14, length 24
2-
2 15:15:01.279230 IP6 version error: 0 != 6
2+
2 15:15:01.279230 IP6 [version 0 != 6] (invalid)
33
3 15:15:02.391170 IP6 :: > ff02::1:ff76:6c14: ICMP6, neighbor solicitation, who has 1111:2222:3333:4444:20c:29ff:fe76:6c14, length 24
4-
4 15:15:02.391739 IP6 version error: 0 != 6
4+
4 15:15:02.391739 IP6 [version 0 != 6] (invalid)

0 commit comments

Comments
 (0)