nixpkgs-suyu/pkgs/os-specific/linux/dietlibc/dns64.patch
Eelco Dolstra f320c2c12e * DNS resolution in dietlibc failed randomly on 64-bit platforms.
Patch backported from dietlibc CVS.

svn path=/nixpkgs/trunk/; revision=7743
2007-01-22 14:38:18 +00:00

109 lines
3.3 KiB
Diff

Only in dietlibc-0.30: CHANGES.orig
diff -rc dietlibc-0.30-orig/libcruft/dnscruft2.c dietlibc-0.30/libcruft/dnscruft2.c
*** dietlibc-0.30-orig/libcruft/dnscruft2.c 2005-05-01 22:08:25.000000000 +0200
--- dietlibc-0.30/libcruft/dnscruft2.c 2007-01-22 15:32:18.000000000 +0100
***************
*** 5,11 ****
#include <netdb.h>
#include <stdlib.h>
#include <arpa/inet.h>
- #include <sys/poll.h>
#include <unistd.h>
#include <errno.h>
#include <arpa/nameser.h>
--- 5,10 ----
diff -rc dietlibc-0.30-orig/libcruft/dnscruft.c dietlibc-0.30/libcruft/dnscruft.c
*** dietlibc-0.30-orig/libcruft/dnscruft.c 2006-06-18 20:32:35.000000000 +0200
--- dietlibc-0.30/libcruft/dnscruft.c 2007-01-22 15:32:18.000000000 +0100
***************
*** 45,53 ****
tmp=socket(PF_INET6,SOCK_DGRAM,IPPROTO_UDP);
if (tmp<0) return;
fcntl(tmp,F_SETFD,FD_CLOEXEC);
si.sin6_family=AF_INET6;
- si.sin6_port=0;
- memset(&si.sin6_addr,0,16);
if (bind(tmp,(struct sockaddr*)&si,sizeof(si))) return;
__dns_fd6=tmp;
}
--- 45,52 ----
tmp=socket(PF_INET6,SOCK_DGRAM,IPPROTO_UDP);
if (tmp<0) return;
fcntl(tmp,F_SETFD,FD_CLOEXEC);
+ memset(&si,0,sizeof(si));
si.sin6_family=AF_INET6;
if (bind(tmp,(struct sockaddr*)&si,sizeof(si))) return;
__dns_fd6=tmp;
}
diff -rc dietlibc-0.30-orig/libcruft/res_mkquery.c dietlibc-0.30/libcruft/res_mkquery.c
*** dietlibc-0.30-orig/libcruft/res_mkquery.c 2004-11-10 18:45:17.000000000 +0100
--- dietlibc-0.30/libcruft/res_mkquery.c 2007-01-22 15:32:18.000000000 +0100
***************
*** 42,51 ****
int res_mkquery(int op, const char *dname, int class, int type, char* data,
int datalen, const unsigned char* newrr, char* buf, int buflen) {
unsigned char packet[512];
! unsigned long len=0;
! memmove(packet,dnspacket,12);
if ((_res.options&RES_RECURSE)==0) packet[2]=0;
- *(unsigned short*)packet=rand();
{
unsigned char* x;
const char* y,* tmp;
--- 42,55 ----
int res_mkquery(int op, const char *dname, int class, int type, char* data,
int datalen, const unsigned char* newrr, char* buf, int buflen) {
unsigned char packet[512];
! unsigned long len;
!
! memcpy(packet,dnspacket,12);
! len=rand();
! packet[0]=len;
! packet[1]=len>>8;
! len=0;
if ((_res.options&RES_RECURSE)==0) packet[2]=0;
{
unsigned char* x;
const char* y,* tmp;
diff -rc dietlibc-0.30-orig/libcruft/res_query.c dietlibc-0.30/libcruft/res_query.c
*** dietlibc-0.30-orig/libcruft/res_query.c 2005-10-14 17:37:59.000000000 +0200
--- dietlibc-0.30/libcruft/res_query.c 2007-01-22 15:32:18.000000000 +0100
***************
*** 99,105 ****
duh[1].fd=pnpfd;
} else {
duh[1].fd=-1;
! duh[1].revents=0;
}
#endif
--- 99,105 ----
duh[1].fd=pnpfd;
} else {
duh[1].fd=-1;
! duh[1].events=0;
}
#endif
diff -rc dietlibc-0.30-orig/syscalls.s/__guard.S dietlibc-0.30/syscalls.s/__guard.S
*** dietlibc-0.30-orig/syscalls.s/__guard.S 2006-04-07 17:33:20.000000000 +0200
--- dietlibc-0.30/syscalls.s/__guard.S 2007-01-22 15:32:18.000000000 +0100
***************
*** 1,3 ****
--- 1,4 ----
+ #include <endian.h>
.data
.type __guard,@object
.global __guard
***************
*** 5,9 ****
--- 6,14 ----
.global __stack_chk_guard
__guard:
__stack_chk_guard:
+ #if __WORDSIZE == 64
+ .quad 0xaff00
+ #else
.long 0xaff00
+ #endif