Commit Graph

29 Commits

Author SHA1 Message Date
rofl0r
73ff65ed76 Makefile: prevent from using 2 slashes (cosmetic change) 2013-02-10 12:38:05 +01:00
rofl0r
5d7715551d Makefile: add install-data to .PHONY 2013-01-06 19:33:34 +01:00
rofl0r
4f7363efbc Makefile: put include config later so the program name can be overridden 2013-01-06 19:26:01 +01:00
rofl0r
5526afb56d FreeBSD support 2012-12-25 19:08:05 +01:00
rofl0r
ab4fb353b6 fix for mac build error
closes #6
2012-12-18 09:42:17 +01:00
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
6f35888528 fix issues with pthread and dlsym symbols on ubuntu 12.04
for some reason, the linker needs --no-as-needed for both
libdl and libpthread.

closes #4

thanks to @tomsawyer for discovering this.

the proposed -pthread change was not needed though,
and this is a good thing since it seems not portable.
2012-11-04 01:21:29 +01:00
rofl0r
a4f3dd0538 Makefile: put config into new install-config target 2012-07-16 02:36:35 +02:00
rofl0r
fba5f5694c use config file lookup routine from a common place 2012-07-08 23:32:50 +02:00
rofl0r
1000366f88 Makefile: create destination dirs in case they do not exist 2012-03-07 18:05:04 +01:00
rofl0r
598a41a671 Makefile: add support for DESTDIR 2012-03-07 18:02:37 +01:00
rofl0r
e99dd76941 complete sysconfdir support 2012-01-30 18:29:35 +01:00
rofl0r
0ee539f31c added support for --sysconfdir 2012-01-30 18:26:38 +01:00
rofl0r
c36db11ebc complete mac support 2012-01-27 20:48:24 +01:00
rofl0r
6d25f5d89e allow dll suffix to be passed from ./configure 2012-01-27 20:30:44 +01:00
rofl0r
526fb8b410 pass dll_name to proxychains app, makes it easier to port to MAC 2012-01-27 19:31:01 +01:00
rofl0r
2acdcd9707 pass install prefix to proxychains app, to find /etc 2012-01-27 19:28:00 +01:00
rofl0r
b20106ce2e make Makefile simpler and more correct 2012-01-24 07:29:34 +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
e547835be6 cleanup of the Makefile and renamed to proxychains4 2011-11-06 14:07:38 +01:00
rofl0r
a9df8ecaaa set executable bit for stuff in bin 2011-09-10 22:50:53 +02:00
rofl0r
888a81345a remove dependency on lib dir in build dir 2011-09-10 22:48:46 +02:00
rofl0r
1740dfbd66 add a config template for the Makefile, and remove some unused variables 2011-09-10 22:43:30 +02:00
rofl0r
76545db413 install also proxychains config template into etc 2011-09-10 22:38:13 +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