From owner-freebsd-net Thu Jul 5 3:21:27 2001 Delivered-To: freebsd-net@freebsd.org Received: from shadow.otel.net (JuDiCaToR.OTEL.net [212.36.9.113]) by hub.freebsd.org (Postfix) with ESMTP id 54B3237B401 for ; Thu, 5 Jul 2001 03:21:24 -0700 (PDT) (envelope-from tbyte@tbyte.org) Received: from localhost (localhost [127.0.0.1]) by shadow.otel.net (8.11.4/8.11.1) with ESMTP id f65AL1K74660; Thu, 5 Jul 2001 13:21:02 +0300 (EEST) (envelope-from tbyte@tbyte.org) Date: Thu, 5 Jul 2001 13:21:01 +0300 (EEST) From: Iasen Kostoff X-Sender: tbyte@shadow.otel.net To: Yonatan Bokovza Cc: "'freebsd-net@freebsd.org'" Subject: Re: IP layer API In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org 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