From fd8184e3bed43669b09f463ae610eff772e9ab65 Mon Sep 17 00:00:00 2001 From: "Heiko Schlittermann (HS12-RIPE)" Date: Mon, 23 Nov 2015 23:57:04 +0100 Subject: Testsuite: Fix fakens parser for A and AAAA RRs --- test/src/fakens.c | 31 +++++-------------------------- 1 file 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 #include #include +#include #include #include #include @@ -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: -- cgit v1.2.3