[tproxy] udp + tproxy
hidden at sch.bme.hu
Wed Nov 12 19:59:10 CET 2008
On sze, nov 12, 2008 at 11:40:30 +0000, Andrey Luzgin wrote:
> While I can see example of using udp on tproxy2 onto the
> file, I can't find equivalent on tproxy4.
> For getting the original destination IP, I just use setsockopt
> setsockopt(sd, SOL_IP, IP_PKTINFO , &flags, sizeof(flags));
> But I don't know how to get the original destination port:
> a) I manually defined IP_RECVORIGADDRS to be 11273 as I find on
> setsockopt(sd, SOL_IP, IP_RECVORIGADDRS , &flags, sizeof(flags));
> but the setsockopt failed.
> b) the getsockname give me the server listening port.
Since tproxy 4 (unlike tproxy 2) doesn't modify the incoming packets in
any way you should be able to get the correct destination address by
simply calling recvfrom() and using the source address returned by the
More information about the tproxy