aboutsummaryrefslogtreecommitdiffstats
path: root/package/kernel/mac80211
diff options
context:
space:
mode:
authorDaniel Golle <daniel@makrotopia.org>2018-05-14 23:55:24 +0200
committerDaniel Golle <daniel@makrotopia.org>2018-05-15 02:05:56 +0200
commit96f4792fdb036ecf5c8417fce6503412b0b27e5f (patch)
tree1f3c8823a7192c5a08e106d284ef8e9e2366469c /package/kernel/mac80211
parentba5ec6b77c94a21bbd78b66c63317a4ff9b62962 (diff)
downloadupstream-96f4792fdb036ecf5c8417fce6503412b0b27e5f.tar.gz
upstream-96f4792fdb036ecf5c8417fce6503412b0b27e5f.tar.bz2
upstream-96f4792fdb036ecf5c8417fce6503412b0b27e5f.zip
mac80211: refactor non-{sae,dfs} mesh initialization
Refactor mesh initialization into a separate function, do some cleaning on the way to make the code more readable. Changes: * Move iw mesh setup to new mac80211_setup_mesh() * fallback on 'ssid' parameter in case 'mesh_id' isn't set * move setting of freq variable to shared code as it is needed for both, the wpa_supplicant and the iw based setup. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Diffstat (limited to 'package/kernel/mac80211')
-rw-r--r--package/kernel/mac80211/Makefile2
-rw-r--r--package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh93
2 files changed, 48 insertions, 47 deletions
diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile
index 2effbf16a5..01a2109660 100644
--- a/package/kernel/mac80211/Makefile
+++ b/package/kernel/mac80211/Makefile
@@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=mac80211
PKG_VERSION:=2017-11-01
-PKG_RELEASE:=7
+PKG_RELEASE:=8
PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources
PKG_HASH:=8437ab7886b988c8152e7a4db30b7f41009e49a3b2cb863edd05da1ecd7eb05a
diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
index 70def756b2..244260a2dd 100644
--- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
+++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
@@ -610,6 +610,51 @@ mac80211_setup_adhoc() {
${keyspec:+keys $keyspec}
}
+mac80211_setup_mesh() {
+ json_get_vars ssid mesh_id mcast_rate
+
+ mcval=
+ [ -n "$mcast_rate" ] && wpa_supplicant_add_rate mcval "$mcast_rate"
+ [ -n "$mesh_id" ] && ssid="$mesh_id"
+
+ case "$htmode" in
+ VHT20|HT20) mesh_htmode=HT20;;
+ HT40*|VHT40)
+ case "$hwmode" in
+ a)
+ case "$(( ($channel / 4) % 2 ))" in
+ 1) mesh_htmode="HT40+" ;;
+ 0) mesh_htmode="HT40-";;
+ esac
+ ;;
+ *)
+ case "$htmode" in
+ HT40+) mesh_htmode="HT40+";;
+ HT40-) mesh_htmode="HT40-";;
+ *)
+ if [ "$channel" -lt 7 ]; then
+ mesh_htmode="HT40+"
+ else
+ mesh_htmode="HT40-"
+ fi
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ VHT80)
+ mesh_htmode="80Mhz"
+ ;;
+ VHT160)
+ mesh_htmode="160Mhz"
+ ;;
+ *) mesh_htmode="NOHT" ;;
+ esac
+ iw dev "$ifname" mesh join "$ssid" freq $freq $mesh_htmode \
+ ${mcval:+mcast-rate $mcval} \
+ beacon-interval $beacon_int
+}
+
mac80211_setup_vif() {
local name="$1"
local failed
@@ -633,57 +678,13 @@ mac80211_setup_vif() {
case "$mode" in
mesh)
- json_get_vars key
wireless_vif_parse_encryption
+ freq="$(get_freq "$phy" "$channel")"
if [ "$wpa" -gt 0 -o "$auto_channel" -gt 0 ] || chan_is_dfs "$phy" "$channel"; then
- freq="$(get_freq "$phy" "$channel")"
mac80211_setup_supplicant || failed=1
else
- json_get_vars mesh_id mcast_rate
-
- mcval=
- [ -n "$mcast_rate" ] && wpa_supplicant_add_rate mcval "$mcast_rate"
-
- case "$htmode" in
- VHT20|HT20) mesh_htmode=HT20;;
- HT40*|VHT40)
- case "$hwmode" in
- a)
- case "$(( ($channel / 4) % 2 ))" in
- 1) mesh_htmode="HT40+" ;;
- 0) mesh_htmode="HT40-";;
- esac
- ;;
- *)
- case "$htmode" in
- HT40+) mesh_htmode="HT40+";;
- HT40-) mesh_htmode="HT40-";;
- *)
- if [ "$channel" -lt 7 ]; then
- mesh_htmode="HT40+"
- else
- mesh_htmode="HT40-"
- fi
- ;;
- esac
- ;;
- esac
- ;;
- VHT80)
- mesh_htmode="80Mhz"
- ;;
- VHT160)
- mesh_htmode="160Mhz"
- ;;
- *) mesh_htmode="NOHT" ;;
- esac
-
- freq="$(get_freq "$phy" "$channel")"
- iw dev "$ifname" mesh join "$mesh_id" freq $freq $mesh_htmode \
- ${mcval:+mcast-rate $mcval} \
- beacon-interval $beacon_int
+ mac80211_setup_mesh
fi
-
for var in $MP_CONFIG_INT $MP_CONFIG_BOOL $MP_CONFIG_STRING; do
json_get_var mp_val "$var"
[ -n "$mp_val" ] && iw dev "$ifname" set mesh_param "$var" "$mp_val"