Folks
OK, I'm trying to write a test app which will send custom TCP segments out
to the network. I've created a raw socket and set the IP_HDRINCL option.
I then proceed to build the packet in a u_char buffer (I'm actually
reading the packet data from a file and simply copying this info
byte-by-byte into the buffer). At this point, I spew some stuff onto the
screen to ensure that everything was copied into the buffer correctly.
All my code seems to work fine until I call sendto() when I get an
"invalid argument" error (errno is 22). After a number of frustrating
hours trying to figure this out, I'm at a loss.
I checked out the web and found some code for a similar application
( http://www.7thsphere.com/hpvac/files/hacking/arnudp001.c ) which uses
sento() along with IP_HDRINCL. I compile it fine, but when I run it I get
the same error (invalid argument). I have no clue why this stuff isn't
working. Needless to say, I'm getting close to the postal stage.
Any ideas?
Oh, I'm running FreeBSD 2.2.5 and using gcc...
Andrew
--
e-mail: andcha at nortel dot ca