Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Sep 2001 17:47:59 -0500
From:      Alfred Perlstein <bright@mu.org>
To:        David Preece <davep@afterswish.com>
Cc:        hackers@freebsd.org
Subject:   Re: sendto not sending what I asked...
Message-ID:  <20010920174759.B61456@elvis.mu.org>
In-Reply-To: <01092110333803.36513@development.wgtn.csg.co.nz>; from davep@afterswish.com on Fri, Sep 21, 2001 at 10:33:38AM %2B1200
References:  <01092110333803.36513@development.wgtn.csg.co.nz>

next in thread | previous in thread | raw e-mail | index | archive | help
* David Preece <davep@afterswish.com> [010920 17:35] wrote:
> Hi,
> 
> I'm trying to write a raw (SYN) packet with sendto. I've opened the socket 
> with socket(AF_INET, SOCK_RAW, IPPROTO_RAW), the result is checked and it is 
> unbound. A buffer and a sockaddr_in are formed then sent down the socket with 
> sendto(sck,pBuffer,40,0,(struct sockaddr *)&sin,sizeof(sin)) and the packet 
> captured using ethereal. While the packet does send, with the correct source 
> and destination addresses, the buffer I pass is appended as data on the end 
> of an IP packet with unknown protocol, rather than replacing the IP and TCP 
> headers (i.e. appending the ethernet header) as I had hoped.
> 
> Has anyone seen this before? Is there a socket option I have missed? I've 
> R'dTFM till I'm blue in the face, and all the examples I can find seem to be 
> for Linux on big endian machines :(

It would help if you'd provided what you think you're sending and
what the other end is actually seeing.  Without that I can't help
much except to suggest that you make sure you're using htons/htonl
in the right spot and on the right size types.  I used htons instead
of htonl on a 32 bit datum and it took me a good half a day to
figure out what i had done wrong.

> PS. No, not a packet kiddie.

none of us are... really. >;)

-- 
-Alfred Perlstein [alfred@freebsd.org]
'Instead of asking why a piece of software is using "1970s technology,"
start asking why software is ignoring 30 years of accumulated wisdom.'

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010920174759.B61456>