From: Michael Richardson Date: Sun, 3 Jul 2016 02:14:33 +0000 (-0400) Subject: dagid is always an IPv6 address, not an opaque 128-bit string X-Git-Tag: tcpdump-4.8.0-bp~2 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/966ab3bd4313c6fca49b6cd4528015cfc9e42701 dagid is always an IPv6 address, not an opaque 128-bit string --- diff --git a/print-icmp6.c b/print-icmp6.c index ae531874..bc8362ee 100644 --- a/print-icmp6.c +++ b/print-icmp6.c @@ -651,18 +651,7 @@ const struct tok rpl_subopt_values[] = { static void rpl_format_dagid(char dagid_str[65], const u_char *dagid) { - char *d = dagid_str; - int i; - - for(i=0;i<16;i++) { - if(isprint(dagid[i])) { - *d++ = dagid[i]; - } else { - snprintf(d,5,"0x%02x", dagid[i]); /* 4 + null char */ - d += 4; - } - } - *d++ = '\0'; + inet_ntop(AF_INET6, dagid, dagid_str, 64); } static void diff --git a/tests/rpl-14-daovvv.out b/tests/rpl-14-daovvv.out index 7869e6bf..7e4b8a5f 100644 --- a/tests/rpl-14-daovvv.out +++ b/tests/rpl-14-daovvv.out @@ -1 +1 @@ -IP6 (hlim 64, next-header ICMPv6 (58) payload length: 24) fe80::216:3eff:fe11:3424 > ff02::1: [icmp6 sum ok] ICMP6, RPL, (CLR)Destination Advertisement Object [dagid:pandora is fun0x0al,seq:1,instance:1,Dagid,40] +IP6 (hlim 64, next-header ICMPv6 (58) payload length: 24) fe80::216:3eff:fe11:3424 > ff02::1: [icmp6 sum ok] ICMP6, RPL, (CLR)Destination Advertisement Object [dagid:7061:6e64:6f72:6120:6973:2066:756e:a6c,seq:1,instance:1,Dagid,40] diff --git a/tests/rpl-19-pickdag.out b/tests/rpl-19-pickdag.out index 2460ada4..d3c41eed 100644 --- a/tests/rpl-19-pickdag.out +++ b/tests/rpl-19-pickdag.out @@ -1 +1 @@ -IP6 (hlim 64, next-header ICMPv6 (58) payload length: 56) fe80::216:3eff:fe11:3424 > fe80::216:3eff:fe11:3424: [icmp6 sum ok] ICMP6, RPL, (CLR)Destination Advertisement Object [dagid:T10x000x000x000x000x000x000x000x000x000x000x000x000x000x00,seq:10,instance:42,Dagid,40] opt:rpltarget len:25 opt:pad0 opt:pad0 opt:pad0 opt:pad0 opt:pad0 opt:pad0 opt:pad0 +IP6 (hlim 64, next-header ICMPv6 (58) payload length: 56) fe80::216:3eff:fe11:3424 > fe80::216:3eff:fe11:3424: [icmp6 sum ok] ICMP6, RPL, (CLR)Destination Advertisement Object [dagid:5431::,seq:10,instance:42,Dagid,40] opt:rpltarget len:25 opt:pad0 opt:pad0 opt:pad0 opt:pad0 opt:pad0 opt:pad0 opt:pad0 diff --git a/tests/rpl-19-pickdagvvv.out b/tests/rpl-19-pickdagvvv.out index bd934537..deee0331 100644 --- a/tests/rpl-19-pickdagvvv.out +++ b/tests/rpl-19-pickdagvvv.out @@ -1 +1 @@ -IP6 (hlim 64, next-header ICMPv6 (58) payload length: 56) fe80::216:3eff:fe11:3424 > fe80::216:3eff:fe11:3424: [icmp6 sum ok] ICMP6, RPL, (CLR)Destination Advertisement Object [dagid:T10x000x000x000x000x000x000x000x000x000x000x000x000x000x00,seq:10,instance:42,Dagid,40] opt:rpltarget len:25 0x0000: 0080 2001 0db8 0001 0000 0216 3eff fe11 0x0010: 3424 0000 0000 00 opt:pad0 opt:pad0 opt:pad0 opt:pad0 opt:pad0 opt:pad0 opt:pad0 +IP6 (hlim 64, next-header ICMPv6 (58) payload length: 56) fe80::216:3eff:fe11:3424 > fe80::216:3eff:fe11:3424: [icmp6 sum ok] ICMP6, RPL, (CLR)Destination Advertisement Object [dagid:5431::,seq:10,instance:42,Dagid,40] opt:rpltarget len:25 0x0000: 0080 2001 0db8 0001 0000 0216 3eff fe11 0x0010: 3424 0000 0000 00 opt:pad0 opt:pad0 opt:pad0 opt:pad0 opt:pad0 opt:pad0 opt:pad0 diff --git a/tests/rpl-26-senddaovv.out b/tests/rpl-26-senddaovv.out index 6d11c81c..1b642bb7 100644 --- a/tests/rpl-26-senddaovv.out +++ b/tests/rpl-26-senddaovv.out @@ -1 +1 @@ -IP6 (hlim 64, next-header ICMPv6 (58) payload length: 24) fe80::216:3eff:fe11:3424 > ff02::1: [icmp6 sum ok] ICMP6, RPL, (CLR)Destination Advertisement Object Ack [dagid:thisismydicedag2,seq:11,instance:43,status:0] +IP6 (hlim 64, next-header ICMPv6 (58) payload length: 24) fe80::216:3eff:fe11:3424 > ff02::1: [icmp6 sum ok] ICMP6, RPL, (CLR)Destination Advertisement Object Ack [dagid:7468:6973:6973:6d79:6469:6365:6461:6732,seq:11,instance:43,status:0]