2 # sets up a wifi interface for meshing
3 # Arguments: $1 = network interface
9 ##### wifi-device #####
11 echo " + Setup wifi-device"
13 # Get the type before we delete the wifi-device
15 config_get type $net type
17 # Delete old wifi-device for $net
20 if [ "$1" == "$net" -a "$cleanup" == 1 ]; then
21 section_cleanup wireless.${net}
23 if [ -z "${1/cfg[0-9a-fA-F]*/}" ]; then
24 section_rename wireless $1 $net
28 config_foreach handle_wifidevice wifi-device
30 # create new wifi-device for $net
31 uci set wireless.${net}=wifi-device
33 # get and set wifi-device defaults
34 set_defaults "wifi_device_" wireless.${net}
36 channel="$(uci -q get meshwizard.netconfig.$net\_channel)"
37 vap="$(uci -q get meshwizard.netconfig.$net\_vap)"
39 if [ -z "$channel" -o "$channel" == "default" ]; then
40 channel=$wifi_device_channel
44 set wireless.${net}.type="$type"
45 set wireless.${net}.channel="$channel"
49 echo " Channel: $channel"
53 echo " + Setup wifi-iface"
55 # Delete old wifi-iface for $net
57 config_get device "$1" device
58 if [ "$device" == "$net" ]; then
59 if [ "$cleanup" == 1 ]; then
60 section_cleanup wireless.${net}_iface
62 if [ -z "${1/cfg[0-9a-fA-F]*/}" ]; then
63 section_rename wireless $1 ${net}_iface
68 config_foreach handle_interface wifi-iface
70 # create new wifi-device for $net
71 uci set wireless.$net\_iface=wifi-iface
73 # create new wifi-iface for $net from defaults
74 set_defaults "wifi_iface_" wireless.$net\_iface
77 bssid="$($dir/helpers/gen_bssid.sh $channel $community)"
79 set wireless.$net\_iface.device="${net}"
80 set wireless.$net\_iface.network="$netrenamed"
81 set wireless.$net\_iface.ssid="$profile_ssid - ch$channel"
82 set wireless.$net\_iface.bssid="$bssid"
87 ssid: $profile_ssid - ch$channel
91 ip4addr="$(uci get meshwizard.netconfig.$net\_ip4addr)"
92 if [ "$type" == "atheros" -a "$vap" == 1 ]; then
94 set wireless.$net\_iface_dhcp="wifi-iface"
95 set wireless.$net\_iface_dhcp.device="$net"
96 set wireless.$net\_iface_dhcp.mode="ap"
97 set wireless.$net\_iface_dhcp.encryption="none"
98 set wireless.$net\_iface_dhcp.network="${netrenamed}dhcp"
99 set wireless.$net\_iface_dhcp.ssid="FF-AP-$ip4addr"
101 echo " + Setting up VAP interface for $net
103 network: ${netrenamed}dhcp
104 ssid: AP-$profile_ssid-$ip4addr"