From owner-freebsd-net@FreeBSD.ORG Wed Jan 12 13:59:42 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 905F9106564A for ; Wed, 12 Jan 2011 13:59:42 +0000 (UTC) (envelope-from monthadar@gmail.com) Received: from mail-qy0-f182.google.com (mail-qy0-f182.google.com [209.85.216.182]) by mx1.freebsd.org (Postfix) with ESMTP id 4A1178FC0C for ; Wed, 12 Jan 2011 13:59:41 +0000 (UTC) Received: by qyk36 with SMTP id 36so593576qyk.13 for ; Wed, 12 Jan 2011 05:59:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to :content-type; bh=/ZS3A0z6joSNrKDn9l+Jr9sYhKo6iKbFNGndXGYrRfo=; b=sHgGAVfTQKi0a5gnIYvuTVbdz6dSeh2WXWlj0K875IXpIq/ATg/BkiwBHU3a/i6/B9 da3kbBugIGy0CHpWMi0HAb6oeuhMnraxKSViutK4fIigqXI3YoihROuQBCq5bgeApvYZ 4mPOqu2N+ZbwA+xe7LKnXINhgG7HXF/ukHauQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=HtPhCVH3eKkxoyyta8V5oByESfXywrrMPZKWrDL7XLy2rHdd9roTyUkj9CuUXT5Mzu h06Tn47HzNmdqlhjFrJCQmPUghGApMYx0y6zaje78+RvW3xjz98+EbJYbn6TR0H454lN YuQfGbYbO6eWjaz9rpe1HR4xbltArGmfEs45c= MIME-Version: 1.0 Received: by 10.229.240.85 with SMTP id kz21mr907229qcb.2.1294840781322; Wed, 12 Jan 2011 05:59:41 -0800 (PST) Received: by 10.229.249.14 with HTTP; Wed, 12 Jan 2011 05:59:41 -0800 (PST) Date: Wed, 12 Jan 2011 14:59:41 +0100 Message-ID: From: Monthadar Al Jaberi To: freebsd-net@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Subject: How hard is it to write a dummy wireless driver? (wtap??) 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: Wed, 12 Jan 2011 13:59:42 -0000 Hi, I am thinking about writing a wireless driver that simulates a wifi device (a very simple one). I am interested in only testing 11s mesh. After reading man page for NET80211 http://www.unix.com/man-page/freebsd/9/NET80211/ I see that there are only 5 functions in struct ieee80211com that must be implemented by me, ic_vap_create* ic_vap_delete* ic_scan_start* ic_scan_end* ic_set_channel* and I imagine these would be also usefull too ic_newassoc ic_raw_xmit So, how hard is it? Any advice, guidelines is much appreciated. I have hacked a driver and this is the output I get (I seem to be able to send out data, but not receive it): A modified output from running FreeBSD Current one VBox with two of "myath" devices wlan0: Ethernet address: 00:98:9a:98:9a:98 wlan1: Ethernet address: 00:98:9a:98:9a:99 wlan0: ieee80211_init wlan0: start running, 0 vaps running wlan0: ieee80211_new_state_locked: INIT -> SCAN (nrunning 0 nscanning 0) wlan0: ieee80211_newstate_cb: INIT -> INIT arg 0 wlan0: mesh_newstate: INIT -> INIT (0) wlan0: hwmp_newstate: INIT -> INIT (0) wlan0: ieee80211_newstate_cb: INIT -> SCAN arg 0 wlan0: mesh_newstate: INIT -> SCAN (0) wlan0: ieee80211_check_scan: active scan, append wlan0: scan_update_locked: current scanner is , switch to wlan0: start_scan_locked: active scan, duration 2147483647 mindwell 0 maxdwell 0, desired mode auto, flush wlan0: scan set 1g dwell min 200ms max 200ms wlan0: hwmp_newstate: INIT -> SCAN (0) wlan0: scan_task: chan 1g -> 1g [active, dwell min 200ms max 200ms] wlan0: ieee80211_ref_node (ieee80211_send_probereq:1731) 0xc411b000<00:98:9a:98:9a:98> refcnt 3 wlan0: send probe req on channel 1 bssid ff:ff:ff:ff:ff:ff ssid "" wlan0: ieee80211_start: ignore queue, in SCAN state wlan1: ieee80211_init wlan1: start running, 0 vaps running wlan1: ieee80211_new_state_locked: INIT -> SCAN (nrunning 0 nscanning 0) wlan1: ieee80211_newstate_cb: INIT -> INIT arg 0 wlan1: mesh_newstate: INIT -> INIT (0) wlan1: hwmp_newstate: INIT -> INIT (0) wlan1: ieee80211_newstate_cb: INIT -> SCAN arg 0 wlan1: mesh_newstate: INIT -> SCAN (0) wlan1: ieee80211_check_scan: active scan, append wlan1: scan_update_locked: current scanner is , switch to wlan1: start_scan_locked: active scan, duration 2147483647 mindwell 0 maxdwell 0, desired mode auto, flush wlan1: scan set 1g dwell min 200ms max 200ms wlan1: hwmp_newstate: INIT -> SCAN (0) wlan1: scan_task: chan 1g -> 1g [active, dwell min 200ms max 200ms] wlan1: ieee80211_ref_node (ieee80211_send_probereq:1731) 0xc4121000<00:98:9a:98:9a:99> refcnt 3 wlan1: send probe req on channel 1 bssid ff:ff:ff:ff:ff:ff ssid "" wlan0: received probe_req from 00:98:9a:98:9a:99 rssi 128 wlan0: [00:98:9a:98:9a:99] discard probe_req frame, wrong state SCAN wlan1: ieee80211_start: ignore queue, in SCAN state wlan0: mesh_pick_bss: no scan candidate wlan0: ieee80211_create_ibss: creating MBSS on channel 1 wlan0: ieee80211_alloc_node 0xc4125000<00:98:9a:98:9a:98> in station table wlan0: ieee80211_new_state_locked: SCAN -> RUN (nrunning 0 nscanning 0) wlan0: scan_task: done, [ticks 2427, dwell min 20 scanend 2147486054] wlan0: notify scan done wlan0: ieee80211_newstate_cb: SCAN -> RUN arg -1 wlan0: mesh_newstate: SCAN -> RUN (-1) wlan0: synchronized with 6d:79:6d:65:73:68 meshid "mymesh" channel 1 wlan0: hwmp_newstate: SCAN -> RUN (-1) wlan1: mesh_pick_bss: no scan candidate wlan1: ieee80211_create_ibss: creating MBSS on channel 1 wlan1: ieee80211_alloc_node 0xc412b000<00:98:9a:98:9a:99> in station table wlan1: ieee80211_new_state_locked: SCAN -> RUN (nrunning 0 nscanning 0) wlan1: scan_task: done, [ticks 2432, dwell min 20 scanend 2147486059] wlan1: notify scan done wlan1: ieee80211_newstate_cb: SCAN -> RUN arg -1 wlan1: mesh_newstate: SCAN -> RUN (-1) wlan1: synchronized with 6d:79:6d:65:73:68 meshid "mymesh" channel 1 wlan1: hwmp_newstate: SCAN -> RUN (-1) wlan0: [00:98:9a:98:9a:98] station timed out due to inactivity (refcnt 1) wlan0: [00:98:9a:98:9a:98] station with aid 0 leaves wlan0: node_reclaim: remove 0xc411b000<00:98:9a:98:9a:98> from station table, refcnt 1 wlan1: [00:98:9a:98:9a:99] station timed out due to inactivity (refcnt 1) wlan1: [00:98:9a:98:9a:99] station with aid 0 leaves wlan1: node_reclaim: remove 0xc4121000<00:98:9a:98:9a:99> from station table, refcnt 1 When I try to ping the other wlan IFQ_DEQUEUE(&ifp->if_snd, m) inside myath_start (stripped down version of ath_start) always returns null... I can share my code if you think it helps. thnx -- //Monthadar Al Jaberi