summaryrefslogtreecommitdiff
path: root/jni/iodine/tests/dns.c
diff options
context:
space:
mode:
authorYves Fischer <yvesf-git@xapek.org>2014-08-11 23:26:36 +0200
committerYves Fischer <yvesf-git@xapek.org>2014-08-11 23:26:36 +0200
commit5d8801d4687035ae45143f0f3bc3eeaf75dc17ec (patch)
treebf4395fd5938eb1865ba90b6e52e169d727d9404 /jni/iodine/tests/dns.c
parent1251ce0d7cf2619f9b41637dcb88bebb66e54fb3 (diff)
downloadandiodine-5d8801d4687035ae45143f0f3bc3eeaf75dc17ec.tar.gz
andiodine-5d8801d4687035ae45143f0f3bc3eeaf75dc17ec.zip
Upgrade code to iodine 0.7.0 and improve logging
Diffstat (limited to 'jni/iodine/tests/dns.c')
-rw-r--r--jni/iodine/tests/dns.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/jni/iodine/tests/dns.c b/jni/iodine/tests/dns.c
index 3d21e4c..cdd3378 100644
--- a/jni/iodine/tests/dns.c
+++ b/jni/iodine/tests/dns.c
@@ -1,5 +1,6 @@
/*
- * Copyright (c) 2006-2009 Bjorn Andersson <flex@kryo.se>, Erik Ekman <yarrick@kryo.se>
+ * Copyright (c) 2006-2014 Erik Ekman <yarrick@kryo.se>,
+ * 2006-2009 Bjorn Andersson <flex@kryo.se>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -24,6 +25,10 @@
#include <netinet/in.h>
#include <sys/stat.h>
#include <arpa/nameser.h>
+#ifdef DARWIN
+#define BIND_8_COMPAT
+#include <arpa/nameser_compat.h>
+#endif
#include "common.h"
#include "dns.h"
@@ -159,8 +164,8 @@ START_TEST(test_decode_response)
memset(&buf, 0, sizeof(buf));
ret = dns_decode(buf, len, &q, QR_ANSWER, answer_packet, sizeof(answer_packet)-1);
- fail_unless(strncmp(msgData, buf, sizeof(msgData)) == 0, "Did not extract expected data");
fail_unless(ret == strlen(msgData), "Bad data length: %d, expected %d", ret, strlen(msgData));
+ fail_unless(strncmp(msgData, buf, strlen(msgData)) == 0, "Did not extract expected data");
fail_unless(q.id == 0x0539);
}
END_TEST
@@ -176,8 +181,8 @@ START_TEST(test_decode_response_with_high_trans_id)
memset(&buf, 0, sizeof(buf));
ret = dns_decode(buf, len, &q, QR_ANSWER, answer_packet_high_trans_id, sizeof(answer_packet_high_trans_id)-1);
- fail_unless(strncmp(msgData, buf, sizeof(msgData)) == 0, "Did not extract expected data");
fail_unless(ret == strlen(msgData), "Bad data length: %d, expected %d", ret, strlen(msgData));
+ fail_unless(strncmp(msgData, buf, strlen(msgData)) == 0, "Did not extract expected data");
fail_unless(q.id == 0x8539, "q.id was %08X instead of %08X!", q.id, 0x8539);
}
END_TEST