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

Fix build on FreeBSD #429

Closed
wants to merge 1 commit into from
Closed

Fix build on FreeBSD #429

wants to merge 1 commit into from

Conversation

ehaupt
Copy link

@ehaupt ehaupt commented Jan 25, 2022

FreeBSD also needs monterey-style hooking.

FreeBSD also needs monterey-style hooking.
@rofl0r
Copy link
Owner

rofl0r commented Jan 25, 2022

that's news to me. do you have any additional information? did you run into a compile error ? when was DYLD-style hooking added to freebsd ?

@ehaupt
Copy link
Author

ehaupt commented Jan 25, 2022

Hello @rofl0r

Without it you'll get:

...
cc -DSUPER_SECURE -DHAVE_GNU_GETSERVBYNAME_R -DHAVE_PIPE2 -DHAVE_SOCK_CLOEXEC -DHAVE_CLOCK_GETTIME -O2 -pipe  -fstack-protector-strong -fno-strict-aliasing  -Wall -O0 -g -std=c99 -D_GNU_SOURCE -pipe -DIS_BSD -O2 -pipe  -fstack-protector-strong -fno-strict-aliasing   -DLIB_DIR=\"/usr/local/lib\" -DSYSCONFDIR=\"/usr/local/etc\" -DDLL_NAME=\"libproxychains-4.so\"  -fPIC -c -o src/version.o src/version.c
cc src/common.o src/main.o -fstack-protector-strong   -o proxychains
In file included from src/daemon/udpserver.c:1:
src/daemon/udpserver.h:11:9: warning: unknown pragma ignored [-Wunknown-pragmas]
#pragma RcB2 DEP "udpserver.c"
        ^
1 warning generated.
src/daemon/daemon.c:8:9: warning: '_GNU_SOURCE' macro redefined [-Wmacro-redefined]
#define _GNU_SOURCE
        ^
<command line>:6:9: note: previous definition is here
#define _GNU_SOURCE 1
        ^
In file included from src/daemon/daemon.c:20:
src/daemon/udpserver.h:11:9: warning: unknown pragma ignored [-Wunknown-pragmas]
#pragma RcB2 DEP "udpserver.c"
        ^
2 warnings generated.
cc src/daemon/hsearch.o src/daemon/sblist.o src/daemon/sblist_delete.o src/daemon/daemon.o src/daemon/udpserver.o -fstack-protector-strong  -o proxychains4-daemon
src/libproxychains.c:731:15: error: conflicting types for 'getnameinfo'
HOOKFUNC(int, getnameinfo, const struct sockaddr *sa, socklen_t salen,
              ^
/usr/include/netdb.h:251:6: note: previous declaration is here
int             getnameinfo(const struct sockaddr *, socklen_t, char *,
                ^
1 error generated.

@rofl0r
Copy link
Owner

rofl0r commented Jan 25, 2022

that was fixed in master via pr #430. i'm still interested to hear since when FreeBSD supports DYLD-specific hooking options.
btw, it seems kinda idiotic that both freebsd and openbsd use size_t for some socklen_t arguments, but not for all, and ignore the POSIX specification.
i suspect it's been done for muh security, but then, it would be better if socklen_t was typedef'd to unsigned long instead of randomly changing function signatures.

rofl0r referenced this pull request in freebsd/freebsd-ports Jan 26, 2022
@ehaupt
Copy link
Author

ehaupt commented Jan 26, 2022

Hello @rofl0r, I am not sure when it was added, however, the patch is required for all supported FreeBSD releases. This page shows major changes throughout the OS's history.

I've currently fixed the FreeBSD port with:

https://github.com/freebsd/freebsd-ports/blob/main/net/proxychains-ng/Makefile#L19
https://github.com/freebsd/freebsd-ports/blob/main/net/proxychains-ng/files/patch-src_daemon_sblist.h#L7-L9

@rofl0r
Copy link
Owner

rofl0r commented Jan 26, 2022

hello @ehaupt, thanks for info.

as stated here freebsd/freebsd-ports@18e1399#r64617551 i believe those patches to be wrong (or unnecessary in the case of the -Wunknown-pragmas warnings).

@ehaupt
Copy link
Author

ehaupt commented Jan 26, 2022

Hello @rofl0r, thank you for your feedback. The solution in #430 is much better. I'm going to adjust the FreeBSD accordingly. Please feel free to close this ticket.

freebsd-git pushed a commit to freebsd/freebsd-ports that referenced this pull request Jan 26, 2022
Adapt port to use upstream patch for initial build failure.

Pull Request:	rofl0r/proxychains-ng#429
@rofl0r rofl0r closed this Jan 26, 2022
@ehaupt ehaupt deleted the patch-1 branch January 27, 2022 01:54
5u623l20 pushed a commit to 5u623l20/freebsd-ports that referenced this pull request Jan 27, 2022
Adapt port to use upstream patch for initial build failure.

Pull Request:	rofl0r/proxychains-ng#429
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

Successfully merging this pull request may close these issues.

None yet

2 participants