From 273bafe0037f685c9af19a41aeff9d6566102309 Mon Sep 17 00:00:00 2001 From: rtrimana Date: Mon, 19 Jun 2017 15:21:22 -0700 Subject: [PATCH] Modifying scripts to let UCI interface accomodate advanced hostapd options, i.e. wpa_psk_file, proxy_arp, and disable_dgaf --- .../files/lib/netifd/wireless/mac80211.sh | 10 ++++++++ .../network/services/hostapd/files/hostapd.sh | 25 +++++++++++++------ 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh index 82c374353e..e9f43d9991 100644 --- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh +++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh @@ -22,6 +22,7 @@ drv_mac80211_init_device_config() { config_add_int beacon_int chanbw frag rts config_add_int rxantenna txantenna antenna_gain txpower distance config_add_boolean noscan ht_coex + config_add_boolean proxy_arp disable_dgaf # Advanced options for Sentinel config_add_array ht_capab config_add_array channels config_add_boolean \ @@ -93,8 +94,17 @@ mac80211_hostapd_setup_base() { [ "$auto_channel" -gt 0 ] && json_get_values channel_list channels json_get_vars noscan ht_coex + json_get_vars proxy_arp disable_dgaf json_get_values ht_capab_list ht_capab + # Option "option proxy_arp ''" + set_default proxy_arp 0 + append base_cfg "proxy_arp=$proxy_arp" "$N" + + # Option "option disable_dgaf ''" + set_default disable_dgaf 0 + append base_cfg "disable_dgaf=$disable_dgaf" "$N" + ieee80211n=1 ht_capab= case "$htmode" in diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh index 04ee9e21b7..534e49e0b4 100644 --- a/package/network/services/hostapd/files/hostapd.sh +++ b/package/network/services/hostapd/files/hostapd.sh @@ -262,13 +262,24 @@ hostapd_set_bss_options() { ;; psk) json_get_vars key wpa_psk_file - if [ ${#key} -lt 8 ]; then - wireless_setup_vif_failed INVALID_WPA_PSK - return 1 - elif [ ${#key} -eq 64 ]; then - append bss_conf "wpa_psk=$key" "$N" - else - append bss_conf "wpa_passphrase=$key" "$N" + # -- SENTINEL CHANGE -- + # We just check if the default key is defined. + # If it is undefined, the script will check if /etc/config/wireless + # specifies "option wpa_psk_file ''" + # e.g. option wpa_psk_file '/etc/config/hostapd-psk'. + # When "option key ''" is defined, together with + # "option wpa_psk_file ''", + # it will be the default key for any devices. + # Both options can be defined independently. + if [ -e "$key" ]; then + if [ ${#key} -lt 8 ]; then + wireless_setup_vif_failed INVALID_WPA_PSK + return 1 + elif [ ${#key} -eq 64 ]; then + append bss_conf "wpa_psk=$key" "$N" + else + append bss_conf "wpa_passphrase=$key" "$N" + fi fi [ -n "$wpa_psk_file" ] && { [ -e "$wpa_psk_file" ] || touch "$wpa_psk_file" -- 2.34.1