[tproxy] FW: tproxy getsockopt call

Andrew Ivins aivins@swiftel.com.au
Wed, 7 Jul 2004 13:50:27 +0800


Hi,

Bit of a low level question, again probably one for Krisztian.

One of our developers is trying to ascertain what the original peer
addresses are on a tproxy socket. In the code snippet below, he prints
out the original source and destination addresses. However they are
always zero.

Does anybody know the correct way of doing this? We are still using
cttproxy-2.4.25-1.9.3.


> Here's the code sample
>=20
> struct in_origaddrs orig;
> ...
> ...
>     if ( getsockopt(fd, SOL_IP, IP_ORIGADDRS, &orig, &orig_len) ) {
>       debug(5, 1) ("commConnectStart: Couldn't get original=20
> address for fd\n");
>     } else {
>       debug(5, 1) ("commConnectStart: FD =3D %d\n", fd);
>       debug(5, 1) ("commConnectStart: Original source address=20
> is %s\n",
>         inet_ntoa(orig.ioa_srcaddr));
>       debug(5, 1) ("commConnectStart: Original destination=20
> address is %s\n",
>         inet_ntoa(orig.ioa_dstaddr));
>     }
>=20
>=20


Regards,

Andrew Ivins
System Administrator
Swiftel Communications
(08) 9480 1233