From owner-freebsd-net@FreeBSD.ORG Mon Feb 21 06:16:32 2011 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1359C106564A for ; Mon, 21 Feb 2011 06:16:32 +0000 (UTC) (envelope-from bschmidt@techwires.net) Received: from mail-bw0-f44.google.com (mail-bw0-f44.google.com [209.85.214.44]) by mx1.freebsd.org (Postfix) with ESMTP id 9D4898FC0C for ; Mon, 21 Feb 2011 06:16:31 +0000 (UTC) Received: by bwz13 with SMTP id 13so2010168bwz.17 for ; Sun, 20 Feb 2011 22:16:30 -0800 (PST) Received: by 10.204.61.73 with SMTP id s9mr921541bkh.185.1298268989548; Sun, 20 Feb 2011 22:16:29 -0800 (PST) Received: from julie.lab.techwires.net (dslb-088-067-192-041.pools.arcor-ip.net [88.67.192.41]) by mx.google.com with ESMTPS id x38sm3466185bkj.1.2011.02.20.22.16.27 (version=SSLv3 cipher=OTHER); Sun, 20 Feb 2011 22:16:28 -0800 (PST) Sender: Bernhard Schmidt From: Bernhard Schmidt To: freebsd-net@freebsd.org Date: Mon, 21 Feb 2011 07:12:41 +0100 User-Agent: KMail/1.13.5 (FreeBSD/8.1-RELEASE; KDE/4.5.5; amd64; ; ) References: In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Message-Id: <201102210712.41124.bschmidt@freebsd.org> Cc: Adam Stylinski Subject: Re: Radiotap, BPF, and related system calls X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Feb 2011 06:16:32 -0000 On Sunday 20 February 2011 23:56:31 Adam Stylinski wrote: > Hello, > > I'm somewhat of a novice C programmer endeavoring in a project to > write my own protocol which will sit on top of the 1480 byte 802.3 > frames (which are on top of 802.11 frames) to accomplish remote file > transmission. The communication will be one way, but one roadblock > I'm running into is discovering the exact system calls I have to > make to send raw frames. I want to work on the higher level API as > opposed to the kernel level (for one I'd like the 802.11 layer to > auto fragment the 802.3 frames for me). The exact protocol will > require two cards in monitor mode so that raw injection and blind > reception can occur. Control signals will be transmitted over a TCP > socket via the internet. I've found documentation that points to > the system independent radiotap specification, and from there I've > seen documentation which talks about initializing the ioctl through > a BPF clone to be utilized by userland applications. I'm sure that > wireshark and other wireless utilities use this, but there is a boat > load of code I've been looking through to find the precise call > which opens up the device ioctl, initiates the the tap, and gives me > simple functions to construct and transmit my simple frames. I've > found in the headers many references to the structs themselves, but > I'm not sure where to start to initiate communication through the > device. Any 802.11 experts on this list that could perhaps give me > some specific instruction or point me to a man page / example code > which does this? > > Thanks in advance for whatever you can offer me. You might want to have a look at tools/tools/net80211/wlaninject, the code there is supposed to inject raw frames into any 802.11 VAP. On a side note, you want to use ahdemo mode for packet injection, not monitor mode. -- Bernhard