# TrutzBox hostapd AP configuration — rendered by trutz-backend from this template.
# Do not edit the rendered file (/etc/hostapd/trutz-<iface>.conf) by hand; the backend
# overwrites it on every WLAN settings change.
#
# Why hostapd (again): NetworkManager/wpa_supplicant can only run the AP in ONE
# key management mode — either WPA2 or WPA3. Only hostapd can offer both at once
# (wpa_key_mgmt=WPA-PSK SAE), which is what "WPA2 + WPA3" in the UI promises.
# The security values (wpaKeyMgmt/ieee80211w/saeRequireMfp) are computed in
# trutz-backend src/utils/wlan-security.ts from the UI selection and the card's
# real capabilities — same contract as the nm-connection-* templates.
interface={{iface}}
bridge=br0
driver=nl80211
ctrl_interface=/var/run/hostapd
ctrl_interface_group=0
{{#if acs}}channel=acs_survey
acs_num_scans=5{{else}}channel={{channel}}{{/if}}
hw_mode={{hwMode}}
require_ht=0
macaddr_acl=0
auth_algs=3
eapol_key_index_workaround=0
eap_server=0
utf8_ssid=1
# Triple-stash (three braces): double-brace output is HTML-escaped by the engine —
# an SSID like "Müller&Co" would otherwise beacon as "Müller&amp;Co".
# NOTE: comments in this file are parsed by Handlebars too — never put literal
# double braces in a comment; that exact mistake once broke the backend switch.
ssid2="{{{ssid}}}"
wpa_passphrase={{{passphrase}}}
ignore_broadcast_ssid={{#if hide}}1{{else}}0{{/if}}

### hostapd event logger
logger_syslog=-1
logger_syslog_level=2
logger_stdout=-1
logger_stdout_level=2

### IEEE 802.11i
wpa=2
wpa_key_mgmt={{wpaKeyMgmt}}
wpa_pairwise=CCMP
rsn_pairwise=CCMP
eapol_version=1
# 0=off, 1=optional (transition mode), 2=required (WPA3-only)
ieee80211w={{ieee80211w}}
{{#if saeRequireMfp}}
# In transition mode PMF stays optional for WPA2 clients, but SAE clients must use it
# (WPA3 mandates PMF) — without this a downgrade attack window opens.
sae_require_mfp=1
{{/if}}

### Regulatory — follows the location selected in the UI (the old era hard-coded DE)
country_code={{countryCode}}
ieee80211d=1
ieee80211h=1

### IEEE 802.11n
ieee80211n=1
ht_capab={{htCapab}}
{{#if vht}}

### IEEE 802.11ac — only rendered when the card actually supports VHT; on a
### non-VHT card (AR928X) these lines would abort hostapd startup.
ieee80211ac=1
vht_oper_chwidth={{vhtChwidth}}
vht_capab={{vhtCapab}}
vht_oper_centr_freq_seg0_idx={{vhtCenterIdx}}
{{/if}}

### WMM
wmm_enabled=1
uapsd_advertisement_enabled=1
wmm_ac_bk_cwmin=4
wmm_ac_bk_cwmax=10
wmm_ac_bk_aifs=7
wmm_ac_bk_txop_limit=0
wmm_ac_bk_acm=0
wmm_ac_be_aifs=3
wmm_ac_be_cwmin=4
wmm_ac_be_cwmax=10
wmm_ac_be_txop_limit=0
wmm_ac_be_acm=0
wmm_ac_vi_aifs=2
wmm_ac_vi_cwmin=3
wmm_ac_vi_cwmax=4
wmm_ac_vi_txop_limit=94
wmm_ac_vi_acm=0
wmm_ac_vo_aifs=2
wmm_ac_vo_cwmin=2
wmm_ac_vo_cwmax=3
wmm_ac_vo_txop_limit=47
wmm_ac_vo_acm=0

### TX queue parameters
tx_queue_data3_aifs=7
tx_queue_data3_cwmin=15
tx_queue_data3_cwmax=1023
tx_queue_data3_burst=0
tx_queue_data2_aifs=3
tx_queue_data2_cwmin=15
tx_queue_data2_cwmax=63
tx_queue_data2_burst=0
tx_queue_data1_aifs=1
tx_queue_data1_cwmin=7
tx_queue_data1_cwmax=15
tx_queue_data1_burst=3.0
tx_queue_data0_aifs=1
tx_queue_data0_cwmin=3
tx_queue_data0_cwmax=7
tx_queue_data0_burst=1.5
