On Sun, 23 Dec 2001, S Ramesh wrote: > I want to build a packet with a source IP address and dest ip address ( > usual case ) given by me and the protocol field in the IP hdr is a > unassigned protocol number ( i used 140 ). I built the IP header by > opening a RAW socket and by setting the IP_HDRINCL option. The source IP > address i gave is not the IP address in any of the interfaces of my > machine. ( I gave 1.2.3.4 ). I bind the raw socket to a local interface > ( my ip address is 192.168.100.242 ) and sent the packet using sendto. > I think I know what is happening, but my understanding of this is a little flakey - maybe somebody else can confirm it... Because you are sending to a local interface, the kernel sends the packet over the loopback interface rather than sending out and in again, so your recvfrom is missing it. I think that if you specify MSG_DONTROUTE when sending the packet, it will behave as you expect and you should see the packet. <shameless plug> You could be using SendIP (http://www.earth.li/projectpurple/progs/sendip.html) to send the packet, without needing to write any code. sendip -p ipv4 -is <source addr> -id <dest addr> -d data dest_ip </shameless plug> -- Mike Ricketts <mike@earth.li> http://www.earth.li/~mike/ Beware of self-styled experts: an ex is a has-been, and a spurt is a drip under pressure. - : send the line "unsubscribe linux-net" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html