]> git.ipfire.org Git - people/ms/network.git/blobdiff - src/functions/functions.hostapd
wireless-ap: Allow to enable/disable 802.11w Management Frame Protection
[people/ms/network.git] / src / functions / functions.hostapd
index 245b4cf87d7f9d8ce636ba70acc7509d2b853d97..bf0c5fc9ee0c6928cea4e19588bf4517e29328f6 100644 (file)
@@ -41,6 +41,7 @@ hostapd_config_write() {
        local encryption
        local environment="${WIRELESS_DEFAULT_ENVIRONMENT}"
        local key
+       local mfp="off"
        local mode
        local ssid
        local wmm="1"
@@ -68,6 +69,9 @@ hostapd_config_write() {
                        --key=*)
                                key=$(cli_get_val "${1}")
                                ;;
+                       --mfp=*)
+                               mfp="$(cli_get_val "${1}")"
+                               ;;
                        --mode=*)
                                mode=$(cli_get_val "${1}")
 
@@ -133,6 +137,12 @@ hostapd_config_write() {
                return ${EXIT_ERROR}
        fi
 
+       # Management Frame Proection
+       if ! isbool mfp; then
+               error "Invalid value for --mfp: ${mfp}"
+               return ${EXIT_ERROR}
+       fi
+
        # 802.11ac/n flags
        local ieee80211ac
        local ieee80211n
@@ -325,6 +335,13 @@ hostapd_config_write() {
                print "vht_oper_chwidth=${vht_oper_chwidth}"
 
                print
+
+               # 802.11w - Management Frame Protection (MFP)
+               if enabled mfp; then
+                       print "ieee80211w=2" # required
+               else
+                       print "ieee80211w=0"
+               fi
        ) >> ${file}
 
        # Control interface.