mirror of
https://github.com/rofl0r/proxychains-ng.git
synced 2024-12-22 04:08:47 +00:00
remove usage of s6_addr16 and s6_addr32
it turns out that those macros are not portable at all. rather than adding workarounds to make it work for every single platform, just use plain s6_addr instead.
This commit is contained in:
parent
d28f4df8e2
commit
2f3d33dd47
8
configure
vendored
8
configure
vendored
@ -133,14 +133,6 @@ if [ -z "$CC" ] ; then
|
||||
CC=cc
|
||||
fi
|
||||
|
||||
check_compile 'whether netinet/in.h defines s6_addr16' "" \
|
||||
'#include <netinet/in.h>\nint main(int a, char**c){struct in6_addr x={.s6_addr32[0]=a};return x.s6_addr16[0]; }' \
|
||||
|| {
|
||||
check_compile 'whether netinet/in.h defines __u6_addr.__u6_addr16' \
|
||||
'-Ds6_addr16=__u6_addr.__u6_addr16 -Ds6_addr32=__u6_addr.__u6_addr32' \
|
||||
'#include <netinet/in.h>\nint main(int a, char**c){struct in6_addr x={.s6_addr32[0]=a};return x.s6_addr16[0]; }'
|
||||
}
|
||||
|
||||
check_define __OpenBSD__ && \
|
||||
check_compile_run 'whether OpenBSDs fclose() (illegally) calls close()' \
|
||||
'#include <stdio.h>\n#include<stdlib.h>\nint close(int x){exit(0);}int main(){fclose(stdin);return 1;}' && \
|
||||
|
@ -329,8 +329,7 @@ int close(int fd) {
|
||||
return -1;
|
||||
}
|
||||
static int is_v4inv6(const struct in6_addr *a) {
|
||||
return a->s6_addr32[0] == 0 && a->s6_addr32[1] == 0 &&
|
||||
a->s6_addr16[4] == 0 && a->s6_addr16[5] == 0xffff;
|
||||
return !memcmp(a->s6_addr, "\0\0\0\0\0\0\0\0\0\0\xff\xff", 12);
|
||||
}
|
||||
int connect(int sock, const struct sockaddr *addr, unsigned int len) {
|
||||
INIT();
|
||||
@ -360,7 +359,7 @@ int connect(int sock, const struct sockaddr *addr, unsigned int len) {
|
||||
: ntohs(((struct sockaddr_in6 *) addr)->sin6_port);
|
||||
struct in_addr v4inv6;
|
||||
if(v6 && is_v4inv6(p_addr_in6)) {
|
||||
memcpy(&v4inv6.s_addr, &p_addr_in6->s6_addr32[3], 4);
|
||||
memcpy(&v4inv6.s_addr, &p_addr_in6->s6_addr[12], 4);
|
||||
v6 = dest_ip.is_v6 = 0;
|
||||
p_addr_in = &v4inv6;
|
||||
}
|
||||
@ -455,7 +454,7 @@ int pc_getnameinfo(const struct sockaddr *sa, socklen_t salen,
|
||||
unsigned scopeid = 0;
|
||||
if(v6) {
|
||||
if(is_v4inv6(&((struct sockaddr_in6*)sa)->sin6_addr)) {
|
||||
memcpy(v4inv6buf, &((struct sockaddr_in6*)sa)->sin6_addr.s6_addr32[3], 4);
|
||||
memcpy(v4inv6buf, &((struct sockaddr_in6*)sa)->sin6_addr.s6_addr[12], 4);
|
||||
ip = v4inv6buf;
|
||||
v6 = 0;
|
||||
} else
|
||||
|
Loading…
Reference in New Issue
Block a user