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

Add Haiku support #340

Merged
merged 2 commits into from Aug 17, 2020
Merged

Add Haiku support #340

merged 2 commits into from Aug 17, 2020

Conversation

ghost
Copy link

@ghost ghost commented Aug 14, 2020

Haiku OS has a compatible POSIX layer. So it's possible to add support for it. Basic features are tested working on Haiku.

Copy link
Owner

@rofl0r rofl0r left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall looks good, but left some comments

src/libproxychains.c Outdated Show resolved Hide resolved
src/libproxychains.c Outdated Show resolved Hide resolved
src/common.c Outdated
@@ -74,7 +74,11 @@ char *get_config_path(char* default_path, char* pbuf, size_t bufsize) {

// priority 3; $HOME/.proxychains/proxychains.conf
path = getenv("HOME");
#ifdef IS_HAIKU
snprintf(pbuf, bufsize, "%s/config/settings/%s", path, PROXYCHAINS_CONF_FILE);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'd rather just add this path unconditionally as "priority 4" rather than having distrinct layout per OS

@ghost
Copy link
Author

ghost commented Aug 15, 2020

Thanks for your response. To do a pull request one must visit https://review.haiku-os.org and submit a change there for review. You don't have to create an account there, cause when you try to sign in you will be prompted to allow Gerrit access your github account. Once linked, go to the dashboard->YOUR->CHANGES->CREATE CHANGE and follow the instructions.
I am glad to help you to forward this patch to haiku coummunity. If you insist me to help you post the patch, I will do it tonight. Your account name may be mentioned and referenced as this patch is made by you :)

@rofl0r
Copy link
Owner

rofl0r commented Aug 15, 2020

Once linked, go to the dashboard->YOUR->CHANGES->CREATE CHANGE and follow the instructions.

i already tried that, but then pushing failed because "committer's email address not registered" and you can't just put your email addr in gerrit, you need to "unlock" it with a confirmation mail. since i use a noreply email address for commits, that impossible. you see, a lot of hassle.

@waddlesplash ^

@ghost
Copy link
Author

ghost commented Aug 15, 2020

If changes could be made on Haiku's side, I think there is no need to merge my commit here. Probably the only thing that needs to be updated is in the README: list haiku as a supported platform

Once linked, go to the dashboard->YOUR->CHANGES->CREATE CHANGE and follow the instructions.

i already tried that, but then pushing failed because "committer's email address not registered" and you can't just put your email addr in gerrit, you need to "unlock" it with a confirmation mail. since i use a noreply email address for commits, that impossible. you see, a lot of hassle.

@waddlesplash ^

No worries. Then I will help you to submit the changes :)

@rofl0r
Copy link
Owner

rofl0r commented Aug 15, 2020

If changes could be made on Haiku's side, I think there is no need to merge my commit here.

we'd still need the configure part for LIBDL (in case haiku doesn't provide an empty libdl.a if the dl functionality is in libc.so), the user directory plus the undef satosin (it's a namespace violation of haiku to make it available like this, but otoh FreeBSD also defines it, although only with some feature test macro)

I will help you to submit the changes

thanks, much appreciated

@ghost
Copy link
Author

ghost commented Aug 15, 2020

If changes could be made on Haiku's side, I think there is no need to merge my commit here.

we'd still need the configure part for LIBDL (in case haiku doesn't provide an empty libdl.a if the dl functionality is in libc.so), the user directory plus the undef satosin (it's a namespace violation of haiku to make it available like this, but otoh FreeBSD also defines it, although only with some feature test macro)

I will help you to submit the changes

thanks, much appreciated

You're welcome. Yep, I will fix my commit later :)

@ghost
Copy link
Author

ghost commented Aug 15, 2020

hey @rofl0r,

Review progress of your patch is available here: https://review.haiku-os.org/c/haiku/+/3147
New changes were made, please check :)

@rofl0r
Copy link
Owner

rofl0r commented Aug 15, 2020

thanks, your PR looks perfect now

New changes were made, please check :)

i think the /* XXX */ item can be safely removed, as the prototype is now correct and void* can be cast to any pointer type.

edit: your change of int type to int af seems bogus. maybe it would be best to just remove the variable names from the declaration

@ghost
Copy link
Author

