* DNS resolution in dietlibc failed randomly on 64-bit platforms. Patch backported from dietlibc CVS.

svn path=/nixpkgs/trunk/; revision=7743

+114 -1
+5 -1
pkgs/os-specific/linux/dietlibc/default.nix
··· 22 22 23 23 # wchar.h declares lots of functions that don't actually exist. 24 24 # Remove them. 25 - ./no-wchar.h 25 + ./no-wchar.patch 26 + 27 + # Fix to get DNS resolution to work on 64-bit platforms. Taken 28 + # from 0.31 CVS. 29 + ./dns64.patch 26 30 27 31 ]; 28 32 }
+109
pkgs/os-specific/linux/dietlibc/dns64.patch
··· 1 + Only in dietlibc-0.30: CHANGES.orig 2 + diff -rc dietlibc-0.30-orig/libcruft/dnscruft2.c dietlibc-0.30/libcruft/dnscruft2.c 3 + *** dietlibc-0.30-orig/libcruft/dnscruft2.c 2005-05-01 22:08:25.000000000 +0200 4 + --- dietlibc-0.30/libcruft/dnscruft2.c 2007-01-22 15:32:18.000000000 +0100 5 + *************** 6 + *** 5,11 **** 7 + #include <netdb.h> 8 + #include <stdlib.h> 9 + #include <arpa/inet.h> 10 + - #include <sys/poll.h> 11 + #include <unistd.h> 12 + #include <errno.h> 13 + #include <arpa/nameser.h> 14 + --- 5,10 ---- 15 + diff -rc dietlibc-0.30-orig/libcruft/dnscruft.c dietlibc-0.30/libcruft/dnscruft.c 16 + *** dietlibc-0.30-orig/libcruft/dnscruft.c 2006-06-18 20:32:35.000000000 +0200 17 + --- dietlibc-0.30/libcruft/dnscruft.c 2007-01-22 15:32:18.000000000 +0100 18 + *************** 19 + *** 45,53 **** 20 + tmp=socket(PF_INET6,SOCK_DGRAM,IPPROTO_UDP); 21 + if (tmp<0) return; 22 + fcntl(tmp,F_SETFD,FD_CLOEXEC); 23 + si.sin6_family=AF_INET6; 24 + - si.sin6_port=0; 25 + - memset(&si.sin6_addr,0,16); 26 + if (bind(tmp,(struct sockaddr*)&si,sizeof(si))) return; 27 + __dns_fd6=tmp; 28 + } 29 + --- 45,52 ---- 30 + tmp=socket(PF_INET6,SOCK_DGRAM,IPPROTO_UDP); 31 + if (tmp<0) return; 32 + fcntl(tmp,F_SETFD,FD_CLOEXEC); 33 + + memset(&si,0,sizeof(si)); 34 + si.sin6_family=AF_INET6; 35 + if (bind(tmp,(struct sockaddr*)&si,sizeof(si))) return; 36 + __dns_fd6=tmp; 37 + } 38 + diff -rc dietlibc-0.30-orig/libcruft/res_mkquery.c dietlibc-0.30/libcruft/res_mkquery.c 39 + *** dietlibc-0.30-orig/libcruft/res_mkquery.c 2004-11-10 18:45:17.000000000 +0100 40 + --- dietlibc-0.30/libcruft/res_mkquery.c 2007-01-22 15:32:18.000000000 +0100 41 + *************** 42 + *** 42,51 **** 43 + int res_mkquery(int op, const char *dname, int class, int type, char* data, 44 + int datalen, const unsigned char* newrr, char* buf, int buflen) { 45 + unsigned char packet[512]; 46 + ! unsigned long len=0; 47 + ! memmove(packet,dnspacket,12); 48 + if ((_res.options&RES_RECURSE)==0) packet[2]=0; 49 + - *(unsigned short*)packet=rand(); 50 + { 51 + unsigned char* x; 52 + const char* y,* tmp; 53 + --- 42,55 ---- 54 + int res_mkquery(int op, const char *dname, int class, int type, char* data, 55 + int datalen, const unsigned char* newrr, char* buf, int buflen) { 56 + unsigned char packet[512]; 57 + ! unsigned long len; 58 + ! 59 + ! memcpy(packet,dnspacket,12); 60 + ! len=rand(); 61 + ! packet[0]=len; 62 + ! packet[1]=len>>8; 63 + ! len=0; 64 + if ((_res.options&RES_RECURSE)==0) packet[2]=0; 65 + { 66 + unsigned char* x; 67 + const char* y,* tmp; 68 + diff -rc dietlibc-0.30-orig/libcruft/res_query.c dietlibc-0.30/libcruft/res_query.c 69 + *** dietlibc-0.30-orig/libcruft/res_query.c 2005-10-14 17:37:59.000000000 +0200 70 + --- dietlibc-0.30/libcruft/res_query.c 2007-01-22 15:32:18.000000000 +0100 71 + *************** 72 + *** 99,105 **** 73 + duh[1].fd=pnpfd; 74 + } else { 75 + duh[1].fd=-1; 76 + ! duh[1].revents=0; 77 + } 78 + 79 + #endif 80 + --- 99,105 ---- 81 + duh[1].fd=pnpfd; 82 + } else { 83 + duh[1].fd=-1; 84 + ! duh[1].events=0; 85 + } 86 + 87 + #endif 88 + diff -rc dietlibc-0.30-orig/syscalls.s/__guard.S dietlibc-0.30/syscalls.s/__guard.S 89 + *** dietlibc-0.30-orig/syscalls.s/__guard.S 2006-04-07 17:33:20.000000000 +0200 90 + --- dietlibc-0.30/syscalls.s/__guard.S 2007-01-22 15:32:18.000000000 +0100 91 + *************** 92 + *** 1,3 **** 93 + --- 1,4 ---- 94 + + #include <endian.h> 95 + .data 96 + .type __guard,@object 97 + .global __guard 98 + *************** 99 + *** 5,9 **** 100 + --- 6,14 ---- 101 + .global __stack_chk_guard 102 + __guard: 103 + __stack_chk_guard: 104 + + #if __WORDSIZE == 64 105 + + .quad 0xaff00 106 + + #else 107 + .long 0xaff00 108 + + #endif 109 +
pkgs/os-specific/linux/dietlibc/no-wchar.h pkgs/os-specific/linux/dietlibc/no-wchar.patch