[tproxy] UDP transparent proxying

Jean-pierre Cartal jean-pierre.cartal@nextenso.com
Thu, 23 Oct 2003 19:47:24 +0200


Hello,

I'm trying to write a transparent UDP proxy using TProxy, what I would 
like to do is to intercept traffic going to  a given machine, and only  
one, and then resend it with the original source IP address, but with a 
different port number.

I'm able to bind to a local socket, and receive traffic originally 
destinated to the given machine using the ITP_LISTEN flag. My first 
question is should I also use the ITP_UNIDIR option on this socket ?

My problem is when I try to forward the received packet to the 
originally targeted machine, source and destination addresses are not 
the one given through the IP_TPROXY_ASSIGN socket option and the connect 
system call.  I took the code from the foreign-udp-connect.c sample 
given with the patch, but it does not behave correctly within my code 
whereas it is working fine when tested by itself.

Do you have any clue on what I'm doing wrong here ?

Thanks.