diff --git a/configure b/configure index d506ab7..575aaa6 100755 --- a/configure +++ b/configure @@ -30,6 +30,10 @@ isopenbsd() { uname -s | grep OpenBSD >/dev/null } +issolaris() { + [ "`uname -s`" = SunOS ] +} + check_compile() { printf "checking %s ... " "$1" printf "$3" > "$tmpc" @@ -174,6 +178,8 @@ elif isbsd ; then echo "CFLAGS+=-DIS_BSD">>config.mak isopenbsd && echo "CFLAGS+=-DIS_OPENBSD">>config.mak make_cmd=gmake +elif issolaris; then + echo "CFLAGS+=-DIS_SOLARIS -D__EXTENSIONS__" >> config.mak fi echo "Done, now run $make_cmd && $make_cmd install" diff --git a/src/allocator_thread.c b/src/allocator_thread.c index cb4e987..314f926 100644 --- a/src/allocator_thread.c +++ b/src/allocator_thread.c @@ -3,6 +3,7 @@ #undef _POSIX_C_SOURCE #define _POSIX_C_SOURCE 200809L #define _DARWIN_C_SOURCE +#define _XOPEN_SOURCE 600 #include #include #include diff --git a/src/core.c b/src/core.c index 57c1128..ed3a6bd 100644 --- a/src/core.c +++ b/src/core.c @@ -787,8 +787,8 @@ void proxy_freeaddrinfo(struct addrinfo *res) { free(res); } -#if defined(IS_MAC) || defined(IS_OPENBSD) -#ifdef IS_OPENBSD /* OpenBSD has its own incompatible getservbyname_r */ +#if defined(IS_MAC) || defined(IS_OPENBSD) || defined(IS_SOLARIS) +#if defined(IS_OPENBSD) || defined(IS_SOLARIS) /* OpenBSD and Solaris has its own incompatible getservbyname_r */ #define getservbyname_r mygetservbyname_r #endif /* getservbyname on mac is using thread local storage, so we dont need mutex diff --git a/src/libproxychains.c b/src/libproxychains.c index 7373d55..a540fbb 100644 --- a/src/libproxychains.c +++ b/src/libproxychains.c @@ -38,6 +38,12 @@ #include "core.h" #include "common.h" +#ifdef IS_SOLARIS +#ifndef s6_addr32 +#define s6_addr32 _S6_un._S6_u32 +#endif +#endif + #define satosin(x) ((struct sockaddr_in *) &(x)) #define SOCKADDR(x) (satosin(x)->sin_addr.s_addr) #define SOCKADDR_2(x) (satosin(x)->sin_addr) @@ -330,7 +336,11 @@ int close(int fd) { } static int is_v4inv6(const struct in6_addr *a) { return a->s6_addr32[0] == 0 && a->s6_addr32[1] == 0 && +#ifdef IS_SOLARIS + a->s6_addr[8] == 0 && a->s6_addr[9] == 0 && a->s6_addr[10] == 0xff && a->s6_addr[11] == 0xff; +#else a->s6_addr16[4] == 0 && a->s6_addr16[5] == 0xffff; +#endif } int connect(int sock, const struct sockaddr *addr, unsigned int len) { INIT(); diff --git a/src/main.c b/src/main.c index 01549fe..eb7465f 100644 --- a/src/main.c +++ b/src/main.c @@ -10,7 +10,11 @@ #undef _POSIX_C_SOURCE #define _POSIX_C_SOURCE 200809L #undef _XOPEN_SOURCE +#ifdef IS_SOLARIS /* Solaris doesn't recognize this macro greater than 600 */ +#define _XOPEN_SOURCE 600 +#else #define _XOPEN_SOURCE 700 +#endif #include #include #include