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