1*e15d5a53SMauro Carvalho Chehab:orphan: 2*e15d5a53SMauro Carvalho Chehab 3*e15d5a53SMauro Carvalho Chehab.. SPDX-License-Identifier: GPL-2.0 4*e15d5a53SMauro Carvalho Chehab.. include:: <isonum.txt> 5*e15d5a53SMauro Carvalho Chehab 6*e15d5a53SMauro Carvalho Chehab=================================================================== 7*e15d5a53SMauro Carvalho Chehabmac80211_hwsim - software simulator of 802.11 radio(s) for mac80211 8*e15d5a53SMauro Carvalho Chehab=================================================================== 9*e15d5a53SMauro Carvalho Chehab 10*e15d5a53SMauro Carvalho Chehab:Copyright: |copy| 2008, Jouni Malinen <j@w1.fi> 11*e15d5a53SMauro Carvalho Chehab 12*e15d5a53SMauro Carvalho ChehabThis program is free software; you can redistribute it and/or modify 13*e15d5a53SMauro Carvalho Chehabit under the terms of the GNU General Public License version 2 as 14*e15d5a53SMauro Carvalho Chehabpublished by the Free Software Foundation. 15*e15d5a53SMauro Carvalho Chehab 16*e15d5a53SMauro Carvalho Chehab 17*e15d5a53SMauro Carvalho ChehabIntroduction 18*e15d5a53SMauro Carvalho Chehab============ 19*e15d5a53SMauro Carvalho Chehab 20*e15d5a53SMauro Carvalho Chehabmac80211_hwsim is a Linux kernel module that can be used to simulate 21*e15d5a53SMauro Carvalho Chehabarbitrary number of IEEE 802.11 radios for mac80211. It can be used to 22*e15d5a53SMauro Carvalho Chehabtest most of the mac80211 functionality and user space tools (e.g., 23*e15d5a53SMauro Carvalho Chehabhostapd and wpa_supplicant) in a way that matches very closely with 24*e15d5a53SMauro Carvalho Chehabthe normal case of using real WLAN hardware. From the mac80211 view 25*e15d5a53SMauro Carvalho Chehabpoint, mac80211_hwsim is yet another hardware driver, i.e., no changes 26*e15d5a53SMauro Carvalho Chehabto mac80211 are needed to use this testing tool. 27*e15d5a53SMauro Carvalho Chehab 28*e15d5a53SMauro Carvalho ChehabThe main goal for mac80211_hwsim is to make it easier for developers 29*e15d5a53SMauro Carvalho Chehabto test their code and work with new features to mac80211, hostapd, 30*e15d5a53SMauro Carvalho Chehaband wpa_supplicant. The simulated radios do not have the limitations 31*e15d5a53SMauro Carvalho Chehabof real hardware, so it is easy to generate an arbitrary test setup 32*e15d5a53SMauro Carvalho Chehaband always reproduce the same setup for future tests. In addition, 33*e15d5a53SMauro Carvalho Chehabsince all radio operation is simulated, any channel can be used in 34*e15d5a53SMauro Carvalho Chehabtests regardless of regulatory rules. 35*e15d5a53SMauro Carvalho Chehab 36*e15d5a53SMauro Carvalho Chehabmac80211_hwsim kernel module has a parameter 'radios' that can be used 37*e15d5a53SMauro Carvalho Chehabto select how many radios are simulated (default 2). This allows 38*e15d5a53SMauro Carvalho Chehabconfiguration of both very simply setups (e.g., just a single access 39*e15d5a53SMauro Carvalho Chehabpoint and a station) or large scale tests (multiple access points with 40*e15d5a53SMauro Carvalho Chehabhundreds of stations). 41*e15d5a53SMauro Carvalho Chehab 42*e15d5a53SMauro Carvalho Chehabmac80211_hwsim works by tracking the current channel of each virtual 43*e15d5a53SMauro Carvalho Chehabradio and copying all transmitted frames to all other radios that are 44*e15d5a53SMauro Carvalho Chehabcurrently enabled and on the same channel as the transmitting 45*e15d5a53SMauro Carvalho Chehabradio. Software encryption in mac80211 is used so that the frames are 46*e15d5a53SMauro Carvalho Chehabactually encrypted over the virtual air interface to allow more 47*e15d5a53SMauro Carvalho Chehabcomplete testing of encryption. 48*e15d5a53SMauro Carvalho Chehab 49*e15d5a53SMauro Carvalho ChehabA global monitoring netdev, hwsim#, is created independent of 50*e15d5a53SMauro Carvalho Chehabmac80211. This interface can be used to monitor all transmitted frames 51*e15d5a53SMauro Carvalho Chehabregardless of channel. 52*e15d5a53SMauro Carvalho Chehab 53*e15d5a53SMauro Carvalho Chehab 54*e15d5a53SMauro Carvalho ChehabSimple example 55*e15d5a53SMauro Carvalho Chehab============== 56*e15d5a53SMauro Carvalho Chehab 57*e15d5a53SMauro Carvalho ChehabThis example shows how to use mac80211_hwsim to simulate two radios: 58*e15d5a53SMauro Carvalho Chehabone to act as an access point and the other as a station that 59*e15d5a53SMauro Carvalho Chehabassociates with the AP. hostapd and wpa_supplicant are used to take 60*e15d5a53SMauro Carvalho Chehabcare of WPA2-PSK authentication. In addition, hostapd is also 61*e15d5a53SMauro Carvalho Chehabprocessing access point side of association. 62*e15d5a53SMauro Carvalho Chehab 63*e15d5a53SMauro Carvalho Chehab:: 64*e15d5a53SMauro Carvalho Chehab 65*e15d5a53SMauro Carvalho Chehab 66*e15d5a53SMauro Carvalho Chehab # Build mac80211_hwsim as part of kernel configuration 67*e15d5a53SMauro Carvalho Chehab 68*e15d5a53SMauro Carvalho Chehab # Load the module 69*e15d5a53SMauro Carvalho Chehab modprobe mac80211_hwsim 70*e15d5a53SMauro Carvalho Chehab 71*e15d5a53SMauro Carvalho Chehab # Run hostapd (AP) for wlan0 72*e15d5a53SMauro Carvalho Chehab hostapd hostapd.conf 73*e15d5a53SMauro Carvalho Chehab 74*e15d5a53SMauro Carvalho Chehab # Run wpa_supplicant (station) for wlan1 75*e15d5a53SMauro Carvalho Chehab wpa_supplicant -Dnl80211 -iwlan1 -c wpa_supplicant.conf 76*e15d5a53SMauro Carvalho Chehab 77*e15d5a53SMauro Carvalho Chehab 78*e15d5a53SMauro Carvalho ChehabMore test cases are available in hostap.git: 79*e15d5a53SMauro Carvalho Chehabgit://w1.fi/srv/git/hostap.git and mac80211_hwsim/tests subdirectory 80*e15d5a53SMauro Carvalho Chehab(http://w1.fi/gitweb/gitweb.cgi?p=hostap.git;a=tree;f=mac80211_hwsim/tests) 81