/* \summary: IPv6 Internet Control Message Protocol (ICMPv6) printer */
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include "netdissect-stdinc.h"
#include "ip6.h"
#include "ipproto.h"
+#include "icmp.h"
#include "udp.h"
#include "ah.h"
#define icmp6_id icmp6_data16[0] /* echo request/reply */
#define icmp6_seq icmp6_data16[1] /* echo request/reply */
#define icmp6_maxdelay icmp6_data16[0] /* mcast group membership */
+#define icmp6_xseq icmp6_data8[2] /* extended echo request/reply */
+#define icmp6_xinfo icmp6_data8[3] /* extended echo request/reply */
#define ICMP6_DST_UNREACH 1 /* dest unreachable, codes: */
#define ICMP6_PACKET_TOO_BIG 2 /* packet too big */
#define ICMP6_HADISCOV_REPLY 145
#define ICMP6_MOBILEPREFIX_SOLICIT 146
#define ICMP6_MOBILEPREFIX_ADVERT 147
+#define ICMP6_EXTENDED_ECHO_REQUEST 160 /* extended echo request */
+#define ICMP6_EXTENDED_ECHO_REPLY 161 /* extended echo reply */
#define MLD6_MTRACE_RESP 200 /* mtrace response(to sender) */
#define MLD6_MTRACE 201 /* mtrace messages */
#endif
};
-/* section 6.2.1, DODAG Information Solication (DIS_IS) */
+/* section 6.2.1, DODAG Information Solicitation (DIS_IS) */
struct nd_rpl_dis_is {
nd_uint8_t rpl_dis_flags;
nd_uint8_t rpl_dis_reserved;
{ MLD6_MTRACE, "mtrace message"},
{ MLD6_MTRACE_RESP, "mtrace response"},
{ ND_RPL_MESSAGE, "RPL"},
+ { ICMP6_EXTENDED_ECHO_REQUEST, "extended echo request"},
+ { ICMP6_EXTENDED_ECHO_REPLY, "extended echo reply"},
{ 0, NULL }
};
ND_PRINT(", id 0x%04x",
GET_BE_U_2(dp->icmp6_data16[0]));
- cp = (const u_char *)dp + length;
+ cp = (const u_char *)dp +
+ ND_MIN(length, ND_BYTES_AVAILABLE_AFTER(dp));
p = (const u_char *)(dp + 1);
while (p < cp) {
ND_PRINT(", %s", GET_IP6ADDR_STRING(p));
/* plus 4, because struct icmp6_hdr contains 4 bytes of icmp payload */
rpl_print(ndo, icmp6_code, dp->icmp6_data, length-sizeof(struct icmp6_hdr)+4);
break;
+ case ICMP6_EXTENDED_ECHO_REQUEST:
+ case ICMP6_EXTENDED_ECHO_REPLY:
+ ND_PRINT(", id %u, seq %u", GET_BE_U_2(dp->icmp6_id),
+ GET_U_1(dp->icmp6_xseq));
+ // The content of the message is the same as ICMP, so use the
+ // function defined in print-icmp.c
+ if (ndo->ndo_vflag) {
+ uint8_t xinfo = GET_U_1(dp->icmp6_xinfo);
+ print_icmp_rfc8335(ndo, xinfo, icmp6_type == ICMP6_EXTENDED_ECHO_REQUEST, icmp6_code, dp->icmp6_data + 4);
+ }
+ break;
default:
ND_PRINT(", length %u", length);
if (ndo->ndo_vflag <= 1)