#define abs(a) ((0 < (a)) ? (a) : -(a))
#endif
+/* inline the various RPL definitions */
+#define ND_RPL_MESSAGE 0x9B
+
static struct tok icmp6_type_values[] = {
{ ICMP6_DST_UNREACH, "destination unreachable"},
{ ICMP6_PACKET_TOO_BIG, "packet too big"},
{ ICMP6_NI_REPLY, "node information reply"},
{ MLD6_MTRACE, "mtrace message"},
{ MLD6_MTRACE_RESP, "mtrace response"},
+ { ND_RPL_MESSAGE, "RPL"},
{ 0, NULL }
};
return (sum);
}
+enum ND_RPL_CODE {
+ ND_RPL_DAG_IS=0x01,
+ ND_RPL_DAG_IO=0x02,
+ ND_RPL_DAO =0x04
+};
+
+enum ND_RPL_DIO_FLAGS {
+ ND_RPL_DIO_GROUNDED = 0x80,
+ ND_RPL_DIO_DATRIG = 0x40,
+ ND_RPL_DIO_DASUPPORT= 0x20,
+ ND_RPL_DIO_RES4 = 0x10,
+ ND_RPL_DIO_RES3 = 0x08,
+ ND_RPL_DIO_PRF_MASK = 0x07, /* 3-bit preference */
+};
+
+struct nd_rpl_dio {
+ u_int8_t rpl_flags;
+ u_int8_t rpl_seq;
+ u_int8_t rpl_instanceid;
+ u_int8_t rpl_dagrank;
+ u_int8_t rpl_dagid[16];
+};
+
+void
+rpl_print(netdissect_options *ndo,
+ const struct icmp6_hdr *hdr,
+ const u_char *bp, u_int length)
+{
+ struct nd_rpl_dio *dio = (struct nd_rpl_dio *)bp;
+
+ ND_TCHECK(dio->rpl_dagid);
+
+ switch(hdr->icmp6_code) {
+ case ND_RPL_DAG_IS:
+ ND_PRINT((ndo, ", DAG Information Solicitation"));
+ if(ndo->ndo_vflag) {
+ }
+ break;
+ case ND_RPL_DAG_IO:
+ ND_PRINT((ndo, ", DAG Information Object"));
+ if(ndo->ndo_vflag) {
+ char dagid[65];
+ char *d = dagid;
+ int i;
+ for(i=0;i<16;i++) {
+ if(isprint(dio->rpl_dagid[i])) {
+ *d++ = dio->rpl_dagid[i];
+ } else {
+ int cnt=snprintf(d,4,"0x%02x",
+ dio->rpl_dagid[i]);
+ d += cnt;
+ }
+ }
+ *d++ = '\0';
+ ND_PRINT((ndo, " [seq:%u,instance:%u,rank:%u,dagid:%s]",
+ dio->rpl_seq,
+ dio->rpl_instanceid,
+ dio->rpl_dagrank,
+ dagid));
+ }
+ break;
+ case ND_RPL_DAO:
+ ND_PRINT((ndo, ", Destination Advertisement Object"));
+ if(ndo->ndo_vflag) {
+ }
+ break;
+ default:
+ ND_PRINT((ndo, ", RPL message, unknown code %u",hdr->icmp6_code));
+ break;
+ }
+ return;
+trunc:
+ ND_PRINT((ndo," [|truncated]"));
+ return;
+
+}
+
+
void
icmp6_print(netdissect_options *ndo,
const u_char *bp, u_int length, const u_char *bp2, int fragmented)
length - MPADVLEN);
}
break;
+ case ND_RPL_MESSAGE:
+ rpl_print(ndo, dp, &dp->icmp6_data8[0], length);
+ break;
default:
printf(", length %u", length);
if (vflag <= 1)
-IP6 (hlim 255, next-header ICMPv6 (58) payload length: 24) fe80::1000:ff:fe64:6423 > ff02::1: [icmp6 sum ok] ICMP6, unknown icmp6 type (155), length 24, length 24
- 0x0000: 9b02 7769 000a 2a01 7468 6973 6973 6d79
- 0x0010: 6e69 6365 6461 6731
-IP6 (hlim 1, next-header Options (0) payload length: 36) fe80::1000:ff:fe64:6423 > ff02::16: HBH (rtalert: 0x0000) (padn)[icmp6 sum ok] ICMP6, multicast listener report v2, length 28, 1 group record(s) [gaddr ff02::2 to_in, 0 source(s)]
-IP6 (hlim 255, next-header ICMPv6 (58) payload length: 24) fe80::1000:ff:fe64:6423 > ff02::1: [icmp6 sum ok] ICMP6, unknown icmp6 type (155), length 24, length 24
- 0x0000: 9b02 7769 000a 2a01 7468 6973 6973 6d79
- 0x0010: 6e69 6365 6461 6731
-IP6 (hlim 1, next-header Options (0) payload length: 36) fe80::1000:ff:fe64:6423 > ff02::16: HBH (rtalert: 0x0000) (padn)[icmp6 sum ok] ICMP6, multicast listener report v2, length 28, 1 group record(s) [gaddr ff02::2 to_in, 0 source(s)]
-IP6 (hlim 255, next-header ICMPv6 (58) payload length: 24) fe80::1000:ff:fe64:6423 > ff02::1: [icmp6 sum ok] ICMP6, unknown icmp6 type (155), length 24, length 24
- 0x0000: 9b02 7769 000a 2a01 7468 6973 6973 6d79
- 0x0010: 6e69 6365 6461 6731
-IP6 (hlim 1, next-header Options (0) payload length: 36) fe80::1000:ff:fe64:6423 > ff02::16: HBH (rtalert: 0x0000) (padn)[icmp6 sum ok] ICMP6, multicast listener report v2, length 28, 1 group record(s) [gaddr ff02::2 to_in, 0 source(s)]
+IP6 (hlim 255, next-header ICMPv6 (58) payload length: 24) fe80::1000:ff:fe64:6423 > ff02::1: [icmp6 sum ok] ICMP6, RPL, length 24, DAG Information Object [seq:10,instance:42,rank:1,dagid:thisismynicedag1]