wifi-scripts: fix ucode erp_domain and fils_cache_id values

The ucode path generates different erp_domain and fils_cache_id
values than the legacy shell path due to three mismatches:

1. erp_domain md5 input missing trailing newline (echo adds \n)
2. erp_domain output truncated to 4 chars instead of 8 (shell
   uses head -c 8)
3. fils_cache_id md5 input missing trailing newline
4. erp_domain missing fallback to mobility_domain

Same bug pattern as mobility_domain fixed in commit b1dc2736db.

Fixes: #21768
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Joshua Klinesmith <joshuaklinesmith@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/22677
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
This commit is contained in:
Joshua Klinesmith 2026-03-29 16:19:40 -04:00 committed by Hauke Mehrtens
parent dc597eeb79
commit b178e05d9b

View File

@ -159,10 +159,11 @@ function iface_auth_type(config) {
config.vlan_possible = 1;
if (config.fils) {
set_default(config, 'erp_domain', substr(md5(config.ssid), 0, 4));
set_default(config, 'erp_domain', config.mobility_domain);
set_default(config, 'erp_domain', substr(md5(config.ssid + '\n'), 0, 8));
set_default(config, 'fils_realm', config.erp_domain);
set_default(config, 'erp_send_reauth_start', 1);
set_default(config, 'fils_cache_id', substr(md5(config.fils_realm), 0, 4));
set_default(config, 'fils_cache_id', substr(md5(config.fils_realm + '\n'), 0, 4));
}
if (!config.eap_server) {