Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build fails with error in function 'proxy_getaddrinfo' on OpenBSD 5.6 #52

Closed
sysfu opened this issue Mar 23, 2015 · 7 comments
Closed

Comments

@sysfu
Copy link

sysfu commented Mar 23, 2015

Environment:
OpenBSD 5.6 release
gmake-4.0p0

Build fails as detailed below:

# ./configure --prefix=/usr/local --sysconfdir=/etc
Done, now run gmake && gmake install
# gmake
cc  -Wall -O0 -g -std=c99 -D_GNU_SOURCE -pipe -DIS_BSD   -DLIB_DIR=\"/usr/local/lib\" -DSYSCONFDIR=\"/etc\" -DDLL_NAME=\"libproxychains4.so\"  -fPIC -c -o src/core.o src/core.c
src/core.c: In function 'proxy_getaddrinfo':
src/core.c:835: warning: passing argument 4 of 'getservbyname_r' from incompatible pointer type
src/core.c:835: error: too many arguments to function 'getservbyname_r'
src/core.c:856: error: 'AI_V4MAPPED' undeclared (first use in this function)
src/core.c:856: error: (Each undeclared identifier is reported only once
src/core.c:856: error: for each function it appears in.)
Makefile:82: recipe for target 'src/core.o' failed
gmake: *** [src/core.o] Error 1
@sysfu
Copy link
Author

sysfu commented Apr 3, 2015

Looking at the patches for an older port of proxychains-3.1 posted to the OpenBSD ports mailing list, I think this problem can be fixed by changing some of the pointer types.

--- proxychains/Makefile.am.orig        Sat Sep 19 05:35:02 2009
+++ proxychains/Makefile.am     Sat Sep 19 05:35:26 2009
@@ -22,7 +22,7 @@ INCLUDES= $(all_includes)

 #proxychains_LDFLAGS = $(all_libraries)
 lib_LTLIBRARIES = libproxychains.la
-libproxychains_la_LDFLAGS = -version-info 3:0:0 $(all_libraries)
+libproxychains_la_LDFLAGS = -version-info 0:0:0 $(all_libraries)
 libproxychains_la_LIBADD= -ldl
 noinst_HEADERS = core.h
 libproxychains_la_SOURCES= libproxychains.c core.c
--- proxychains/Makefile.in.orig        Sat Sep 19 05:35:10 2009
+++ proxychains/Makefile.in     Sat Sep 19 05:35:34 2009
@@ -104,7 +104,7 @@ INCLUDES = $(all_includes)

 #proxychains_LDFLAGS = $(all_libraries)
 lib_LTLIBRARIES = libproxychains.la
-libproxychains_la_LDFLAGS = -version-info 3:0:0 $(all_libraries)
+libproxychains_la_LDFLAGS = -version-info 0:0:0 $(all_libraries)
 libproxychains_la_LIBADD = -ldl
 noinst_HEADERS = core.h
 libproxychains_la_SOURCES = libproxychains.c core.c
--- proxychains/core.h.orig     Sat Sep 19 09:17:50 2009
+++ proxychains/core.h  Sat Sep 19 09:18:46 2009
@@ -83,8 +83,8 @@ freeaddrinfo_t true_freeaddrinfo;

 typedef int (*getnameinfo_t) (const struct sockaddr *,
                socklen_t, char *,
-               socklen_t, char *,
-               socklen_t, unsigned int);
+               size_t, char *,
+               size_t, int);
 getnameinfo_t true_getnameinfo;

 typedef struct hostent *(*gethostbyaddr_t) (const void *, socklen_t, int);