ghost commented Aug 15, 2020

i think the /* XXX / item can be safely removed, as the prototype is now correct and void can be cast to any pointer type.

I know..that's why I added /*type*/.. this is copied from the implementation. I will remove it if it's necessary!

@ghost ghost closed this Aug 15, 2020
@rofl0r
Copy link
Owner

rofl0r commented Aug 15, 2020

let's leave this open until haiku merges the fix, then i'll merge

@rofl0r rofl0r reopened this Aug 15, 2020
@rofl0r
Copy link
Owner

rofl0r commented Aug 17, 2020

haiku is fixed: haiku/haiku@7de1ebe

thanks!

@rofl0r rofl0r merged commit 0ee5db6 into rofl0r:master Aug 17, 2020
Copy link

@Begasus Begasus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had a look at an open PR at haikuports at: haikuports/haikuports#5212
Made some changes as that one isn't ready for use, but starting proxychains4 crashes (build with gcc8):

~> proxychains4-x86 curl suip.biz/ip/
[proxychains] config file found: /packages/proxychains_ng_x86-4.14~git-1/.settings/proxychains.conf
[proxychains] preloading /packages/proxychains_ng_x86-4.14~git-1/.self/lib/x86/libproxychains4.so
[proxychains] DLL init: proxychains-ng 4.14-git
resolve symbol "___tls_get_addr" returned: -2147478780
[proxychains] Strict chain  ...  127.0.0.1:9050  ...  timeout
curl: (7) Couldn't connect to server
Kill Thread

@@ -213,6 +218,9 @@ elif isbsd ; then
elif issolaris; then
echo "CFLAGS+=-DIS_SOLARIS -D__EXTENSIONS__" >> config.mak
echo "SOCKET_LIBS=-lsocket -lnsl" >> config.mak
elif ishaiku ; then
echo LIBDL=>>config.mak
echo "CFLAGS+=-DIS_HAIKU" >> config.mak
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add this?

+	echo "SOCKET_LIBS=-lnetwork" >> config.mak

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe? does it fix it or not ?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe? does it fix it or not ?

Doesn't fix, but on Haiku 32bit with gcc2 we use -lsocket, for gcc8 we have to use -lnetwork, so if this is a requirement I think it should be included?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why does the choice of gcc affect in which library stuff is being put? that sounds illogical.
which functions that we require/hook reside in libsocket/libnetwork?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure (not a developer here, and don't know the ins and outs for the Haiku core), but could be that -lsocket is kept for backwards compatibility for BeOS apps/libraries

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PS, thought that the lines preceding this would give a clue that it could be needed?

echo "SOCKET_LIBS=-lsocket -lnsl" >> config.mak

Comment on lines +81 to +87

// priority 3b: ~/config/settings/proxychains.conf (for haiku)
path = getenv("HOME");
snprintf(pbuf, bufsize, "%s/config/settings/%s", path, PROXYCHAINS_CONF_FILE);
path = pbuf;
if(check_path(path))
goto have;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed? proxychains.conf is saved in /boot/system/settings for this (running "runConfigure ./configure"

@rofl0r
Copy link
Owner

rofl0r commented Sep 13, 2020

resolve symbol "___tls_get_addr" returned: -2147478780

where's that coming from ?

Kill Thread

and this?

[proxychains] Strict chain ... 127.0.0.1:9050 ... timeout

if this is tor, did you configure it as socks4 proxy as it should be ?

@Begasus
Copy link

Begasus commented Sep 13, 2020

resolve symbol "___tls_get_addr" returned: -2147478780

where's that coming from ?

Kill Thread

and this?

[proxychains] Strict chain ... 127.0.0.1:9050 ... timeout

if this is tor, did you configure it as socks4 proxy as it should be ?

I only used an example on how to use the binary, not so familiar with these, is there any documentation to do a quick check otherwise?

@rofl0r
Copy link
Owner

rofl0r commented Sep 13, 2020

is there any documentation to do a quick check otherwise

you need a working proxy, then add the correct proxy url to the end of proxychains.conf

for example if you run tor, the example config should work.

if you don't wanna install tor you can try microsocks which is a tiny socks5 proxy server i wrote.

if you have issues, we can chat if you come to the IRC channel mentioned in README.

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.

2 participants