larsbrinkhoff/httptunnel — pull request #2 by vlolteanu (2013-12-15 23:27:35+00:00)
Title: Fix setsockopts

There were two misbehaving setsockopts. Both SO_RCVLOWAT and SO_SNDLOWAT are socket-level options and not TCP-level options.

The latter (SO_SNDLOWAT == 19) has a catastrophic effect on the socket, because it is interpreted as TCP_REPAIR (http://lxr.linux.no/#linux+v3.12.5/include/uapi/linux/tcp.h#L108) and basically doesn't let any more data through. This only happens if htc is run as root; otherwise the kernel returns -EPERM and nothing bad happens.