- int xinfo = GET_U_1(dp->icmp_xinfo);
- switch (icmp_type) {
- case ICMP_EXTENDED_ECHO_REQUEST:
- ND_PRINT("\n\t%s Interface", xinfo & 1 ? "Local" : "Remote");
- if (ICMP_EXT_EXTRACT_VERSION(GET_U_1(dp->icmp_data)) != ICMP_EXT_VERSION) {
- nd_print_invalid(ndo);
- } else {
- // A single extended object. The extended header is not
- // located at offset 128 in this case, so we can not use
- // icmp_ext_checksum.
- uint16_t sum = GET_BE_U_2(dp->icmp_data + 2);
- uint16_t len = GET_BE_U_2(dp->icmp_data + 4);
- // The checksum is over the extended header and the single
- // object
- len += 4;
- vec[0].ptr = dp->icmp_data;
- vec[0].len = len;
- if (ND_TTEST_LEN(vec[0].ptr, vec[0].len)) {
- ND_PRINT(", checksum 0x%04x (%scorrect), length %u",
- sum,
- in_cksum(vec, 1) ? "in" : "",
- len);
- }
- print_icmp_multipart_ext_object(ndo, dp->icmp_data + 4);
- }
- break;
- case ICMP_EXTENDED_ECHO_REPLY:
- {
- int state = ( xinfo & 0xe0 ) >> 5;
- ND_PRINT("\n\tCode %d (%s), State %d (%s), active %d ipv4 %d ipv6 %d",
- icmp_code, tok2str(icmp_extended_echo_reply_code_str, "Unknown", icmp_code),
- state, tok2str(icmp_extended_echo_reply_state_str, "Unknown", state),
- xinfo & 4 ? 1 : 0,
- xinfo & 2 ? 1 : 0,
- xinfo & 1 ? 1 : 0);
- }
- break;
- }
+ uint8_t xinfo = GET_U_1(dp->icmp_xinfo);
+ // RFC8335 printing is shared between ICMP and ICMPv6
+ print_icmp_rfc8335( ndo, xinfo, icmp_type == ICMP_EXTENDED_ECHO_REQUEST, icmp_code, dp->icmp_data );