Update the djbdns IPv6 patch, loong overdue.

PR:		93560
Submitted by:	Tim Bishop <tim@bishnet.net>
This commit is contained in:
Peter Pentchev 2009-09-04 14:09:28 +00:00
parent f8ba6c00a2
commit 3d385a1726
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=240869
3 changed files with 137 additions and 6 deletions

View file

@ -32,7 +32,7 @@ OPTIONS= DUMPCACHE "persistent cache for dnscache" off \
.if defined(WITH_JUMBO)
.if defined(WITH_IPV6) || defined(WITH_IGNOREIP) || defined(WITH_SRV)
BROKEN= The jumbo patch currently conflicts with the IPv6 and ignoreip2 patches
BROKEN= The jumbo patch currently conflicts with the IPv6, ignoreip2, and SRV patches
.endif
PATCH_SITES+= http://people.FreeBSD.org/~roam/ports/dns/djbdns/:jumbo \
@ -65,7 +65,7 @@ PORTVERSION= ${DJBDNS_VER}.${DJBDNS_V6_VER:S/test/b/:S/diff//}
PATCH_SITES+= http://www.fefe.de/dns/:ipv6
PATCHFILES+= ${PORTNAME}-${DJBDNS_VER}-${DJBDNS_V6_VER}.diff.bz2:ipv6
PATCH_DIST_STRIP= -p1
EXTRA_PATCHES+= ${FILESDIR}/uint32.patch
EXTRA_PATCHES+= ${FILESDIR}/uint32.patch ${FILESDIR}/djbdns-ipv6-ooyama.patch
.endif
.if defined(WITH_DUMPCACHE) && !defined(WITH_JUMBO)
@ -79,6 +79,9 @@ CFLAGS+= -DDUMPCACHE
.endif
.if defined(WITH_IGNOREIP)
.if defined(WITH_IPV6)
BROKEN= The IPv6 patch already includes the ignoreip2 functionality
.endif
PATCH_SITES+= http://tinydns.org/:ignoreip
PATCHFILES+= djbdns-1.05-ignoreip2.patch:ignoreip
PATCH_DIST_STRIP= -p1
@ -97,7 +100,7 @@ PATCH_DIST_STRIP= -p1
.endif
DJBDNS_VER= 1.05
DJBDNS_V6_VER= test14
DJBDNS_V6_VER= test23
ALL_TARGET= it
INSTALL_TARGET= setup check

View file

@ -10,9 +10,9 @@ SIZE (jumbo-p13.patch.gz) = 11779
MD5 (patch-dnscache-dumpcache-v4.txt) = 61441dec12dd627a7fea7c3059cc2542
SHA256 (patch-dnscache-dumpcache-v4.txt) = c2fbc21035fccbb3564226fc40edaa44643119b7b103483825f82786c89009f0
SIZE (patch-dnscache-dumpcache-v4.txt) = 16065
MD5 (djbdns-1.05-test14.diff.bz2) = 52bec93d7ce6226281082367e49157d3
SHA256 (djbdns-1.05-test14.diff.bz2) = 354702f051674ddb20d9f593932843b12cbaa7738b1318767e66f19c68a6ca24
SIZE (djbdns-1.05-test14.diff.bz2) = 15915
MD5 (djbdns-1.05-test23.diff.bz2) = dc35e88e20ffe2670cef5bb4d8a2c183
SHA256 (djbdns-1.05-test23.diff.bz2) = e702f47b4a4c77fe5cec474a8219a072cfaaee07282650b7e0dd322ed82e8f33
SIZE (djbdns-1.05-test23.diff.bz2) = 18480
MD5 (djbdns-1.05-ignoreip2.patch) = c032250b209d055847a763c8d9c7e865
SHA256 (djbdns-1.05-ignoreip2.patch) = ca5d759380c316132be6680e77c37d24a5d715cd6e1c325a75c8450e01133be0
SIZE (djbdns-1.05-ignoreip2.patch) = 3890

View file

@ -0,0 +1,128 @@
# http://hasiru.net/djbdns-ipv6-ooyama.patch
diff -puNr dns_transmit.c dns_transmit.c
--- dns_transmit.c 2008-07-12 14:10:52.000000000 +0900
+++ dns_transmit.c 2008-07-11 15:35:23.000000000 +0900
@@ -104,6 +104,14 @@ static int thisudp(struct dns_transmit *
while (d->udploop < 4) {
for (;d->curserver < 16;++d->curserver) {
ip = d->servers + 16 * d->curserver;
+#if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__)
+ if (!fromserver) {
+ if (ip6_isv4mapped(ip))
+ noipv6 = 1;
+ else
+ noipv6 = 0;
+ }
+#endif
if (byte_diff(ip,16,V6any)) {
d->query[2] = dns_random(256);
d->query[3] = dns_random(256);
@@ -155,6 +163,14 @@ static int thistcp(struct dns_transmit *
for (;d->curserver < 16;++d->curserver) {
ip = d->servers + 16 * d->curserver;
+#if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__)
+ if (!fromserver) {
+ if (ip6_isv4mapped(ip))
+ noipv6 = 1;
+ else
+ noipv6 = 0;
+ }
+#endif
if (byte_diff(ip,16,V6any)) {
d->query[2] = dns_random(256);
d->query[3] = dns_random(256);
diff -puNr dnscache.c dnscache.c
--- dnscache.c 2008-07-12 14:10:52.000000000 +0900
+++ dnscache.c 2008-07-11 15:32:00.000000000 +0900
@@ -59,6 +59,7 @@ uint64 numqueries = 0;
static int udp53;
+
#define MAXUDP 200
static struct udpclient {
struct query q;
@@ -408,11 +409,12 @@ int main()
if (!ip6_scan(x,myipincoming))
strerr_die3x(111,FATAL,"unable to parse IP address ",x);
-#if 0
+#if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__)
/* if if IP is a mapped-IPv4 address, disable IPv6 functionality */
/* this is actually a bad idea */
if (ip6_isv4mapped(myipincoming))
noipv6 = 1;
+ fromserver = 1;
#endif
udp53 = socket_udp6();
diff -puNr server.c server.c
--- server.c 2008-07-12 14:10:52.000000000 +0900
+++ server.c 2008-07-11 15:33:18.000000000 +0900
@@ -92,6 +92,9 @@ int main()
{
char *x;
int *udp53;
+#if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__)
+ int *noipv6s;
+#endif
unsigned int off;
unsigned int cnt;
iopause_fd *iop;
@@ -116,6 +119,11 @@ int main()
}
udp53=(int *) alloc(sizeof(int) *cnt);
if (!udp53) nomem();
+#if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__)
+ noipv6s=(int *) alloc(sizeof(int) *cnt);
+ if (!noipv6s) nomem();
+ fromserver = 1;
+#endif
iop=(iopause_fd *) alloc(sizeof(*iop) * cnt);
if (!iop) nomem();
@@ -124,6 +132,12 @@ int main()
unsigned int l;
uint32 ifid=0;
l=ip6_scan(x+off,ip);
+#if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__)
+ if (ip6_isv4mapped(ip))
+ noipv6 = noipv6s[cnt] = 1;
+ else
+ noipv6 = noipv6s[cnt] = 0;
+#endif
udp53[cnt] = socket_udp6();
if (udp53[cnt] == -1)
strerr_die2sys(111,fatal,"unable to create UDP socket: ");
@@ -165,6 +179,9 @@ int main()
iopause(iop,cnt,&deadline,&stamp);
for (i=0;i<cnt;i++)
if (iop[i].revents) {
+#if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__)
+ noipv6 = noipv6s[i];
+#endif
len = socket_recv6(udp53[i],buf,sizeof buf,ip,&port,&ifid);
if (len < 0) continue;
if (!doit()) continue;
diff -puNr socket.h socket.h
--- socket.h 2008-07-12 14:10:52.000000000 +0900
+++ socket.h 2008-07-11 15:44:14.000000000 +0900
@@ -34,5 +34,6 @@ extern const char* socket_getifname(uint
extern uint32 socket_getifidx(const char *ifname);
extern int noipv6;
+extern int fromserver;
#endif
diff -puNr socket_noipv6.c socket_noipv6.c
--- socket_noipv6.c 2008-07-12 14:10:52.000000000 +0900
+++ socket_noipv6.c 2008-07-11 15:30:12.000000000 +0900
@@ -1,5 +1,6 @@
#include "haveip6.h"
+int fromserver=0;
#ifdef LIBC_HAS_IP6
int noipv6=0;
#else