Note: I don't know source of doc/iptables-packet-flow.png and
doc/iptables-packet-flow-ng.png files, their license is unknown.
As far as I remember, it's something CC-like and they're quite old:
-rw-r--r-- 1 darkk darkk 99799 2007-09-16 07:00 iptables-packet-flow.png
-rw-r--r-- 1 darkk darkk 287299 2009-10-09 10:42 iptables-packet-flow-ng.png
debian/* files from redsocks_0.2-1.debian.tar.gz are uploaded to
upstream to ease maintenance.
MD5(redsocks_0.2-1.debian.tar.gz) = 1d4fe1c98520ffe683a55220c80df193
Signed-off-by: Leonid Evdokimov <leon@darkk.net.ru>
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
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.
scan-build result for socks5.c:256:
Function call argument is an uninitialized value
nextstate can be undefined reply's addrtype field has unexpected value.
Fix by adding else case before to report error, drop client and return
from socks5_read_reply() function.
scan-build result for main.c:144, parser.c:193:
Result of operation is garbage or undefined
If there is early error in main() in second FOREACH block, then
terminators array is not itialized before access in shutdown path.
Fix by moving memset() to precede this block.
gettoken() does not initialize copytype enum value, so can have a
garbage value at some point. Add else case to the chain of **iter tests
to report error and return from the function.
scan-build result for http-auth.c:181:
Argument with 'nonnull' attribute passed null
The bug it found is spurious, because requires impossible execution path
(visible to static analyzer due to omitted elses in code and tool's
stupidity), but it actually helped in finding real bug.
Many rules were applied to make Makefile better:
- Use all capitals for variable names. (readability)
- Introduce new variables, such as LIBS. (reusability)
- Use immediate values instead of deferred ones. (performance)
- Remove reimplemented implicit rules. (size)
- Prevent part of CFLAGS from being overwritten. (correctness)
- Create file w/ dependencies even if there is no gcc. (portability)
- Improve main output rule by respecting LDFLAGS. (correctness)
- Improve main output rule by respecting CFLAGS. (convenience)
- Remove error-prone -MP switch from gcc invocation listing dependencies.
- Use $^ instead of $+, as there is no need for duplication support yet.
- Use -include to prevent warnings if included file does not exist.
Remove warning regarding optlen being size_t.
BTW:
- size_t is at least 16-bit unsigned integral type,
- socklen_t is at least 32-bit signed integral type.
It obviously doesn't matter here, because sizeof(int) fits in 4 bits.
Remove warnings in archs using LP64 by dealing with [s]size_t arguments.
There is a special length modifier 'z' that should precede integer
conversion specifier in format strings using [s]size_t arguments.