1
0
mirror of https://github.com/rofl0r/proxychains-ng synced 2025-01-27 12:53:00 +08:00
Commit Graph

37 Commits

Author SHA1 Message Date
rofl0r
ce655fdac8 fix the never-ending issues with the wrong glibc prototype of getnameinfo
this bug was fixed shortly before 2.14 release, so we checked for that.
however some distros decided to backport this fix to earlier versions,
breaking our compiletime check.

http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=e4ecafe004b3d4270b3a9dace8f970047400ed38

the portable solution is to stick the function into a separate comilation
unit that does not see the glibc prototype.

closes #7
2012-12-17 22:17:04 +01:00
rofl0r
af5c6f0c6a replace hostent lookup with better performing in-memory copy.
the central dns resolver function proxy_gethostbyname() used
to iterate over the gethostent() db (/etc/hosts) on each dns
request.
since this is not threadsafe, we synchronized access to it
previously using mutexes. the parsing of this file is slow,
and blocking all threads to do it even moreso.
since gethostent_r() is only available on a few platforms,
i decided to read the hostent db once and then use a quick
in-memory lookup on further usage.

+ some further refactoring.
2012-11-08 01:18:19 +01:00
rofl0r
03ee84060e remove THREAD_SAFE ifdefs. from now on, pthreads are required.
additionally we have some explicit init and deinit routines for
core.c now, so that we dont need to share variables with
libproxychains.c.
2012-11-07 21:31:19 +01:00
rofl0r
d0abc93c74 preliminary first fork-safe version
instead of allocating memory in the child, we now use the allocator
thread to do all the necessary allocations himself.
additionally we provide a clean API to query the ip <-> dns mapping.
these functions connect via a pipe to the allocator thread, and
exchange messages.

further cleanup is needed, but it seems to work so far.
thread-safety is not yet guaranteed.

closes #1
2012-11-07 21:31:11 +01:00
rofl0r
25afe98b20 failed attempt to use shared memory for the ip <-> dns mapping
this is in order to get irssi, which forks for DNS lookups,
and similar programs, to work as intended.

in a previous attempt i learned that shared memory created in a
child process is not visible to the parent;
in this attempt i spin off a thread from the parent which listens
on a pipe and manages the shared memory allocation from the parent
address-space. however this doesnt work as expected:
memory allocated in the parent after the child forked is not visi-
ble to the child as well.

so what happens is: irssi starts a child process, the thread allocs
memory and hands it to the child, the child attempts to write and
segfaults. however irssi doesnt crash. since now the memory is
already allocated, doing the dns lookup again will succeed.

i.e. the dns lookup works now in irssi by luck.
all but the first dns lookups will suceed.

however this is not good enough for me to be satisfied, i commit
this only for documentation purposes.
2012-11-07 16:49:14 +01:00
rofl0r
e05cafc8e2 put a mutex lock around gethostent() usage, to prevent internal
races. the external usage was covered by the latest commit.
2012-11-04 05:23:51 +01:00
rofl0r
e8d49b02e8 gethostbyaddr hook: also set aliases.
i inspected behaviour of libc's and they all seem to set a valid
h_aliases pointer, of which the first one should be NULL, if no
aliases exist.
2012-11-04 04:58:48 +01:00
rofl0r
40edf758ee make getaddrinfo threadsafe 2012-07-16 01:05:28 +02:00
rofl0r
e5e87c8f22 put abort functionality into get_config_path to further reduce code duplication 2012-07-08 23:47:56 +02:00
rofl0r
fba5f5694c use config file lookup routine from a common place 2012-07-08 23:32:50 +02:00
rofl0r
1fc7e38ee0 fixup for d95ef42d48 2012-07-08 04:09:50 +02:00
rofl0r
2c9c4d9da7 simplify load_sym code and remove potential aliasing violation. 2012-07-08 00:27:46 +02:00
rofl0r
d95ef42d48 externalize some variables, which are used from both C files 2012-07-08 00:16:00 +02:00
Jahrome
229eb7cc5a bugfix: localnet never used if no port specified. Fix typo. 2012-05-22 23:11:03 +02:00
rofl0r
45f50ac754 cosmetic fix 2012-04-24 02:04:02 +02:00
rofl0r
d72e668767 use sane defaults 2012-04-24 01:48:17 +02:00
rofl0r
bc23ef8f46 fix debug message 2012-04-23 22:56:44 +02:00
rofl0r
88a54e872a use dynloader to call init() func when gcc is available, and lock it properly 2012-04-23 22:21:40 +02:00
rofl0r
caed782652 macros 2012-04-23 22:21:40 +02:00
rofl0r
3260ee812a debloat init_lib() 2012-04-23 19:51:14 +02:00
Jianing Yang
65471b750c bugfix: localnet conflicts with proxydns 2012-03-07 17:58:37 +01:00
rofl0r
070051bb73 use macros for mutex stuff 2012-01-27 21:30:42 +01:00
rofl0r
5b5cc604a6 remove dangerous uses of inet_ntoa 2012-01-27 20:00:22 +01:00
rofl0r
3bb03892fa remove superfluous DEBUG checks 2012-01-27 19:14:17 +01:00
rofl0r
e32ef26fec ran indent tool on the source code
now everythings finally correctly indented and future patches
will not be overshadowed by whitespace noise.
used the following settings
--braces-on-func-def-line
--braces-on-struct-decl-line
--braces-on-if-line
--dont-break-procedure-type
--leave-preprocessor-space
--continue-at-parentheses
-linux
-i8
-brace-indent1
--case-indentation8
--space-after-cast
--line-length120
--no-space-after-for
--no-space-after-if
--no-space-after-while
--leave-optional-blank-lines
--ignore-profile
--space-special-semicolon
--indent-label8
2012-01-27 19:03:21 +01:00
rofl0r
80817dbf6f fix *all* trailing whitespace at once 2012-01-27 17:55:37 +01:00
rofl0r
4da71e1b44 make remote_dns_subnet a config option 2012-01-26 12:44:42 +01:00
Adam Hamsik
75bd465038 Fix localnet issue with fix suggested in #issue 4 on github. 2012-01-24 08:42:04 +01:00
rofl0r
8fd0d95bc3 add quiet mode to proxychains launcher
this will be passed on to the DLL via a env variable
- additionally, now everything prints to stderr
- fixes a bug which would print DLL init even in quiet mode
- fixed a couple of bugs in argv parsing
2012-01-24 08:26:37 +01:00
rofl0r
a6d778a0f1 cleanup debug code and remove warnings 2011-11-06 23:35:57 +01:00
rofl0r
41e73ab58d fix realloc and add a layer of threadsafety upon dns-list accesses 2011-11-06 17:46:11 +01:00
rofl0r
5de7fa20c8 implemented remote proxy dns lookup via use of reserved ip ranges and a lookup table 2011-11-06 14:12:50 +01:00
rofl0r
b8bdfc2d5e care about HOME also in proxychains loader. put common symbols in common.h 2011-09-10 22:32:27 +02:00
rofl0r
4d517cdfb0 exact fix for the wrong getnameinfo prototype in GLIBC < 2.14 2011-09-04 18:13:30 +02:00
rofl0r
218d242aab some cosmetic changes 2011-09-04 02:03:47 +02:00
rofl0r
5095296ddf fixed a couple of bugs, warnings, added basic gethostbyaddr support and a plain Makefile 2011-09-04 01:45:16 +02:00
rofl0r
86be015f0d remove gnu autocrap 2011-09-02 20:32:04 +02:00