summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeiko Schlittermann (HS12-RIPE) <hs@schlittermann.de>2015-11-23 23:57:04 +0100
committerHeiko Schlittermann (HS12-RIPE) <hs@schlittermann.de>2015-11-24 16:30:40 +0100
commitfd8184e3bed43669b09f463ae610eff772e9ab65 (patch)
treef1163bc2a03b72c6ae5e4542311f3cef4b7dd1f9
parent2c98a555f730e665a305652a84bd558f1fed83f6 (diff)
Testsuite: Fix fakens parser for A and AAAA RRs
-rw-r--r--test/src/fakens.c31
1 files changed, 5 insertions, 26 deletions
diff --git a/test/src/fakens.c b/test/src/fakens.c
index 29914cd46..00f1f7d46 100644
--- a/test/src/fakens.c
+++ b/test/src/fakens.c
@@ -75,6 +75,7 @@ a number of seconds (followed by one space).
#include <errno.h>
#include <signal.h>
#include <arpa/nameser.h>
+#include <arpa/inet.h>
#include <sys/types.h>
#include <sys/time.h>
#include <dirent.h>
@@ -501,35 +502,13 @@ while (fgets(CS buffer, sizeof(buffer), f) != NULL)
break;
case ns_t_a:
- for (i = 0; i < 4; i++)
- {
- value = 0;
- while (isdigit(*p)) value = value*10 + *p++ - '0';
- *pk++ = value;
- p++;
- }
+ inet_pton(AF_INET, p, pk); /* FIXME: error checking */
+ pk += 4;
break;
- /* The only occurrence of a double colon is for ::1 */
case ns_t_aaaa:
- if (Ustrcmp(p, "::1") == 0)
- {
- memset(pk, 0, 15);
- pk += 15;
- *pk++ = 1;
- }
- else for (i = 0; i < 8; i++)
- {
- value = 0;
- while (isxdigit(*p))
- {
- value = value * 16 + toupper(*p) - (isdigit(*p)? '0' : '7');
- p++;
- }
- *pk++ = (value >> 8) & 255;
- *pk++ = value & 255;
- p++;
- }
+ inet_pton(AF_INET6, p, pk); /* FIXME: error checking */
+ pk += 16;
break;
case ns_t_mx: