WIFI STA and AP Bridging Introduction
1. Configuration Modification¶
Kernel config:
make menuconfig 1: Networking support -> Wireless: <*> cfg80211 - wireless configuration API 2: Device Drivers->Generic Driver options [*] Support for uevent helper 3: Networking support → Networking options <M> 802.1d Ethernet Bridging
SSD21x: Modify project/kbuild/customize/4.9.84/p3/dispcam/kernel_mod_list_late
SSD20x: Modify project/kbuild/4.9.84/i2m/configs/nvr/011A/glibc/8.2.1/xxx/modules/kernel_mod_list
Add llc.ko, stp.ko and bridge.ko in turn.
2. Board Modification¶
0: modify /appconfigs/wpa_supplicant.conf, and add the information of external AP, / # vi appconfigs/wpa_supplicant.conf ctrl_interface=/tmp/wifi/run/wpa_supplicant update_config=1 network={ ssid="aryl iPhone" psk="123456789a" }
-
Load the driver
cd /config/wifi mkdir -p /tmp/wifi/run/wpa_supplicant insmod llc.ko insmod stp.ko insmod bridge.ko
-
Add a configuration to hostapd.conf
interface=p2p0 //ssw101/2b uses p2p0 as ap interface. bridge=br0 //fixed hw_mode=g //fixed channel=1
Note: The front and back of the channel used for bridging are the same, wlan0 is connected to the ap channel, and the corresponding channel must be filled in here.
-
Add environment variables.
Add the
sofile used by wifi to the system. Generally it isexport LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/lib:pwdunder /config/wifi -
Initialize wifi
ssd20x series reference script
./ssw01blnit.shssd21x series reference script
./sigma_wifi_init.shNote:
sh: write error: Invalid argumentcan be ignored. -
Establish network adaptor bridging
ifconfig wlan0 up ifconfig p2p0 up ifconfig wlan0 0.0.0.0 ifconfig p2p0 0.0.0.0 brctl addbr br0 brctl addif br0 wlan0 brctl addif br0 p2p0 ifconfig br0 up
-
Connect wifi to sta
./wpa_supplicant -Dnl80211 -i wlan0 -c /appconfigs/wpa_supplicant.conf -b br0 & udhcpc -S /etc/init.d/udhcpc.script -i br0
-
Open AP mode
./hostapd -B /config/wifi/hostapd.conf ./dnsmasq -i p2p0 --no-daemon -C /config/wifi/dnsmasq.conf &
AP:
SSID: ssw101bap
pwd: 12345678
If sta connect to WAN successfully, it can also link network normally when pc connected to ssw101bap.
Note: When sta is connected to wifi, it prompts wlan0 is not sta mode, it may be that the wifi driver and the kernel do not match. Please find the corresponding wifi module manufacturer to provide a new ko.