2 # sets up a wifi interface for meshing
3 # Arguments: $1 = network interface
9 ##### wifi-device #####
11 # Get the type before we delete the wifi-device
13 config_get type $net type
15 # Rename wifi-device for $net
18 if [ -z "${1/cfg[0-9a-fA-F]*/}" ]; then
19 section_rename wireless $1 $net
22 config_foreach handle_wifidevice wifi-device
24 # create new wifi-device for $net
25 uci set wireless.${net}=wifi-device
27 # get and set wifi-device defaults
28 set_defaults "wifi_device_" wireless.${net}
30 channel="$(uci -q get meshwizard.netconfig.$net\_channel)"
31 vap="$(uci -q get meshwizard.netconfig.$net\_vap)"
33 if [ -z "$channel" -o "$channel" == "default" ]; then
34 channel=$wifi_device_channel
38 set wireless.${net}.type="$type"
39 set wireless.${net}.channel="$channel"
42 uci_commitverbose "Setup wifi device for $netrenamed" wireless
46 # Rename wifi-iface for $net
48 config_get device "$1" device
49 if [ "$device" == "$net" ]; then
50 if [ -z "${1/cfg[0-9a-fA-F]*/}" ]; then
51 section_rename wireless $1 ${net}_iface
55 config_foreach handle_interface wifi-iface
57 # create new wifi-device for $net
58 uci set wireless.$net\_iface=wifi-iface
60 # create new wifi-iface for $net from defaults
61 set_defaults "wifi_iface_" wireless.$net\_iface
64 bssid="$($dir/helpers/gen_bssid.sh $channel $community)"
67 if [ "$profile_ssid_scheme" == "addchannel" ]; then
68 ssid="$ssid - ch$channel"
72 set wireless.$net\_iface.device="${net}"
73 set wireless.$net\_iface.network="$netrenamed"
74 set wireless.$net\_iface.ssid="$ssid"
75 set wireless.$net\_iface.bssid="$bssid"
78 uci_commitverbose "Setup wifi interface for $netrenamed" wireless
81 ip4addr="$(uci get meshwizard.netconfig.$net\_ip4addr)"
82 if [ "$type" == "atheros" -a "$vap" == 1 ]; then
84 set wireless.$net\_iface_dhcp="wifi-iface"
85 set wireless.$net\_iface_dhcp.device="$net"
86 set wireless.$net\_iface_dhcp.mode="ap"
87 set wireless.$net\_iface_dhcp.encryption="none"
88 set wireless.$net\_iface_dhcp.network="${netrenamed}dhcp"
89 set wireless.$net\_iface_dhcp.ssid="FF-AP-$ip4addr"
91 uci_commitverbose "Setup VAP interface for $netrenamed" wireless