summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--contrib/package/meshwizard/Makefile2
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_wifi.sh12
-rwxr-xr-xcontrib/package/meshwizard/files/usr/bin/meshwizard/helpers/supports_vap.sh35
3 files changed, 38 insertions, 11 deletions
diff --git a/contrib/package/meshwizard/Makefile b/contrib/package/meshwizard/Makefile
index a88113af6b..3aaddec256 100644
--- a/contrib/package/meshwizard/Makefile
+++ b/contrib/package/meshwizard/Makefile
@@ -4,7 +4,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=meshwizard
-PKG_RELEASE:=0.0.8-2
+PKG_RELEASE:=0.0.8-3
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_wifi.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_wifi.sh
index 001754c12f..9d1bce3e6c 100755
--- a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_wifi.sh
+++ b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/setup_wifi.sh
@@ -80,17 +80,9 @@ uci_commitverbose "Setup wifi interface for $netrenamed" wireless
## VAP
ip4addr="$(uci get meshwizard.netconfig.$net\_ip4addr)"
+# check if this hardware supports VAPs
supports_vap="0"
-if [ "$type" = "atheros" ]; then
- supports_vap="1"
-elif [ "$type" = "mac80211" ]; then
- # get driver in use
- netindex="$(echo $net |sed 's/[a-zA-z]*//')"
- driver="$(basename $(ls -l /sys/class/net/wlan${netindex}/device/driver/module | sed -ne 's/.* -> //p'))"
- if [ "$driver" = "ath9k" -o "$driver" = "ath5k" ]; then
- supports_vap="1"
- fi
-fi
+$dir/helpers/supports_vap.sh $net $type && supports_vap=1
if [ "$supports_vap" == "1" -a "$vap" == 1 ]; then
uci batch <<- EOF
diff --git a/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/supports_vap.sh b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/supports_vap.sh
new file mode 100755
index 0000000000..045ea976e0
--- /dev/null
+++ b/contrib/package/meshwizard/files/usr/bin/meshwizard/helpers/supports_vap.sh
@@ -0,0 +1,35 @@
+#!/bin/sh
+# checks if a given device can be used for a VAP interface (1 adhoc + 1 ap)
+dev="$1"
+type="$2"
+
+
+if [ -z "$dev" -o -z "$type" ]; then
+ exit 1
+fi
+
+if [ "$type" = "atheros" ]; then
+ exit 0
+elif [ "$type" = "mac80211" ]; then
+ # not hostapd[-mini], no VAP
+ if [ ! -x /usr/sbin/hostapd ]; then
+ echo "WARNING: hostapd[-mini] is required to be able to use VAP with mac80211."
+ exit 1
+ fi
+ # get driver in use
+ netindex="$(echo $dev |sed 's/[a-zA-z]*//')"
+ if [ -d /sys/class/net/wlan${netindex}/device/driver/module ]; then
+ driver="$(basename $(ls -l /sys/class/net/wlan${netindex}/device/driver/module | sed -ne 's/.* -> //p'))"
+ if [ "$driver" = "ath9k" -o "$driver" = "ath5k" ]; then
+ exit 0
+ else
+ exit 1
+ fi
+ else
+ exit 1
+ fi
+else
+ exit 1
+fi
+
+