developer | 356ecec | 2022-11-14 10:25:04 +0800 | [diff] [blame] | 1 | From ed69c1fdd2d70538644460e299d5772a5528f3d9 Mon Sep 17 00:00:00 2001 |
| 2 | From: Peter Chiu <chui-hao.chiu@mediatek.com> |
| 3 | Date: Mon, 14 Nov 2022 14:44:47 +0800 |
| 4 | Subject: [PATCH] master mac80211 generate hostapd setting from ap cap |
| 5 | |
| 6 | Change-Id: I22cef6b7e1a99b1d589270c136a2e74e7a385e79 |
| 7 | --- |
| 8 | package/kernel/mac80211/Makefile | 3 +++ |
| 9 | .../files/lib/netifd/wireless/mac80211.sh | 3 --- |
| 10 | .../kernel/mac80211/files/lib/wifi/mac80211.sh | 15 ++++++++++++++- |
| 11 | 3 files changed, 17 insertions(+), 4 deletions(-) |
| 12 | |
developer | ce9e509 | 2022-11-10 22:41:59 +0800 | [diff] [blame] | 13 | diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile |
developer | 356ecec | 2022-11-14 10:25:04 +0800 | [diff] [blame] | 14 | index ec35bf67..ea7bf6e9 100644 |
developer | ce9e509 | 2022-11-10 22:41:59 +0800 | [diff] [blame] | 15 | --- a/package/kernel/mac80211/Makefile |
| 16 | +++ b/package/kernel/mac80211/Makefile |
| 17 | @@ -19,6 +19,7 @@ PKG_SOURCE:=backports-$(PKG_VERSION).tar.xz |
| 18 | PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/backports-$(PKG_VERSION) |
| 19 | PKG_BUILD_PARALLEL:=1 |
developer | 356ecec | 2022-11-14 10:25:04 +0800 | [diff] [blame] | 20 | |
developer | ce9e509 | 2022-11-10 22:41:59 +0800 | [diff] [blame] | 21 | +SOURCE_PATH:=./src |
| 22 | PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name> |
developer | 356ecec | 2022-11-14 10:25:04 +0800 | [diff] [blame] | 23 | |
developer | ce9e509 | 2022-11-10 22:41:59 +0800 | [diff] [blame] | 24 | PKG_DRIVERS = \ |
developer | 356ecec | 2022-11-14 10:25:04 +0800 | [diff] [blame] | 25 | @@ -296,6 +297,8 @@ define Build/Prepare |
| 26 | mkdir -p $(PKG_BUILD_DIR) |
| 27 | $(PKG_UNPACK) |
| 28 | $(Build/Patch) |
| 29 | + $(CP) $(SOURCE_PATH)/net $(PKG_BUILD_DIR) 2>/dev/null || : |
| 30 | + $(CP) $(SOURCE_PATH)/include $(PKG_BUILD_DIR) 2>/dev/null || : |
| 31 | rm -rf \ |
| 32 | $(PKG_BUILD_DIR)/include/linux/ssb \ |
| 33 | $(PKG_BUILD_DIR)/include/linux/bcma \ |
developer | 20d6771 | 2022-03-02 14:09:32 +0800 | [diff] [blame] | 34 | diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh |
developer | 8d77be3 | 2022-10-20 15:08:25 +0800 | [diff] [blame] | 35 | index ed280521..a0550057 100644 |
developer | 20d6771 | 2022-03-02 14:09:32 +0800 | [diff] [blame] | 36 | --- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh |
| 37 | +++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh |
developer | 8d77be3 | 2022-10-20 15:08:25 +0800 | [diff] [blame] | 38 | @@ -144,9 +144,6 @@ mac80211_hostapd_setup_base() { |
| 39 | json_get_values ht_capab_list ht_capab |
developer | 20d6771 | 2022-03-02 14:09:32 +0800 | [diff] [blame] | 40 | json_get_values channel_list channels |
| 41 | |
| 42 | - [ "$auto_channel" = 0 ] && [ -z "$channel_list" ] && \ |
| 43 | - channel_list="$channel" |
| 44 | - |
developer | 9b3248d | 2022-07-06 00:44:05 +0800 | [diff] [blame] | 45 | [ "$min_tx_power" -gt 0 ] && append base_cfg "min_tx_power=$min_tx_power" |
developer | 20d6771 | 2022-03-02 14:09:32 +0800 | [diff] [blame] | 46 | |
developer | 9b3248d | 2022-07-06 00:44:05 +0800 | [diff] [blame] | 47 | set_default noscan 0 |
developer | 9b3248d | 2022-07-06 00:44:05 +0800 | [diff] [blame] | 48 | diff --git a/package/kernel/mac80211/files/lib/wifi/mac80211.sh b/package/kernel/mac80211/files/lib/wifi/mac80211.sh |
developer | 8d77be3 | 2022-10-20 15:08:25 +0800 | [diff] [blame] | 49 | index 3ecd9322..438bf929 100644 |
developer | e2597ba | 2022-06-24 13:09:16 +0800 | [diff] [blame] | 50 | --- a/package/kernel/mac80211/files/lib/wifi/mac80211.sh |
| 51 | +++ b/package/kernel/mac80211/files/lib/wifi/mac80211.sh |
developer | 8d77be3 | 2022-10-20 15:08:25 +0800 | [diff] [blame] | 52 | @@ -120,6 +120,13 @@ get_band_defaults() { |
developer | e2597ba | 2022-06-24 13:09:16 +0800 | [diff] [blame] | 53 | mode_band="$band" |
| 54 | channel="$chan" |
| 55 | htmode="$mode" |
| 56 | + if [ "$band" = "6g" ] |
| 57 | + then |
| 58 | + encryption=sae |
| 59 | + key=12345678 |
| 60 | + else |
| 61 | + encryption=none |
| 62 | + fi |
| 63 | done |
| 64 | } |
| 65 | |
developer | 8d77be3 | 2022-10-20 15:08:25 +0800 | [diff] [blame] | 66 | @@ -162,6 +169,8 @@ detect_mac80211() { |
developer | e2597ba | 2022-06-24 13:09:16 +0800 | [diff] [blame] | 67 | channel="" |
| 68 | htmode="" |
| 69 | ht_capab="" |
| 70 | + encryption="" |
| 71 | + key="" |
| 72 | |
| 73 | get_band_defaults "$dev" |
| 74 | |
developer | 8d77be3 | 2022-10-20 15:08:25 +0800 | [diff] [blame] | 75 | @@ -206,8 +215,12 @@ detect_mac80211() { |
| 76 | set wireless.default_${name}.network=lan |
| 77 | set wireless.default_${name}.mode=ap |
| 78 | set wireless.default_${name}.ssid=OpenWrt |
| 79 | - set wireless.default_${name}.encryption=none |
| 80 | + set wireless.default_${name}.encryption=${encryption} |
| 81 | + |
developer | e2597ba | 2022-06-24 13:09:16 +0800 | [diff] [blame] | 82 | EOF |
| 83 | + [ -n "$key" ] && { |
developer | 8d77be3 | 2022-10-20 15:08:25 +0800 | [diff] [blame] | 84 | + uci -q set wireless.default_${name}.key=${key} |
developer | e2597ba | 2022-06-24 13:09:16 +0800 | [diff] [blame] | 85 | + } |
| 86 | uci -q commit wireless |
developer | 8d77be3 | 2022-10-20 15:08:25 +0800 | [diff] [blame] | 87 | done |
| 88 | } |
developer | 20d6771 | 2022-03-02 14:09:32 +0800 | [diff] [blame] | 89 | -- |
developer | 8d77be3 | 2022-10-20 15:08:25 +0800 | [diff] [blame] | 90 | 2.18.0 |
developer | 20d6771 | 2022-03-02 14:09:32 +0800 | [diff] [blame] | 91 | |