From owner-freebsd-net@FreeBSD.ORG Wed May 4 00:58:10 2005 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0781516A4CE for ; Wed, 4 May 2005 00:58:10 +0000 (GMT) Received: from smtpout.mac.com (smtpout.mac.com [17.250.248.87]) by mx1.FreeBSD.org (Postfix) with ESMTP id B4B7943D53 for ; Wed, 4 May 2005 00:58:09 +0000 (GMT) (envelope-from cswiger@mac.com) Received: from mac.com (smtpin07-en2 [10.13.10.152]) id j440w6Yi000958; Tue, 3 May 2005 17:58:06 -0700 (PDT) Received: from [192.168.1.6] (pool-68-161-53-96.ny325.east.verizon.net [68.161.53.96]) (authenticated bits=0)j440w5o3011269; Tue, 3 May 2005 17:58:06 -0700 (PDT) In-Reply-To: <20050504003321.45603.qmail@web53907.mail.yahoo.com> References: <20050504003321.45603.qmail@web53907.mail.yahoo.com> Mime-Version: 1.0 (Apple Message framework v622) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <8253029d47916eaad3e18a1cf92440c9@mac.com> Content-Transfer-Encoding: 7bit From: Charles Swiger Date: Tue, 3 May 2005 20:58:04 -0400 To: Daniel Valencia X-Mailer: Apple Mail (2.622) cc: freebsd-net@freebsd.org Subject: Re: sending MAC packets X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 May 2005 00:58:10 -0000 On May 3, 2005, at 8:33 PM, Daniel Valencia wrote: > I'm doing research on network-layer protocols, so I > need a way to send packets straight into layer 2. So > far i've been reffered to raw sockets, but i've read > the code and i cannot skip header checking and that > stuff... Is there a way to interact with the network > if in a way that I can get network parameters (mtu, > etc.) and send packets (specify destination mac > address and payload)?? A non-portable mechanism for doing so is called the BPF, which is used by the ISC DHCP software and other programs to create packets at a low level. Another option would be the libnet library, which will use the BPF on BSD-derived systems, but will also work on Solaris and other platforms which want/need to use other mechanisms to inject packets. Be aware that the network stack may still alter packets somewhat, although less so than trying to go through the raw socket interface. This is particularly the case if hardware functionality like TXCSUM is enabled; you may not be able to forge the sender MAC address, either, although changing the destination MAC addr ought to be fine. -- -Chuck