On Thu, 5 Jul 2001, Yonatan Bokovza wrote:

> Hi,
> How can I send/receive packets at the IP layer?
> I read many sockets tutorials, including the
> one at the dev-handbook, but they only deal
> with higher level of protocols (TCP/UDP). I
> need to send out packet where I can control
> it's ip_checksum, ip_frag etc, and read back
> the reply.
> I prefer not to use libnet for that.
> 
You should use raw socket ( SOCK_RAW ) as :

  s = socket(AF_INET, SOCK_RAW, IPPROTO_RAW);

and if you want to manage manualy IP header you should set IP_HDRINCL
for this socket :

int on=1;
  setsockopt(s, IPPROTO_IP, IP_HDRINCL, (char *)&on, sizeof(on))

The reason for not including raw socket tutorials I think is that You can
do a lot of bad things with it . So don't :-). The other reason may be the
lack of usage.


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-net" in the body of the message

Reply via email to