[tproxy] [PATCH] [TPROXY] implemented IP_RECVORIGDSTADDR socket option
elyasaf
elyasaf at icomsw.com
Sun Nov 16 16:48:30 CET 2008
Last week spoofing UDP work fine (before I try UDP patch -
https://lists.balabit.hu/pipermail/tproxy/2008-November/000999.html)
But now I get:
" destination-sendto() error:Invalid argument"
(I can achieve the source and destination IP for "UDP server")
I use tproxy 4.1 kernel: 2.6.25
The code (that work fine before the above patch):
int fd=socket(AF_INET, SOCK_DGRAM, 0);
int flags=1;
if (setsockopt(fd, SOL_IP, IP_TRANSPARENT, &flags, sizeof(int)) == -1){
perror("destination-setsockopt() IP_TRANSPARENT error!");
return;
}else{
printf("destination-setsockopt IP_TRANSPARENT is OK...\n");
}
setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &flags, sizeof(flags));
setsockopt(fd, SOL_SOCKET, SO_BROADCAST, &flags, sizeof(flags));
if(bind (fd, (struct sockaddr *) source,sizeof(*source))==-1){
perror("destination-bind() error!");
return;
}
flags=0;
if(sendto(fd,buf,len,flags,
(struct sockaddr *)destination,
sizeof(*destination))==-1){
perror("destination-sendto() error");
return;
}
close(fd);
Any Advice?
More information about the tproxy
mailing list