Developing lightweight computation at the DSG edge

Commit ea6d175f authored by p4u's avatar p4u
Browse files

Adds support for mode adhoc_ap

Adds new wifi templates format
Rebuild templates with better parameters
Adds encryption support
Adds support for 11b and 802.11n 20MHz by default if n is supported for modes ap i adhoc_ap
parent 5412edf9
......@@ -68,7 +68,7 @@ qmp_uci_set_raw() {
}
qmp_uci_del() {
uci -q del qmp.$1
uci -q delete qmp.$1
r=$?
uci commit
r=$(( $r + $? ))
......@@ -78,7 +78,7 @@ qmp_uci_del() {
}
qmp_uci_del_raw() {
uci -q del $@
uci -q delete $@
r=$?
uci commit
r=$(( $r + $? ))
......@@ -149,7 +149,7 @@ qmp_uci_import() {
}
qmp_uci_test() {
option=$1
option=$@
u="$(uci get $option > /dev/null 2>&1)"
r=$?
return $r
......@@ -182,7 +182,7 @@ qmp_debug() {
# Returns the names of the wifi devices from the system
qmp_get_wifi_devices() {
awk 'NR>2 { gsub(/:$/,"",$1); print $1 }' /proc/net/wireless
awk 'NR>2 { gsub(/:$/,"",$1); print $1 }' /proc/net/wireless | grep -v -e "wlan[0-9]-[0-9]"
}
# Returns the MAC address of the wifi devices
......@@ -216,7 +216,7 @@ qmp_get_mac_for_dev() {
# Returns the mac addres for specific device,, only wifi devs are allowed. Useful when eth and wlan have same MAC
# qmp_get_dev_from_wifi_mac 00:22:11:33:44:55
qmp_get_dev_from_wifi_mac() {
for device in $(qmp_get_wifi_devices)
for device in $(qmp_get_wifi_devices | sort)
do
if grep -q -i "^$1$" "/sys/class/net/$device/phy80211/macaddress" "/sys/class/net/$device/address" 2> /dev/null
then
......
......@@ -27,8 +27,8 @@
##############################
QMP_PATH="/etc/qmp"
OWRT_WIRELESS_CONFIG="/etc/config/wireless"
TEMPLATE_BASE="$QMP_PATH/templates/wireless" # followed by .driver.mode (wireless.mac80211.adhoc)
WIFI_DEFAULT_CONFIG="$QMP_PATH/templates/wireless.default.config"
TEMPLATE_BASE="$QMP_PATH/templates/wifi"
WIFI_DEFAULT_CONFIG="$QMP_PATH/templates/wifi/wireless.default.config"
TMP="/tmp"
QMPINFO="/etc/qmp/qmpinfo"
......@@ -40,22 +40,16 @@ SOURCE_WIRELESS=1
[ -z "$SOURCE_NET" ] && . $QMP_PATH/qmp_network.sh
[ -z "$SOURCE_FUNCTIONS" ] && . $QMP_PATH/qmp_functions.sh
###########################
# Find wireless interface
##########################
# Returns the index from wifi-iface (config/wireless) associated to the device or first free if not found
qmp_find_wireless_iface() {
device=$1
i=0
while true; do
d=$(qmp_uci_get_raw wireless.@wifi-iface[$i].device)
r=$?
[ "$d" == "$device" ] && break
[ $r -ne 0 ] && { qmp_uci_add_raw wireless wifi-iface; break; }
i=$(( $i + 1 ))
done
echo $i
##############################
# Prepare wireless interface
#############################
# Prepare de WiFi interfaces
# First parameter: device
qmp_prepare_wireless_iface() {
local device=$1
qmp_uci_test wireless.$device && qmp_uci_del_raw wireless.$device
qmp_uci_set_raw wireless.$device=wifi-iface
}
###################################
......@@ -63,23 +57,25 @@ qmp_find_wireless_iface() {
###################################
# First parameter: device
# Second parameter: channel
# Third parameter: mode (adhoc, ap)
# Third parameter: mode (adhoc, ap, adhoc_ap)
# It returns the same channel if it is right, and the new one fixet if not
qmp_check_channel() {
dev="$1"
right_channel="$2"
channel="$(echo $2 | tr -d +-)"
ht40="$(echo $2 | tr -d [0-9])"
mode="$3"
local dev="$1"
local right_channel="$2"
local channel="$(echo $2 | tr -d b+-)"
local ht40="$(echo $2 | tr -d b[0-9])"
local m11b="$(echo $2 | tr -d [0-9]+-)"
local mode="$3"
[ ! -z "$channel" ] && chaninfo="$($QMPINFO channels $1 | grep "^$channel ")"
# Checking if some thing related with channel is wrong
wrong=0
local wrong=0
[ -z "$channel" ] || [ -z "$chaninfo" ] && wrong=1
[ "$mode" == "adhoc" ] && [ -z "$(echo $chaninfo | grep adhoc)" ] && wrong=1
[ "$mode" == "adhoc" -o "$mode" == "adhoc_ap" ] && [ -z "$(echo $chaninfo | grep adhoc)" ] && wrong=1
[ "$ht40" == "+" ] && [ -z "$(echo $chaninfo | grep +)" ] && wrong=1
[ "$ht40" == "-" ] && [ -z "$(echo $chaninfo | grep -)" ] && wrong=1
[ "$m11b" == "b" ] && [ $channel -gt 14 ] && wrong=1
# If something wrong, asking for default parameter
[ $wrong -ne 0 ] && right_channel="$(qmp_wifi_get_default channel $dev $mode)"
......@@ -140,30 +136,59 @@ qmp_configure_wifi_device() {
echo ""
echo "Configuring device $2"
id=$1
device=$2
local id=$1
local device="$(qmp_uci_get @wireless[$id].device)"
# checking if device is configured as "none"
mode="$(qmp_uci_get @wireless[$id].mode)"
[ "$mode" == "none" ] && { echo "Interface $device disabled by qmp system"; return; }
local mode="$(qmp_uci_get @wireless[$id].mode)"
[ "$mode" == "none" ] && { echo "Interface $device is not managed by the qMp system"; return; }
# spliting channel in channel number and ht40 mode
channel_raw="$(qmp_uci_get @wireless[$id].channel)"
channel="$(echo $channel_raw | tr -d +-)"
# is ht40 (802.11n) enabled?
ht40="$(echo $channel_raw | tr -d [0-9])"
[ ! -z "$ht40" ] && { mode="${mode}-n"; htmode="HT40$ht40"; }
local channel_raw="$(qmp_uci_get @wireless[$id].channel)"
local channel="$(echo $channel_raw | tr -d b+-)"
# htmode and mode selection
local ht40="$(echo $channel_raw | tr -d [0-9][A-z])"
local mode11=""
local htmode=""
[ -n "$ht40" ] && {
# Device is selected to use 40MHz channel
mode11="n"
htmode="HT40$ht40"
} || {
m11b="$(echo $channel_raw | tr -d [0-9]+-)"
m11n="$($QMPINFO modes $device | grep -c n)"
[ -n "$m11b" -o $m11n = 0 ] && {
# Device is not 11n compatible or mode 11b is forced
htmode=""
mode11="b"
} || {
# Device is 11n compatible
htmode="HT20"
mode11="n"
}
}
mac="$(qmp_uci_get @wireless[$id].mac)"
name="$(qmp_uci_get @wireless[$id].name)"
driver="$(qmp_uci_get wireless.driver)"
country="$(qmp_uci_get wireless.country)"
bssid="$(qmp_uci_get wireless.bssid)"
txpower="$(qmp_uci_get @wireless[$id].txpower)"
network="$(qmp_get_virtual_iface $device)"
local mac="$(qmp_uci_get @wireless[$id].mac)"
local name="$(qmp_uci_get @wireless[$id].name)"
local driver="$(qmp_uci_get wireless.driver)"
local country="$(qmp_uci_get wireless.country)"
local mrate="$(qmp_uci_get wireless.mrate)"
local bssid="$(qmp_uci_get wireless.bssid)"
local txpower="$(qmp_uci_get @wireless[$id].txpower)"
local network="$(qmp_get_virtual_iface $device)"
local key="$(qmp_uci_get @wireless[$id].key)"
[ -z "$key" ] && encrypt="none" || encrypt="psk2"
local dev_id="$(echo $device | tr -d [A-z])"
dev_id=${dev_id:-$(date +%S)}
local radio="radio$dev_id"
echo "------------------------"
echo "Device $device"
echo "Mac $mac"
echo "Mode $mode"
echo "Driver $driver"
......@@ -171,39 +196,73 @@ qmp_configure_wifi_device() {
echo "Country $country"
echo "Network $network"
echo "Name $name"
echo "HTmode $htmode"
echo "11mode $mode11"
echo "------------------------"
template="$TEMPLATE_BASE.$driver.$mode"
local vap=0
[ $mode == "adhoc_ap" ] && {
mode="adhoc"
vap=1
}
[ ! -f "$template" ] && qmp_error "Template $template not found"
device_template="$TEMPLATE_BASE/device.$driver-$mode11"
iface_template="$TEMPLATE_BASE/iface.$mode"
vap_template="$TEMPLATE_BASE/iface.ap"
index=$(qmp_find_wireless_iface $device)
[ ! -f "$device_template" ] || [ ! -f "$iface_template" ] && qmp_error "Template $template not found"
# Non list arguments
cat $template | grep -v "^list " | sed -e s/"#QMP_DEVICE"/"$device"/ \
cat $device_template | grep -v "^list " | sed \
-e s/"#QMP_RADIO"/"$radio"/ \
-e s/"#QMP_TYPE"/"$driver"/ \
-e s/"#QMP_MAC"/"$mac"/ \
-e s/"#QMP_CHANNEL"/"$channel"/ \
-e s/"#QMP_COUNTRY"/"$country"/ \
-e s/"#QMP_SSID"/"$name"/ \
-e s/"#QMP_HTMODE"/"$htmode"/ \
-e s/"#QMP_TXPOWER"/"$txpower"/ > $TMP/qmp_wifi_device
# List arguments (needed for HT capab)
cat $device_template | grep "^list " | sed s/"^list "//g | sed \
-e s/"#QMP_RADIO"/"$radio"/ | while read l; do
qmp_uci_add_list_raw $l
done
qmp_prepare_wireless_iface $device
cat $iface_template | sed \
-e s/"#QMP_RADIO"/"$radio"/ \
-e s/"#QMP_DEVICE"/"$device"/ \
-e s/"#QMP_IFNAME"/"$device"/ \
-e s/"#QMP_SSID"/"$name"/ \
-e s/"#QMP_BSSID"/"$bssid"/ \
-e s/"#QMP_TXPOWER"/"$txpower"/ \
-e s/"#QMP_INDEX"/"$index"/ \
-e s/"#QMP_NETWORK"/"$network"/ \
-e s/"#QMP_MODE"/"$mode"/ > $TMP/qmp_wireless_temp
-e s/"#QMP_ENC"/"$encrypt"/ \
-e s/"#QMP_KEY"/"$key"/ \
-e s/"#QMP_MRATE"/"$mrate"/ \
-e s/"#QMP_MODE"/"$mode"/ > $TMP/qmp_wifi_iface
# If virtual AP interface has to be configured
[ "$vap" == "1" ] && {
qmp_prepare_wireless_iface ${device}ap
cat $vap_template | sed \
-e s/"#QMP_RADIO"/"$radio"/ \
-e s/"#QMP_DEVICE"/"${device}ap"/ \
-e s/"#QMP_IFNAME"/"${device}ap"/ \
-e s/"#QMP_SSID"/"$name"/ \
-e s/"#QMP_NETWORK"/"lan"/ \
-e s/"#QMP_ENC"/"$encrypt"/ \
-e s/"#QMP_KEY"/"$key"/ \
-e s/"#QMP_MRATE"/"$mrate"/ \
-e s/"#QMP_MODE"/"ap"/ >> $TMP/qmp_wifi_iface
}
qmp_uci_import $TMP/qmp_wireless_temp
qmp_uci_import $TMP/qmp_wifi_device
qmp_uci_import $TMP/qmp_wifi_iface
# List arguments
cat $template | grep "^list " | sed s/"^list "//g | sed -e s/"#QMP_DEVICE"/"$device"/ | \
while read l; do
qmp_uci_add_list_raw $l
done
uci reorder wireless.@wifi-iface[$index]=16
uci commit
rm -f $TMP/qmp_wireless_temp
#uci reorder wireless.@wifi-iface[$index]=16
uci commit wireless
}
#############################
......@@ -217,22 +276,15 @@ qmp_configure_wifi() {
cp $OWRT_WIRELESS_CONFIG $OWRT_WIRELESS_CONFIG.qmp_backup 2>/dev/null
echo "" > $OWRT_WIRELESS_CONFIG
devices="$(qmp_get_wifi_devices)"
macs="$(qmp_get_wifi_mac_devices)"
i=1
for d in $devices; do
m=$(echo $macs | cut -d' ' -f$i)
j=0
while [ ! -z "$(qmp_uci_get @wireless[$j])" ]; do
configured_mac="$(qmp_uci_get @wireless[$j].mac | tr [A-Z] [a-z])"
[ "$configured_mac" == "$m" ] && { qmp_configure_wifi_device $j $d ; break; }
local j=0
while qmp_uci_test qmp.@wireless[$j]; do
qmp_configure_wifi_device $j
j=$(( $j + 1 ))
done
i=$(( $i + 1 ))
done
echo ""
echo "Done. All devices configured according qmp configuration"
echo "Done: all WiFi devices configured"
}
####################
......@@ -264,15 +316,15 @@ qmp_wifi_get_default() {
local index=$(echo $device | tr -d [A-z])
#If only one device, using adhoc
#If only one device, using AP+ADHOC
if [ $devices -eq 1 ]; then
echo "adhoc"
echo "adhoc_ap"
else
#If only one B/G device (2.4GHz) available, using it as AP
#If only one B/G device (2.4GHz) available, using it as AP+ADHOC
bg_this_device=$($QMPINFO modes $device | egrep "b|g" -c)
if [ $bg_this_device -eq 1 -a $bg_devices -eq 1 ]; then
echo "ap"
echo "adhoc_ap"
else
#If only one B/G device and only two devices, using the non B/G one as adhoc
......@@ -280,12 +332,8 @@ qmp_wifi_get_default() {
echo "adhoc"
else
#Else depending on index
if [ $index -eq 1 ]; then
echo "ap"
else
echo "adhoc"
fi;fi;fi;fi
echo "adhoc_ap"
fi;fi;fi
# CHANNEL
# Default channel depends on the card and on configured mode
......@@ -294,21 +342,24 @@ qmp_wifi_get_default() {
elif [ "$what" == "channel" ]; then
[ -z "$device" ] && qmp_error "Device not found?"
mode="$3"
local mode="$3"
# we are using index var to put devices in different channels
index=$(echo $device | tr -d [A-z])
local index=$(echo $device | tr -d [A-z])
index=${index:-0}
# QMPINFO returns a list of avaiable channels in this format: 130 ht40+ adhoc
# this is the command line used to get available channels from a device
channels_cmd="$QMPINFO channels $device"
num_channels=$($channels_cmd | wc -l)
local channels_cmd="$QMPINFO channels $device"
local num_channels=$($channels_cmd | wc -l)
# number of channels for AP is 11 or the number of channels available if less
num_channels_ap=$num_channels
local num_channels_ap=$num_channels
[ $num_channels_ap -gt 11 ] && num_channels_ap=11
# use 40 Mhz of channel size (802.11n)
local ht40="" # ht40+/ht40-
# channel AdHoc is the last available (qmp_tac = inverse order) plus index*2+1 (1 3 5 ...)
[ "$mode" == "adhoc" ] || [ -z "$mode" ] && {
......@@ -318,7 +369,7 @@ qmp_wifi_get_default() {
channel_info="$(qmp_tac $channels_cmd | grep adhoc | awk NR==${ADHOC_INDEX}+${ADHOC_INDEX}*2+1)"
ADHOC_INDEX=$(($ADHOC_INDEX+1))
# c is the channel number, checking ig it is 802.11bg
# c is the channel number, checking if it is 802.11bg
# in such case it will be 1, 6 and 11 for performance and coexistence with other networks
c="$(echo $channel_info | cut -d' ' -f1)"
[ $c -lt 14 ] && {
......@@ -329,13 +380,17 @@ qmp_wifi_get_default() {
fi; fi
ADHOC_BG_USED="$c"
channel_info="$c $(echo $channel_info | cut -d' ' -f2-)"
} || {
# let's see if we can use ht40 mode
ht40="$(echo $channel_info | cut -d' ' -f2)"
}
}
# channel AP = ( node_id + index*3 ) % ( num_channels_ap) + 1
# channel is 1, 6 or 11 for coexistence and performance
[ "$mode" == "ap" ] && {
[ "$mode" = "ap" -o "$mode" = "adhoc_ap" ] && {
c=$(((($(qmp_get_dec_node_id)+$index*3) % $num_channels_ap) +1))
if [ $c -lt 5 ]; then c=1
......@@ -357,10 +412,7 @@ qmp_wifi_get_default() {
return
fi
# let's see if we can use ht40 mode
# if it is avaiable, channel must be configured with + or - symbol
channel="$(echo $channel_info | cut -d' ' -f1)"
ht40="$(echo $channel_info | cut -d' ' -f2)"
[ "$ht40" == "ht40+" ] && channel="${channel}+"
[ "$ht40" == "ht40-" ] && channel="${channel}-"
......@@ -374,6 +426,17 @@ qmp_wifi_get_default() {
fi
}
qmp_reset_wifi() {
#Generating default wifi configuration
country="$(uci get qmp.wireless.country 2>/dev/null)"
country="${country:-00}"
mv /etc/config/wireless /tmp/wireless.old
wifi detect | sed s/"disabled 1"/"country $country"/g > /etc/config/wireless
wifi
}
qmp_configure_wifi_initial() {
#First we are going to configure default parameters if they are not present
......@@ -381,11 +444,12 @@ qmp_configure_wifi_initial() {
[ -z "$(qmp_uci_get wireless.driver)" ] && qmp_uci_set wireless.driver $(qmp_wifi_get_default driver)
[ -z "$(qmp_uci_get wireless.country)" ] && qmp_uci_set wireless.country $(qmp_wifi_get_default country)
[ -z "$(qmp_uci_get wireless.bssid)" ] && qmp_uci_set wireless.bssid $(qmp_wifi_get_default bssid)
[ -z "$(qmp_uci_get wireless.mrate)" ] && qmp_uci_set wireless.mrate $(qmp_wifi_get_default mrate)
#Changing to configured countrycode
iw reg set $(qmp_uci_get wireless.country)
macs="$(qmp_get_wifi_mac_devices)"
macs="$(qmp_get_wifi_mac_devices | sort -u)"
#Looking for configured devices
id_configured=""
......@@ -447,9 +511,4 @@ qmp_configure_wifi_initial() {
qmp_uci_set @wireless[$j].device $device
id_configured="$id_configured $j"
done
#Finally we are going to configure default parameters if they are not present
[ -z "$(qmp_uci_get wireless)" ] && qmp_uci_set wireless qmp
[ -z "$(qmp_uci_get wireless.driver)" ] && qmp_uci_set wireless.driver $(qmp_wifi_get_default driver)
[ -z "$(qmp_uci_get wireless.country)" ] && qmp_uci_set wireless.country $(qmp_wifi_get_default country)
[ -z "$(qmp_uci_get wireless.bssid)" ] && qmp_uci_set wireless.bssid $(qmp_wifi_get_default bssid)
}
wireless.#QMP_DEVICE=wifi-device
wireless.#QMP_DEVICE.type=mac80211
wireless.#QMP_DEVICE.macaddr=#QMP_MAC
wireless.#QMP_DEVICE.channel=#QMP_CHANNEL
wireless.#QMP_DEVICE.diversity=1
wireless.#QMP_DEVICE.txantenna=0
wireless.#QMP_DEVICE.rxantenna=0
wireless.#QMP_DEVICE.country=#QMP_COUNTRY
wireless.#QMP_DEVICE.outdoor=1
wireless.#QMP_DEVICE.hwmode=11b
wireless.#QMP_DEVICE.txpower=#QMP_TXPOWER
wireless.#QMP_RADIO=wifi-device
wireless.#QMP_RADIO.type=mac80211
wireless.#QMP_RADIO.macaddr=#QMP_MAC
wireless.#QMP_RADIO.channel=#QMP_CHANNEL
wireless.#QMP_RADIO.country=#QMP_COUNTRY
wireless.#QMP_RADIO.hwmode=11b
wireless.#QMP_RADIO.txpower=#QMP_TXPOWER
wireless.#QMP_DEVICE=wifi-device
wireless.#QMP_DEVICE.type=mac80211
wireless.#QMP_DEVICE.macaddr=#QMP_MAC
wireless.#QMP_DEVICE.channel=#QMP_CHANNEL
wireless.#QMP_DEVICE.diversity=0
wireless.#QMP_DEVICE.country=#QMP_COUNTRY
wireless.#QMP_DEVICE.outdoor=1
wireless.#QMP_DEVICE.hwmode=#QMP_HWMODE
wireless.#QMP_DEVICE.htmode=#QMP_HTMODE
wireless.#QMP_DEVICE.txpower=#QMP_TXPOWER
wireless.#QMP_DEVICE.noscan=1
list wireless.#QMP_DEVICE.ht_capab=SHORT-GI-#QMP_HT
list wireless.#QMP_DEVICE.ht_capab=TX-STBC
list wireless.#QMP_DEVICE.ht_capab=RX-STBC1
list wireless.#QMP_DEVICE.ht_capab=DSSS_CCK-#QMP_HT
wireless.#QMP_RADIO=wifi-device
wireless.#QMP_RADIO.type=mac80211
wireless.#QMP_RADIO.macaddr=#QMP_MAC
wireless.#QMP_RADIO.channel=#QMP_CHANNEL
wireless.#QMP_RADIO.country=#QMP_COUNTRY
wireless.#QMP_RADIO.hwmode=auto
wireless.#QMP_RADIO.htmode=#QMP_HTMODE
wireless.#QMP_RADIO.txpower=#QMP_TXPOWER
wireless.#QMP_RADIO.noscan=1
list wireless.#QMP_RADIO.ht_capab=SHORT-GI-20
list wireless.#QMP_RADIO.ht_capab=SHORT-GI-40
list wireless.#QMP_RADIO.ht_capab=RX-STBC1
list wireless.#QMP_RADIO.ht_capab=DSSS_CCK-40
wireless.@wifi-iface[#QMP_INDEX].device=#QMP_DEVICE
wireless.@wifi-iface[#QMP_INDEX].mode=adhoc
wireless.@wifi-iface[#QMP_INDEX].ssid=#QMP_SSID
wireless.@wifi-iface[#QMP_INDEX].bssid=#QMP_BSSID
wireless.@wifi-iface[#QMP_INDEX].encryption=none
wireless.#QMP_DEVICE.device=#QMP_RADIO
wireless.#QMP_DEVICE.mode=adhoc
wireless.#QMP_DEVICE.ssid=#QMP_SSID
wireless.#QMP_DEVICE.bssid=#QMP_BSSID
wireless.#QMP_DEVICE.network=#QMP_NETWORK
wireless.#QMP_DEVICE.mcast_rate=#QMP_MRATE
wireless.#QMP_DEVICE.ifname=#QMP_IFNAME
wireless.@wifi-iface[#QMP_INDEX].mode=ap
wireless.@wifi-iface[#QMP_INDEX].ssid=#QMP_SSID
wireless.@wifi-iface[#QMP_INDEX].encryption=none
wireless.@wifi-iface[#QMP_INDEX].device=#QMP_DEVICE
wireless.#QMP_DEVICE.device=#QMP_RADIO
wireless.#QMP_DEVICE.mode=ap
wireless.#QMP_DEVICE.ssid=#QMP_SSID
wireless.#QMP_DEVICE.network=#QMP_NETWORK
wireless.#QMP_DEVICE.encryption=#QMP_ENC
wireless.#QMP_DEVICE.key=#QMP_KEY
wireless.#QMP_DEVICE.ifname=#QMP_IFNAME
wireless.@wifi-iface[#QMP_INDEX].mode=sta
wireless.@wifi-iface[#QMP_INDEX].ssid=#QMP_SSID
wireless.@wifi-iface[#QMP_INDEX].encryption=none
wireless.@wifi-iface[#QMP_INDEX].device=#QMP_DEVICE
wireless.#QMP_DEVICE.device=#QMP_RADIO
wireless.#QMP_DEVICE.mode=sta
wireless.#QMP_DEVICE.ssid=#QMP_SSID
wireless.#QMP_DEVICE.network=#QMP_NETWORK
wireless.#QMP_DEVICE.encryption=#QMP_ENC
wireless.#QMP_DEVICE.key=#QMP_KEY
wireless.#QMP_DEVICE.ifname=#QMP_IFNAME
wireless.@wifi-iface[#QMP_INDEX].device=#QMP_DEVICE
wireless.@wifi-iface[#QMP_INDEX].network=#QMP_NETWORK
wireless.@wifi-iface[#QMP_INDEX].mode=adhoc
wireless.@wifi-iface[#QMP_INDEX].ssid=#QMP_SSID
wireless.@wifi-iface[#QMP_INDEX].bssid=#QMP_BSSID
wireless.@wifi-iface[#QMP_INDEX].encryption=none
wireless.#QMP_DEVICE=wifi-device
wireless.#QMP_DEVICE.type=mac80211
wireless.#QMP_DEVICE.macaddr=#QMP_MAC
wireless.#QMP_DEVICE.channel=#QMP_CHANNEL
wireless.#QMP_DEVICE.diversity=1
wireless.#QMP_DEVICE.txantenna=0
wireless.#QMP_DEVICE.rxantenna=0
wireless.#QMP_DEVICE.country=#QMP_COUNTRY
wireless.#QMP_DEVICE.outdoor=1
wireless.#QMP_DEVICE.txpower=#QMP_TXPOWER
wireless.#QMP_DEVICE=wifi-device
wireless.#QMP_DEVICE.type=mac80211
wireless.#QMP_DEVICE.macaddr=#QMP_MAC
wireless.#QMP_DEVICE.channel=#QMP_CHANNEL
wireless.#QMP_DEVICE.diversity=0
wireless.#QMP_DEVICE.txantenna=0
wireless.#QMP_DEVICE.rxantenna=0
wireless.#QMP_DEVICE.country=#QMP_COUNTRY
wireless.#QMP_DEVICE.outdoor=1
wireless.#QMP_DEVICE.hwmode=auto
wireless.#QMP_DEVICE.htmode=#QMP_HTMODE
wireless.#QMP_DEVICE.txpower=#QMP_TXPOWER
wireless.#QMP_DEVICE.noscan=1
list wireless.#QMP_DEVICE.ht_capab=SHORT-GI-40
list wireless.#QMP_DEVICE.ht_capab=TX-STBC
list wireless.#QMP_DEVICE.ht_capab=RX-STBC1
list wireless.#QMP_DEVICE.ht_capab=DSSS_CCK-40
wireless.@wifi-iface[#QMP_INDEX].device=#QMP_DEVICE
wireless.@wifi-iface[#QMP_INDEX].network=#QMP_NETWORK
wireless.@wifi-iface[#QMP_INDEX].mode=adhoc
wireless.@wifi-iface[#QMP_INDEX].ssid=#QMP_SSID
wireless.@wifi-iface[#QMP_INDEX].bssid=#QMP_BSSID
wireless.@wifi-iface[#QMP_INDEX].encryption=none