Results 1 to 1 of 1
Hey I am creating a little udp port forwarder/duplicator. I want the source address of the packet to be the same when i "resend" the packet. So I want the ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 02-20-2006 #1
- Join Date
- Feb 2006
sendto with MSG_PROXY
I am creating a little udp port forwarder/duplicator. I want the source address of the packet to be the same when i "resend" the packet. So I want the final recieving machine to think it got the packet from the original sender, not the forwarding computer. I do not wish to use iptables as iptables will only forward the packet to 1 address, not 2. I receive some data and then get ready to send it. I will show some code below, assume code declares all the needed values currectly and I assume that on a linux kernel 2.2 this will work:
memcpy((char *) sa.sin_zero, &local_sa, 8); int wr = sendto( rsd, buf, buf_len, \ ((source || transparent_proxy) ? MSG_PROXY : 0), \ (struct sockaddr *) &sa, sizeof(sa));
Sorry this msg might be a little short and sweet and lacking info, but I will assume that anybody who knows the info I want to know will be able to answer my question by just seeing the MSG_PROXY flag in sendto :P (Coz I assume MSG_PROXY isn't used in 2.4 and 2.6). But then again I might be wrong.
Let me know if you need more info ...