-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Use dlopen on libc instead of RTLD_NEXT"
This reverts commit f47125c. The commit in question directly used the C library instead of RTLD_NEXT whenever possible, based on some deadlock I didn't specify further in the commit message. I could not reproduce a deadlock like this and given that we don't have a test case that fails with RTLD_NEXT tells me that it doesn't matter. In addition to just reverting, I also added a small test case that I used in order to try reproducing the aforementioned issue. Even though I couldn't reproduce the issue, I'm adding the test anyway since we didn't have a test case where we use multiple LD_PRELOAD wrappers that operate on the same set of calls as ip2unix. Signed-off-by: aszlig <aszlig@nix.build>
- Loading branch information
Showing
7 changed files
with
47 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
{ pkgs, ip2unix, ... }: | ||
|
||
pkgs.runCommand "multiple-preload" { | ||
TSOCKS_DEBUG = 10; | ||
TSOCKS_CONF_FILE = pkgs.writeText "tsocks.conf" '' | ||
server = 127.0.0.2 | ||
''; | ||
|
||
nativeBuildInputs = [ | ||
ip2unix | ||
pkgs.tsocks | ||
pkgs.netcat-openbsd | ||
|
||
(pkgs.writeScriptBin "socksd" '' | ||
#!${(pkgs.python3.withPackages (p: [ p.tiny-proxy ])).interpreter} | ||
import anyio | ||
from tiny_proxy import Socks4ProxyHandler | ||
async def main(): | ||
handler = Socks4ProxyHandler() | ||
listener = await anyio.create_tcp_listener() | ||
await listener.serve(handler.handle) | ||
anyio.run(main) | ||
'') | ||
|
||
(pkgs.writeScriptBin "testprog" '' | ||
#!${pkgs.python3.interpreter} | ||
import socket | ||
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock: | ||
sock.connect(('1.2.3.4', 1234)) | ||
assert sock.recv(3) == b'foo' | ||
'') | ||
]; | ||
} '' | ||
echo foo | nc -N -lU foo.sock & | ||
while [ ! -e foo.sock ]; do sleep 1; done | ||
ip2unix -r in,path=bar.sock -r out,path=foo.sock socksd & | ||
while [ ! -e bar.sock ]; do sleep 1; done | ||
ip2unix -vvvvv -r out,addr=127.0.0.2,path=bar.sock tsocks testprog | ||
touch "$out" | ||
'' |