[tproxy] TProxy version 2.0.0 released

Lennert Buytenhek buytenh@wantstofly.org
Mon, 11 Oct 2004 12:47:27 +0200


On Wed, Oct 06, 2004 at 04:32:16PM +0200, KOVACS Krisztian wrote:

>   This version is _not_ compatible with TProxy 1.2.x, you have to make a
> some trivial changes to your source code and recompile the application.

Is there a list anywhere of these changes?  I compared the test apps
from the tproxy 1.2.1 and tproxy 2.0.0 distribution with each other,
and made the corresponding modifications to my app, but I'm not sure
if that's enough.  In particular, I see a list of ops in ip_tproxy.h
(TPROXY_QUERY?) that I'm not using at the moment, and I wonder if I
should.

My app only does foreign TCP connects, so what I did is (with error
checking and such omitted):
- Add TPROXY_VERSION check at program startup.
- Convert all occurances of:
	itp.itp_faddr = req->client_addr.sin_addr;
	itp.itp_fport = htons(0);
	setsockopt(fd, SOL_IP, IP_TPROXY_ASSIGN, &itp, sizeof(itp));
to:
	itp.op = TPROXY_ASSIGN;
	itp.v.addr.faddr = req->client_addr.sin_addr;
	itp.v.addr.fport = htons(0);
	setsockopt(fd, SOL_IP, IP_TPROXY, &itp, sizeof(itp));
- Convert all occurances of:
	flags = ITP_CONNECT;
	setsockopt(fd, SOL_IP, IP_TPROXY_FLAGS, &flags, sizeof(flags));
to:
	itp.op = TPROXY_FLAGS;
	itp.v.flags = ITP_CONNECT;
       	setsockopt(fd, SOL_IP, IP_TPROXY, &itp, sizeof(itp));

This should do it?


cheers,
Lennert