aboutsummaryrefslogtreecommitdiff
path: root/dns_rcip.c
diff options
context:
space:
mode:
authorHenryk Plötz <henryk@ploetzli.ch>2014-10-03 20:04:14 +0200
committerHenryk Plötz <henryk@ploetzli.ch>2014-10-03 20:04:14 +0200
commitc44d8b51ffb5a413f8bbdbd9991bbc573853e397 (patch)
treee7f2e644de620879f610c909c405cbc4e44d6062 /dns_rcip.c
parent0e5b2871ca6456b01d4bf037a6e68badf1ff1a41 (diff)
downloadtinydnssec-c44d8b51ffb5a413f8bbdbd9991bbc573853e397.tar.gz
tinydnssec-c44d8b51ffb5a413f8bbdbd9991bbc573853e397.tar.bz2
Apply patch djbdns-1.05-test27.diff.bz2
Source was http://www.fefe.de/dns/djbdns-1.05-test27.diff.bz2, SHA1 f0380ec1866f49c0bcf6369a923ac0a4a5095da8
Diffstat (limited to 'dns_rcip.c')
-rw-r--r--dns_rcip.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/dns_rcip.c b/dns_rcip.c
index 97bd8f5..efd1b21 100644
--- a/dns_rcip.c
+++ b/dns_rcip.c
@@ -2,12 +2,13 @@
#include "openreadclose.h"
#include "byte.h"
#include "ip4.h"
+#include "ip6.h"
#include "env.h"
#include "dns.h"
static stralloc data = {0};
-static int init(char ip[64])
+static int init(char ip[256])
{
int i;
int j;
@@ -20,10 +21,10 @@ static int init(char ip[64])
if (*x == '.')
++x;
else {
- i = ip4_scan(x,ip + iplen);
+ i = ip6_scan(x,ip + iplen);
if (!i) break;
x += i;
- iplen += 4;
+ iplen += 16;
}
}
@@ -40,10 +41,8 @@ static int init(char ip[64])
while ((data.s[i] == ' ') || (data.s[i] == '\t'))
++i;
if (iplen <= 60)
- if (ip4_scan(data.s + i,ip + iplen)) {
- if (byte_equal(ip + iplen,4,"\0\0\0\0"))
- byte_copy(ip + iplen,4,"\177\0\0\1");
- iplen += 4;
+ if (ip6_scan(data.s + i,ip + iplen)) {
+ iplen += 16;
}
}
i = j + 1;
@@ -52,19 +51,19 @@ static int init(char ip[64])
}
if (!iplen) {
- byte_copy(ip,4,"\177\0\0\1");
- iplen = 4;
+ byte_copy(ip,16,"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1");
+ iplen = 16;
}
- byte_zero(ip + iplen,64 - iplen);
+ byte_zero(ip + iplen,256 - iplen);
return 0;
}
static int ok = 0;
static unsigned int uses;
static struct taia deadline;
-static char ip[64]; /* defined if ok */
+static char ip[256]; /* defined if ok */
-int dns_resolvconfip(char s[64])
+int dns_resolvconfip(char s[256])
{
struct taia now;
@@ -81,6 +80,6 @@ int dns_resolvconfip(char s[64])
}
--uses;
- byte_copy(s,64,ip);
+ byte_copy(s,256,ip);
return 0;
}