--- proxychains/libproxychains.c.orig   Sat Sep 19 09:18:00 2009
+++ proxychains/libproxychains.c        Sat Sep 19 09:18:52 2009
@@ -290,8 +290,8 @@ void freeaddrinfo(struct addrinfo *res)

 int getnameinfo (const struct sockaddr * sa,
                        socklen_t salen, char * host,
-                       socklen_t hostlen, char * serv,
-                       socklen_t servlen, unsigned int flags)
+                       size_t hostlen, char * serv,
+                       size_t servlen, int flags)
 {
        int ret = 0;
        if(!init_l)
--- proxychains.lsm.orig        Sat Sep 19 05:22:36 2009
@@ -1,6 +1,6 @@
 Begin3
 Title:          ProxyChains 
-Version:        3.0
+Version:        0.0
 Entered-date:   
 Description:    
 Keywords:

@rofl0r
Copy link
Owner

rofl0r commented Apr 4, 2015

this patch is bogus. to support openbsd we need to detect it properly at configure time and define AI_V4MAPPED to 0 and change the ifdef IS_MAC at line 788 of core.c to if defined IS_MAC || defined IS_OPENBSD

can you paste the output of uname -s ?

@sysfu
Copy link
Author

sysfu commented Apr 4, 2015

OK, thanks for the explanation. I was just trying to run down the issue as far as I could by posting the old ports patch.

$ uname -s
OpenBSD

$ uname -a
OpenBSD pfylap.lan 5.6 GENERIC.MP#5 i386

@rofl0r
Copy link
Owner

rofl0r commented Apr 6, 2015

how old is openbsd release 5.6 ?

pls test if this patch fixes your issue 44ca9ca ( branch openbsd )

@sysfu
Copy link
Author

sysfu commented Apr 6, 2015

OpenBSD releases every six months on May 1st and Nov 1st.

So the 5.6 (current release) dates from Nov 1st 2014.

I manually inspected the configure file to make sure that the changes in the patch were present.

$ sudo git clone -b openbsd https://github.com/rofl0r/proxychains-ng.git 
Cloning into 'proxychains-ng'...
remote: Counting objects: 886, done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 886 (delta 0), reused 0 (delta 0), pack-reused 881
Receiving objects: 100% (886/886), 492.32 KiB | 276.00 KiB/s, done.
Resolving deltas: 100% (579/579), done.
Checking connectivity... done.
$ cd proxychains-ng/                                                                                                                                                    
$ git branch
* openbsd
$ sudo ./configure --prefix=/usr/local --sysconfdir=/etc                 
Done, now run gmake && gmake install
$ sudo gmake
cc  -Wall -O0 -g -std=c99 -D_GNU_SOURCE -pipe -DIS_BSD -DIS_OPENBSD   -DLIB_DIR=\"/usr/local/lib\" -DSYSCONFDIR=\"/etc\" -DDLL_NAME=\"libproxychains4.so\"  -fPIC -c -o src/nameinfo.o src/nameinfo.c
printf '#define VERSION "%s"\n' "$(sh tools/version.sh)" > src/version.h
cc  -Wall -O0 -g -std=c99 -D_GNU_SOURCE -pipe -DIS_BSD -DIS_OPENBSD   -DLIB_DIR=\"/usr/local/lib\" -DSYSCONFDIR=\"/etc\" -DDLL_NAME=\"libproxychains4.so\"  -fPIC -c -o src/version.o src/version.c
cc  -Wall -O0 -g -std=c99 -D_GNU_SOURCE -pipe -DIS_BSD -DIS_OPENBSD   -DLIB_DIR=\"/usr/local/lib\" -DSYSCONFDIR=\"/etc\" -DDLL_NAME=\"libproxychains4.so\"  -fPIC -c -o src/core.o src/core.c
src/core.c:791: error: conflicting types for 'getservbyname_r'
/usr/include/netdb.h:312: error: previous declaration of 'getservbyname_r' was here
Makefile:82: recipe for target 'src/core.o' failed
gmake: *** [src/core.o] Error 1

@rofl0r
Copy link
Owner

rofl0r commented Apr 7, 2015

check out if commit 7b962a4 fixes the issue (branch openbsd again)

@sysfu
Copy link
Author

sysfu commented Apr 7, 2015

That did the trick, thank you.

$ sudo git clone -b openbsd https://github.com/rofl0r/proxychains-ng.git 
Cloning into 'proxychains-ng'...
remote: Counting objects: 890, done.
remote: Compressing objects: 100% (9/9), done.
remote: Total 890 (delta 3), reused 0 (delta 0), pack-reused 881
Receiving objects: 100% (890/890), 492.66 KiB | 226.00 KiB/s, done.
Resolving deltas: 100% (582/582), done.
Checking connectivity... done.
$ git branch
fatal: Not a git repository (or any parent up to mount point /usr/local)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
$ cd proxychains-ng/                                                                                                                                                    
$ git branch         
* openbsd
$ sudo ./configure --prefix=/usr/local --sysconfdir=/etc
Done, now run gmake && gmake install
$ sudo gmake
cc  -Wall -O0 -g -std=c99 -D_GNU_SOURCE -pipe -DIS_BSD -DIS_OPENBSD   -DLIB_DIR=\"/usr/local/lib\" -DSYSCONFDIR=\"/etc\" -DDLL_NAME=\"libproxychains4.so\"  -fPIC -c -o src/nameinfo.o src/nameinfo.c
printf '#define VERSION "%s"\n' "$(sh tools/version.sh)" > src/version.h
cc  -Wall -O0 -g -std=c99 -D_GNU_SOURCE -pipe -DIS_BSD -DIS_OPENBSD   -DLIB_DIR=\"/usr/local/lib\" -DSYSCONFDIR=\"/etc\" -DDLL_NAME=\"libproxychains4.so\"  -fPIC -c -o src/version.o src/version.c
cc  -Wall -O0 -g -std=c99 -D_GNU_SOURCE -pipe -DIS_BSD -DIS_OPENBSD   -DLIB_DIR=\"/usr/local/lib\" -DSYSCONFDIR=\"/etc\" -DDLL_NAME=\"libproxychains4.so\"  -fPIC -c -o src/core.o src/core.c
cc  -Wall -O0 -g -std=c99 -D_GNU_SOURCE -pipe -DIS_BSD -DIS_OPENBSD   -DLIB_DIR=\"/usr/local/lib\" -DSYSCONFDIR=\"/etc\" -DDLL_NAME=\"libproxychains4.so\"  -fPIC -c -o src/common.o src/common.c
cc  -Wall -O0 -g -std=c99 -D_GNU_SOURCE -pipe -DIS_BSD -DIS_OPENBSD   -DLIB_DIR=\"/usr/local/lib\" -DSYSCONFDIR=\"/etc\" -DDLL_NAME=\"libproxychains4.so\"  -fPIC -c -o src/libproxychains.o src/libproxychains.c
cc  -Wall -O0 -g -std=c99 -D_GNU_SOURCE -pipe -DIS_BSD -DIS_OPENBSD   -DLIB_DIR=\"/usr/local/lib\" -DSYSCONFDIR=\"/etc\" -DDLL_NAME=\"libproxychains4.so\"  -fPIC -c -o src/shm.o src/shm.c
cc  -Wall -O0 -g -std=c99 -D_GNU_SOURCE -pipe -DIS_BSD -DIS_OPENBSD   -DLIB_DIR=\"/usr/local/lib\" -DSYSCONFDIR=\"/etc\" -DDLL_NAME=\"libproxychains4.so\"  -fPIC -c -o src/allocator_thread.o src/allocator_thread.c
cc  -Wall -O0 -g -std=c99 -D_GNU_SOURCE -pipe -DIS_BSD -DIS_OPENBSD   -DLIB_DIR=\"/usr/local/lib\" -DSYSCONFDIR=\"/etc\" -DDLL_NAME=\"libproxychains4.so\"  -fPIC -c -o src/ip_type.o src/ip_type.c
cc  -Wall -O0 -g -std=c99 -D_GNU_SOURCE -pipe -DIS_BSD -DIS_OPENBSD   -DLIB_DIR=\"/usr/local/lib\" -DSYSCONFDIR=\"/etc\" -DDLL_NAME=\"libproxychains4.so\"  -fPIC -c -o src/stringdump.o src/stringdump.c
cc  -Wall -O0 -g -std=c99 -D_GNU_SOURCE -pipe -DIS_BSD -DIS_OPENBSD   -DLIB_DIR=\"/usr/local/lib\" -DSYSCONFDIR=\"/etc\" -DDLL_NAME=\"libproxychains4.so\"  -fPIC -c -o src/hostsreader.o src/hostsreader.c
cc  -Wall -O0 -g -std=c99 -D_GNU_SOURCE -pipe -DIS_BSD -DIS_OPENBSD   -DLIB_DIR=\"/usr/local/lib\" -DSYSCONFDIR=\"/etc\" -DDLL_NAME=\"libproxychains4.so\"  -fPIC -c -o src/hash.o src/hash.c
cc  -Wall -O0 -g -std=c99 -D_GNU_SOURCE -pipe -DIS_BSD -DIS_OPENBSD   -DLIB_DIR=\"/usr/local/lib\" -DSYSCONFDIR=\"/etc\" -DDLL_NAME=\"libproxychains4.so\"  -fPIC -c -o src/debug.o src/debug.c
cc -shared -fPIC -Wl,--no-as-needed  -Wl,-soname=libproxychains4.so -lpthread  -o libproxychains4.so src/nameinfo.o src/version.o src/core.o src/common.o src/libproxychains.o src/shm.o src/allocator_thread.o src/ip_type.o src/stringdump.o src/hostsreader.o src/hash.o src/debug.o
cc  -Wall -O0 -g -std=c99 -D_GNU_SOURCE -pipe -DIS_BSD -DIS_OPENBSD   -DLIB_DIR=\"/usr/local/lib\" -DSYSCONFDIR=\"/etc\" -DDLL_NAME=\"libproxychains4.so\"  -fPIC -c -o src/main.o src/main.c
cc -fPIC -Wl,--no-as-needed  src/main.o src/common.o -o proxychains4
$ sudo gmake install
./tools/install.sh -D -m 644 libproxychains4.so /usr/local/lib/libproxychains4.so
./tools/install.sh -D -m 755 proxychains4 /usr/local/bin/proxychains4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants