Date: Thu, 5 Jul 2001 13:21:01 +0300 (EEST) From: Iasen Kostoff <tbyte@tbyte.org> To: Yonatan Bokovza <Yonatan@xpert.com> Cc: "'freebsd-net@freebsd.org'" <freebsd-net@FreeBSD.ORG> Subject: Re: IP layer API Message-ID: <Pine.BSF.4.21.0107051313470.74646-100000@shadow.otel.net> In-Reply-To: <EB513E68D3F5D41191CA00025558810150D4E1@mailserv.xpert.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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 majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0107051313470.74646-100000>