Erreur d'emplcement du fichier dans le précedent commit.
This commit is contained in:
parent
916e48042f
commit
8658701bf9
1 changed files with 0 additions and 148 deletions
148
mac80211.sh
148
mac80211.sh
|
@ -1,148 +0,0 @@
|
|||
#!/bin/sh
|
||||
append DRIVERS "mac80211"
|
||||
|
||||
lookup_phy() {
|
||||
[ -n "$phy" ] && {
|
||||
[ -d /sys/class/ieee80211/$phy ] && return
|
||||
}
|
||||
|
||||
local devpath
|
||||
config_get devpath "$device" path
|
||||
[ -n "$devpath" ] && {
|
||||
for _phy in /sys/devices/$devpath/ieee80211/phy*; do
|
||||
[ -e "$_phy" ] && {
|
||||
phy="${_phy##*/}"
|
||||
return
|
||||
}
|
||||
done
|
||||
}
|
||||
|
||||
local macaddr="$(config_get "$device" macaddr | tr 'A-Z' 'a-z')"
|
||||
[ -n "$macaddr" ] && {
|
||||
for _phy in $(ls /sys/class/ieee80211 2>/dev/null); do
|
||||
[ "$macaddr" = "$(cat /sys/class/ieee80211/${_phy}/macaddress)" ] || continue
|
||||
phy="$_phy"
|
||||
return
|
||||
done
|
||||
}
|
||||
phy=
|
||||
return
|
||||
}
|
||||
|
||||
find_mac80211_phy() {
|
||||
local device="$1"
|
||||
|
||||
config_get phy "$device" phy
|
||||
lookup_phy
|
||||
[ -n "$phy" -a -d "/sys/class/ieee80211/$phy" ] || {
|
||||
echo "PHY for wifi device $1 not found"
|
||||
return 1
|
||||
}
|
||||
config_set "$device" phy "$phy"
|
||||
|
||||
config_get macaddr "$device" macaddr
|
||||
[ -z "$macaddr" ] && {
|
||||
config_set "$device" macaddr "$(cat /sys/class/ieee80211/${phy}/macaddress)"
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
check_mac80211_device() {
|
||||
config_get phy "$1" phy
|
||||
[ -z "$phy" ] && {
|
||||
find_mac80211_phy "$1" >/dev/null || return 0
|
||||
config_get phy "$1" phy
|
||||
}
|
||||
[ "$phy" = "$dev" ] && found=1
|
||||
}
|
||||
|
||||
detect_mac80211() {
|
||||
devidx=0
|
||||
config_load wireless
|
||||
while :; do
|
||||
config_get type "radio$devidx" type
|
||||
[ -n "$type" ] || break
|
||||
devidx=$(($devidx + 1))
|
||||
done
|
||||
for dev in $(ls /sys/class/ieee80211); do
|
||||
found=0
|
||||
config_foreach check_mac80211_device wifi-device
|
||||
[ "$found" -gt 0 ] && continue
|
||||
|
||||
mode_band="g"
|
||||
channel="11"
|
||||
htmode=""
|
||||
ht_capab=""
|
||||
|
||||
iw phy "$dev" info | grep -q 'Capabilities:' && htmode=HT20
|
||||
iw phy "$dev" info | grep -q '2412 MHz' || { mode_band="a"; channel="36"; }
|
||||
|
||||
vht_cap=$(iw phy "$dev" info | grep -c 'VHT Capabilities')
|
||||
[ "$vht_cap" -gt 0 ] && {
|
||||
mode_band="a";
|
||||
channel="36"
|
||||
htmode="VHT80"
|
||||
}
|
||||
|
||||
[ -n $htmode ] && append ht_capab " option htmode $htmode" "$N"
|
||||
|
||||
if [ -x /usr/bin/readlink ]; then
|
||||
path="$(readlink -f /sys/class/ieee80211/${dev}/device)"
|
||||
path="${path##/sys/devices/}"
|
||||
dev_id=" option path '$path'"
|
||||
else
|
||||
dev_id=" option macaddr $(cat /sys/class/ieee80211/${dev}/macaddress)"
|
||||
fi
|
||||
|
||||
cat <<EOF
|
||||
config wifi-device radio$devidx
|
||||
option type mac80211
|
||||
option channel ${channel}
|
||||
option hwmode 11${mode_11n}${mode_band}
|
||||
$dev_id
|
||||
$ht_capab
|
||||
# REMOVE THIS LINE TO ENABLE WIFI:
|
||||
#option disabled 1
|
||||
option country FR
|
||||
|
||||
config wifi-iface
|
||||
option device radio$devidx
|
||||
option network vlan3
|
||||
option mode ap
|
||||
option isolate 0
|
||||
option wmm 1
|
||||
option ssid Cr@ns-test
|
||||
option encryption wpa2
|
||||
# Serveur radius de test
|
||||
option server 138.231.148.35
|
||||
option key fill_it
|
||||
option disabled 1
|
||||
option vlan_enable 1
|
||||
|
||||
config wifi-iface
|
||||
option device radio$devidx
|
||||
option network vlan10
|
||||
option mode ap
|
||||
option isolate 0
|
||||
option wmm 1
|
||||
option ssid Cr@ns-Install
|
||||
option encryption none
|
||||
option disabled 1
|
||||
|
||||
|
||||
config 'wifi-iface'
|
||||
option 'device' 'radio$devidx'
|
||||
option 'network' 'vlan7'
|
||||
option 'mode' 'ap'
|
||||
option 'ssid' 'Cr@ns-accueil'
|
||||
option 'encryption' 'none'
|
||||
option 'test_connect' 'arping -I br-vlan7 10.51.0.10 -c 4'
|
||||
option isolate 1
|
||||
option wmm 1
|
||||
|
||||
EOF
|
||||
devidx=$(($devidx + 1))
|
||||
done
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue