0
0
mirror of https://github.com/darkk/redsocks.git synced 2025-08-25 19:25:30 +00:00
Commit Graph

18 Commits

Author SHA1 Message Date
Leonid Evdokimov
14ff78dfe7 Replace inconsistent rand()/random() with call to libevent2 rng 2016-03-09 01:12:38 +03:00
Przemyslaw Pawelczyk
fce288f657 Rewrite container_of macro without using statement expression.
Statement expression is GNU C extension, not present in ISO standard.
Type checking works now via implicit conversion performed for compound
literal (compound literals are available since C99). typeof is only used
on GNUC compilers like gcc or clang.
2014-07-05 00:31:04 +02:00
Leonid Evdokimov
709646d59d Initial support for UDP + TPROXY redirection. No more dest_ip in redudp.
* TPROXY requires Linux 2.6.29+ (see man 7 ip[1]).
 * all redsocks code is running as root to bind to arbitrary port.
 * Non-Linux and old-Linux builds are broken at the moment.

[1] http://www.kernel.org/doc/man-pages/online/pages/man7/ip.7.html
2012-04-13 02:06:02 +04:00
Leonid Evdokimov
6015b3a6f2 inet_ntop -> red_inet_ntop 2012-04-10 01:43:22 +04:00
Leonid Evdokimov
4d2e10df17 Implement better exponential backoff in case of accept() failure.
This commit implements two more features:
 * min_accept_backoff configuration option
 * retry accept() after some close() calls

See also https://github.com/darkk/redsocks/issues/19
2012-03-25 23:58:40 +04:00
Bin Jin
dcbdcae943 Libevent2 fix: bad default line-extracting strategy
Libevent 2 deprecates evbuffer_readline() function, where any sequence
of any number of carriage return and linefeed characters is treated like
end of line, and introduces better evbuffer_readln(), where termination
format can be explicitly set to: \n, [\r]\n, \r\n or already mentioned
old behaviour.

Change past evbuffer_readline() calls to new
redsocks_evbuffer_readline() function. If libevent 2 is present, use
there evbuffer_readln() with eol_style set to an optional carriage
return, followed by a linefeed (EVBUFFER_EOL_CRLF) instead of obsolete
evbuffer_readln().

  Important note:
Consuming all CR and LF characters in one go (behaviour of
evbuffer_readline(), nowadays aliasing to evbuffer_readln() with
eol_style set to EVBUFFER_EOL_ANY) hangs up parsing of HTTP request
header ending with "\r\n\r\n", because it misses the empty line.

Conflicts (resolved):

	utils.c
	utils.h
2011-11-27 03:54:23 +04:00
Leonid Evdokimov
2f00cf44c5 Added dnstc service that serves any UDP DNS-like request with TC flag.
TC flag means `truncated`, so it actually means "ask me via TCP" for
compliant resolver.
2011-09-22 03:25:26 +04:00
Leonid Evdokimov
9bcb4dcc7e Fix compilation at OpenBSD 4.9. 2011-02-10 00:02:05 +02:00
Przemyslaw Pawelczyk
cf3dc2c4f0 Hide warnings on unused variables if asserts are off.
redsocks.c: In function 'redsocks_read_expected':
redsocks.c:407: warning: unused variable 'read'

http-relay.c: In function 'httpr_client_read_cb':
http-relay.c:520: warning: unused variable 'written_wo_null'

These variables are used in asserts and if asserts are not compiled,
e.g. by defining NDEBUG (usually in CFLAGS via -DNDEBUG), then we have
misleading warnings.

Add in utils.h UNUSED() macro for creating null statement with result
casted to void. Use it to fix above warnings.
2011-01-27 23:22:09 +01:00
Bin Jin
7099116ff1 remove free_null macro 2011-01-13 15:24:48 +08:00
Bin Jin
9d876181b3 merge commits from upstream 2010-12-03 22:02:40 +08:00
Leonid Evdokimov
2e35ae49c7 Cleanup: make socks5 structures reusable. 2010-12-02 23:39:03 +02:00
Leonid Evdokimov
6e574a2021 Another source code cleanup. 2010-11-27 23:30:58 +02:00
Leonid Evdokimov
8ad8d7eb41 More source code cleanup. 2010-11-27 23:20:46 +02:00
Leonid Evdokimov
c50dd8b2b4 Some source code cleanup. 2010-11-27 21:57:43 +02:00
Bin Jin
35a8f066ec implement http-auth for basic and digest scheme 2010-11-14 22:28:48 +08:00
Leonid Evdokimov
23a62f69c8 debug util: dumping list of connections on SIGUSR1. 2008-07-13 04:22:52 +07:00
Leonid Evdokimov
5dda936cf9 Better logging. 2008-02-02 04:18:04 +06:00