summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Richardson <mcr@sandelman.ca>2016-07-10 10:42:54 -0400
committerGitHub <noreply@github.com>2016-07-10 10:42:54 -0400
commit5083bfccc0624861f921bb3a33f208e23f5bc2c2 (patch)
tree36c52f7e55df7856c6af9ec7e95c301f85aebcd6
parent2bdecbfb109a890f0b941085cf5a354d58893f3f (diff)
parenta9f4d1c2997aa355c3d29c992f47ba45a11c291f (diff)
downloadtcpdump-5083bfccc0624861f921bb3a33f208e23f5bc2c2.tar.gz
Merge pull request #528 from mcr/master
the ROLL RPL DAGID is an IPv6 address
-rwxr-xr-xnetdissect-stdinc.h4
-rw-r--r--print-icmp6.c13
-rw-r--r--tests/rpl-14-daovvv.out2
-rw-r--r--tests/rpl-19-pickdag.out2
-rw-r--r--tests/rpl-19-pickdagvvv.out2
-rw-r--r--tests/rpl-26-senddaovv.out2
6 files changed, 8 insertions, 17 deletions
diff --git a/netdissect-stdinc.h b/netdissect-stdinc.h
index e201afa4..c7070f0a 100755
--- a/netdissect-stdinc.h
+++ b/netdissect-stdinc.h
@@ -319,6 +319,7 @@ typedef char* caddr_t;
* define struct in6_addr so that we can use it for IPv6 addresses.
*/
#ifndef HAVE_OS_IPV6_SUPPORT
+#ifndef AF_INET6
#define AF_INET6 24
struct in6_addr {
@@ -329,11 +330,12 @@ struct in6_addr {
} __u6_addr; /* 128-bit IP6 address */
};
#endif
+#endif
#ifndef NI_MAXHOST
#define NI_MAXHOST 1025
#endif
-
+
#ifndef INET_ADDRSTRLEN
#define INET_ADDRSTRLEN 16
#endif
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]