Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Jan 2011 14:59:41 +0100
From:      Monthadar Al Jaberi <monthadar@gmail.com>
To:        freebsd-net@freebsd.org
Subject:   How hard is it to write a dummy wireless driver? (wtap??)
Message-ID:  <AANLkTikQ%2BLzmX-94NkZNJCRp6J889SpT1KY5a_y0Fcij@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
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 <none:none>, switch to
<wlan0:MBSS>
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 <none:none>, switch to
<wlan1:MBSS>
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTikQ%2BLzmX-94NkZNJCRp6J889SpT1KY5a_y0Fcij>