var mode = radioNet.getActiveMode(),
bssid = radioNet.getActiveBSSID(),
channel = radioNet.getChannel(),
- disabled = (radioNet.get('disabled') == '1'),
+ disabled = (radioNet.get('disabled') == '1' || uci.get('wireless', radioNet.getWifiDeviceName(), 'disabled') == '1'),
is_assoc = (bssid && bssid != '00:00:00:00:00:00' && channel && mode != 'Unknown' && !disabled),
changecount = count_changes(radioNet.getName()),
status_text = null;
];
}
else {
- var isDisabled = (inst.get('disabled') == '1');
+ var isDisabled = (inst.get('disabled') == '1' ||
+ uci.get('wireless', inst.getWifiDeviceName(), 'disabled') == '1');
btns = [
E('button', {
};
- encr.value('none', _('No Encryption'));
- encr.value('wep-open', _('WEP Open System'));
- encr.value('wep-shared', _('WEP Shared Key'));
+ var crypto_modes = [];
if (hwtype == 'mac80211') {
var has_supplicant = L.hasSystemFeature('wpasupplicant'),
if (has_hostapd || has_supplicant) {
- encr.value('psk', 'WPA-PSK');
- encr.value('psk2', 'WPA2-PSK');
- encr.value('psk-mixed', 'WPA-PSK/WPA2-PSK Mixed Mode');
+ crypto_modes.push(['psk2', 'WPA2-PSK', 33]);
+ crypto_modes.push(['psk-mixed', 'WPA-PSK/WPA2-PSK Mixed Mode', 22]);
+ crypto_modes.push(['psk', 'WPA-PSK', 21]);
}
else {
encr.description = _('WPA-Encryption requires wpa_supplicant (for client mode) or hostapd (for AP and ad-hoc mode) to be installed.');
}
if (has_ap_sae || has_sta_sae) {
- encr.value('sae', 'WPA3-SAE');
- encr.value('sae-mixed', 'WPA2-PSK/WPA3-SAE Mixed Mode');
+ crypto_modes.push(['sae', 'WPA3-SAE', 31]);
+ crypto_modes.push(['sae-mixed', 'WPA2-PSK/WPA3-SAE Mixed Mode', 30]);
}
if (has_ap_eap || has_sta_eap) {
- encr.value('wpa', 'WPA-EAP');
- encr.value('wpa2', 'WPA2-EAP');
+ crypto_modes.push(['wpa2', 'WPA2-EAP', 32]);
+ crypto_modes.push(['wpa', 'WPA-EAP', 20]);
}
if (has_ap_owe || has_sta_owe) {
- encr.value('owe', 'OWE');
+ crypto_modes.push(['owe', 'OWE', 1]);
}
encr.crypto_support = {
};
}
else if (hwtype == 'broadcom') {
- encr.value('psk', 'WPA-PSK');
- encr.value('psk2', 'WPA2-PSK');
- encr.value('psk+psk2', 'WPA-PSK/WPA2-PSK Mixed Mode');
+ crypto_modes.push(['psk2', 'WPA2-PSK', 33]);
+ crypto_modes.push(['psk+psk2', 'WPA-PSK/WPA2-PSK Mixed Mode', 22]);
+ crypto_modes.push(['psk', 'WPA-PSK', 21]);
+ }
+
+ crypto_modes.push(['wep-open', _('WEP Open System'), 11]);
+ crypto_modes.push(['wep-shared', _('WEP Shared Key'), 10]);
+ crypto_modes.push(['none', _('No Encryption'), 0]);
+
+ crypto_modes.sort(function(a, b) { return b[2] - a[2] });
+
+ for (var i = 0; i < crypto_modes.length; i++) {
+ var security_level = (crypto_modes[i][2] >= 30) ? _('strong security')
+ : (crypto_modes[i][2] >= 20) ? _('medium security')
+ : (crypto_modes[i][2] >= 10) ? _('weak security') : _('open network');
+
+ encr.value(crypto_modes[i][0], '%s (%s)'.format(crypto_modes[i][1], security_level));
}
o.write = function(section_id, value) {
uci.set('wireless', section_id, 'key', value);
uci.unset('wireless', section_id, 'key1');
+ uci.unset('wireless', section_id, 'key2');
+ uci.unset('wireless', section_id, 'key3');
+ uci.unset('wireless', section_id, 'key4');
};
o.cfgvalue = function(section_id) {
var slot = +uci.get('wireless', section_id, 'key');
- return (slot >= 1 && slot <= 4) ? slot : 1;
+ return (slot >= 1 && slot <= 4) ? String(slot) : '';
};
o.write = function(section_id, value) {
// ieee802.11w options
if (L.hasSystemFeature('hostapd', '11w')) {
o = ss.taboption('encryption', form.ListValue, 'ieee80211w', _('802.11w Management Frame Protection'), _("Requires the 'full' version of wpad/hostapd and support from the wifi driver <br />(as of Jan 2019: ath9k, ath10k, mwlwifi and mt76)"));
- o.default = '';
- o.value('', _('Disabled (default)'));
+ o.value('', _('Disabled'));
o.value('1', _('Optional'));
o.value('2', _('Required'));
o.depends({ mode: 'ap', encryption: 'wpa2' });
o.depends({ mode: 'sta-wds', encryption: 'sae' });
o.depends({ mode: 'sta-wds', encryption: 'sae-mixed' });
o.depends({ mode: 'sta-wds', encryption: 'owe' });
+ o.defaults = {
+ '2': [{ encryption: 'sae' }, { encryption: 'owe' }],
+ '1': [{ encryption: 'sae-mixed'}],
+ '': []
+ };
o = ss.taboption('encryption', form.Value, 'ieee80211w_max_timeout', _('802.11w maximum timeout'), _('802.11w Association SA Query maximum timeout'));
o.depends('ieee80211w', '1');