mirror of
https://git.openwrt.org/openwrt/openwrt.git
synced 2026-05-05 09:56:12 +02:00
wifi-scripts: ucode: simplify wpa_pairwise default selection
parse_encryption() stashed a preliminary wpa_pairwise value in a local wpa3_pairwise variable, cleared it per auth_type, then let a switch default either copy it back or special-case wpa3-192. The result was three separate places where wpa_pairwise was clobbered and behavior that was awkward to trace when the explicit cipher suffix (encryption[1]) and the auth_type disagreed. Replace the scaffolding with a single block at the end of parse_encryption() that only assigns wpa_pairwise via ??= when no earlier branch (explicit cipher suffix, wpa3-192, or sae-compat) has already set one: no WPA -> null 60 GHz (hw_mode=ad) -> GCMP HE or EHT htmode -> GCMP-256 CCMP everything else -> CCMP wpa3-192 now sets wpa_pairwise='GCMP-256' directly in its switch case, so the final default block can stay short. No functional change for existing encryption values. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> Link: https://github.com/openwrt/openwrt/pull/23009 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
This commit is contained in:
parent
588330e92b
commit
1f86f4e471
@ -17,16 +17,8 @@ export function parse_encryption(config, dev_config) {
|
||||
break;
|
||||
}
|
||||
|
||||
config.wpa_pairwise = null;
|
||||
if (config.wpa)
|
||||
config.wpa_pairwise = (config.hw_mode == 'ad') ? 'GCMP' : 'CCMP';
|
||||
|
||||
config.auth_type = encryption[0] ?? 'none';
|
||||
|
||||
let wpa3_pairwise = config.wpa_pairwise;
|
||||
if (wildcard(dev_config?.htmode, 'EHT*') || wildcard(dev_config?.htmode, 'HE*'))
|
||||
wpa3_pairwise = 'GCMP-256 ' + wpa3_pairwise;
|
||||
|
||||
switch(config.auth_type) {
|
||||
case 'owe':
|
||||
config.auth_type = 'owe';
|
||||
@ -38,6 +30,7 @@ export function parse_encryption(config, dev_config) {
|
||||
|
||||
case 'wpa3-192':
|
||||
config.auth_type = 'eap192';
|
||||
config.wpa_pairwise = 'GCMP-256';
|
||||
break;
|
||||
|
||||
case 'wpa3-mixed':
|
||||
@ -52,7 +45,6 @@ export function parse_encryption(config, dev_config) {
|
||||
case 'psk2':
|
||||
case 'psk-mixed':
|
||||
config.auth_type = 'psk';
|
||||
wpa3_pairwise = null;
|
||||
break;
|
||||
|
||||
case 'sae':
|
||||
@ -69,12 +61,6 @@ export function parse_encryption(config, dev_config) {
|
||||
case 'wpa2':
|
||||
case 'wpa-mixed':
|
||||
config.auth_type = 'eap';
|
||||
wpa3_pairwise = null;
|
||||
break;
|
||||
|
||||
default:
|
||||
config.wpa_pairwise = null;
|
||||
wpa3_pairwise = null;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -106,20 +92,16 @@ export function parse_encryption(config, dev_config) {
|
||||
case 'gcmp':
|
||||
config.wpa_pairwise = 'GCMP';
|
||||
break;
|
||||
|
||||
default:
|
||||
if (config.encryption == 'wpa3-192') {
|
||||
config.wpa_pairwise = 'GCMP-256';
|
||||
break;
|
||||
}
|
||||
|
||||
if (!wpa3_pairwise)
|
||||
break;
|
||||
|
||||
config.wpa_pairwise = wpa3_pairwise;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!config.wpa)
|
||||
config.wpa_pairwise ??= null;
|
||||
else if (config.hw_mode == 'ad')
|
||||
config.wpa_pairwise ??= 'GCMP';
|
||||
else if (wildcard(dev_config?.htmode, 'EHT*') || wildcard(dev_config?.htmode, 'HE*'))
|
||||
config.wpa_pairwise ??= 'GCMP-256 CCMP';
|
||||
else
|
||||
config.wpa_pairwise ??= 'CCMP';
|
||||
};
|
||||
|
||||
export function wpa_key_mgmt(config) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user