Commit Graph

25 Commits

Author SHA1 Message Date
rofl0r
1da09e49e5 hook close() to prevent rude programs like ssh to close our pipes
those pipes are needed to talk with the dns-name allocator thread.

closes #9
2013-01-21 01:54:45 +01:00
rofl0r
be4efc0fd5 fix no-newline warnings on old compilers 2012-12-25 18:01:11 +01:00
rofl0r
c698d48c03 move stringfromipv4 into common.c 2012-11-07 22:00:03 +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
b851b39a37 add RcB tags to core.h
this is handy as it allows me to do quick testprograms using my RcB program,
without specifying dozens of things on the command line.
2012-11-04 05:01:38 +01:00
rofl0r
923c4f1026 fix core.h to be usable on its own 2012-08-06 01:26:34 +02:00
rofl0r
40edf758ee make getaddrinfo threadsafe 2012-07-16 01:05:28 +02:00
rofl0r
71e15e2edd simplify log func 2012-07-14 17:59:06 +02:00
rofl0r
364c785970 print everything to stderr, and fflush on PDEBUG 2012-07-08 04:18:42 +02:00
rofl0r
d95ef42d48 externalize some variables, which are used from both C files 2012-07-08 00:16:00 +02:00
rofl0r
d72e668767 use sane defaults 2012-04-24 01:48:17 +02:00
rofl0r
561679fbcd remove dead code 2012-04-24 01:46:57 +02:00
rofl0r
f55c6bc4d5 fix PDEBUG macro 2012-04-23 22:21:40 +02:00
rofl0r
49293b180d some cleanup in core.h 2012-04-23 20:26:13 +02: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
80817dbf6f fix *all* trailing whitespace at once 2012-01-27 17:55:37 +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
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