Back to home page

OSCL-LXR

 
 

    


0001 :orphan:
0002 
0003 .. SPDX-License-Identifier: GPL-2.0
0004 .. include:: <isonum.txt>
0005 
0006 ===================================================================
0007 mac80211_hwsim - software simulator of 802.11 radio(s) for mac80211
0008 ===================================================================
0009 
0010 :Copyright: |copy| 2008, Jouni Malinen <j@w1.fi>
0011 
0012 This program is free software; you can redistribute it and/or modify
0013 it under the terms of the GNU General Public License version 2 as
0014 published by the Free Software Foundation.
0015 
0016 
0017 Introduction
0018 ============
0019 
0020 mac80211_hwsim is a Linux kernel module that can be used to simulate
0021 arbitrary number of IEEE 802.11 radios for mac80211. It can be used to
0022 test most of the mac80211 functionality and user space tools (e.g.,
0023 hostapd and wpa_supplicant) in a way that matches very closely with
0024 the normal case of using real WLAN hardware. From the mac80211 view
0025 point, mac80211_hwsim is yet another hardware driver, i.e., no changes
0026 to mac80211 are needed to use this testing tool.
0027 
0028 The main goal for mac80211_hwsim is to make it easier for developers
0029 to test their code and work with new features to mac80211, hostapd,
0030 and wpa_supplicant. The simulated radios do not have the limitations
0031 of real hardware, so it is easy to generate an arbitrary test setup
0032 and always reproduce the same setup for future tests. In addition,
0033 since all radio operation is simulated, any channel can be used in
0034 tests regardless of regulatory rules.
0035 
0036 mac80211_hwsim kernel module has a parameter 'radios' that can be used
0037 to select how many radios are simulated (default 2). This allows
0038 configuration of both very simply setups (e.g., just a single access
0039 point and a station) or large scale tests (multiple access points with
0040 hundreds of stations).
0041 
0042 mac80211_hwsim works by tracking the current channel of each virtual
0043 radio and copying all transmitted frames to all other radios that are
0044 currently enabled and on the same channel as the transmitting
0045 radio. Software encryption in mac80211 is used so that the frames are
0046 actually encrypted over the virtual air interface to allow more
0047 complete testing of encryption.
0048 
0049 A global monitoring netdev, hwsim#, is created independent of
0050 mac80211. This interface can be used to monitor all transmitted frames
0051 regardless of channel.
0052 
0053 
0054 Simple example
0055 ==============
0056 
0057 This example shows how to use mac80211_hwsim to simulate two radios:
0058 one to act as an access point and the other as a station that
0059 associates with the AP. hostapd and wpa_supplicant are used to take
0060 care of WPA2-PSK authentication. In addition, hostapd is also
0061 processing access point side of association.
0062 
0063 ::
0064 
0065 
0066     # Build mac80211_hwsim as part of kernel configuration
0067 
0068     # Load the module
0069     modprobe mac80211_hwsim
0070 
0071     # Run hostapd (AP) for wlan0
0072     hostapd hostapd.conf
0073 
0074     # Run wpa_supplicant (station) for wlan1
0075     wpa_supplicant -Dnl80211 -iwlan1 -c wpa_supplicant.conf
0076 
0077 
0078 More test cases are available in hostap.git:
0079 git://w1.fi/srv/git/hostap.git and mac80211_hwsim/tests subdirectory
0080 (http://w1.fi/gitweb/gitweb.cgi?p=hostap.git;a=tree;f=mac80211_hwsim/tests)