Running STA and AP modes in parallel

You can use our modules to run a client station and an access point at the same time. Here is a simple example on how to set this up.

Module parameters

To have both mlan0 (for station mode) and uap0 (for access point mode) interfaces showing up when connecting your device, you need to load the driver module with the following parameter:

drv_mode=3

If you plan to run the STA and AP on two different channels, you will also need to activate the Dynamic Rapid Channel Switching feature by adding this parameter to the driver:

cfg80211_drcs=1

DRCS works by periodically pausing all transmissions to switch channel, then returning to the first channel and resuming transmissions. DRCS has a significant impact on the maximum throughput you can achieve when transmissions are occuring on both channels at the same time.

Note that DFS radar detection is not supported when DRCS is enabled. Do not enable DRCS when operating in channels where DFS is needed.

Connecting mlan0 to an access point

Create a file called wpa_supplicant.conf with information to connect to your access point. In this example, we use an open access point, SSID testap, running on channel 11.

ctrl_interface=/run/wpa_supplicant
network={
        ssid="testap"
        key_mgmt=NONE
}

Then start the wpa_supplicant:

$ sudo wpa_supplicant -i mlan0 -c wpa_supplicant.conf
Successfully initialized wpa_supplicant
mlan0: Trying to associate with 62:38:e0:d7:71:bc (SSID='testap' freq=2462 MHz)
mlan0: Associated with 62:38:e0:d7:71:bc
mlan0: CTRL-EVENT-CONNECTED - Connection to 62:38:e0:d7:71:bc completed [id=0 id_str=]
mlan0: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0

Starting a soft access point

Create a file called hostapd.conf with information of the access point you want to create. In this example, it is called SoftAP and runs on channel 11.

ssid=SoftAP
interface=uap0
driver=nl80211
hw_mode=g
channel=11
ieee80211n=1

Start hostapd:

$ sudo hostapd hostapd.conf
Configuration file: /home/hdwireless/hostapd.conf
Using interface uap0 with hwaddr 78:c4:0e:a0:0d:d8 and ssid "SoftAP"
uap0: interface state UNINITIALIZED->ENABLED
uap0: AP-ENABLED 
uap0: IEEE 802.11 driver had channel switch: freq=2462, ht=1, vht_ch=0x0, offset=0, width=1 (20 MHz), cf1=2462, cf2=0

You can then check that the SoftAP network is visible by scanning the available access points with another computer or a smartphone.
This site is powered by Foswiki
Copyright © 2017-2020 H&D Wireless AB.