};
let path = `/sys/class/ieee80211/phy${iface.wiphy}/device/`;
- if (stat(path) + 'vendor') {
+ if (stat(path + 'vendor')) {
let data = [];
for (let lookup in [ 'vendor', 'device', 'subsystem_vendor', 'subsystem_device' ])
push(data, trim(readfile(path + lookup), '\n'));
}
function format_frequency(freq) {
- if (!freq)
- return 'unknown';
- freq = '' + freq;
- return substr(freq, 0, 1) + '.' + substr(freq, 1);
+ return freq ? sprintf('%.03f', freq / 1000.0) : 'unknown';
}
function format_rate(rate) {
- if (!rate)
- return 'unknown';
- return '' + (rate / 10) + '.' + (rate % 10);
+ return rate ? sprintf('%.01f', rate / 10.0) : 'unknown';
}
function format_mgmt_key(key) {
for (let k = 0; k < ip; k++)
res *= 10;
for (let k = 0; k < fp; k++)
- res *= 1.25892541179;
+ res *= LOG10_MAGIC;
return int(res);
}
case 48:
cell.crypto = {
- group: rsn_cipher[+ord(ie.data, 5)] ?? '',
+ group: rsn_cipher[ord(ie.data, 5)] ?? '',
pair: [],
key_mgmt: [],
};
let offset = 6;
- let count = +ord(ie.data, offset);
+ let count = ord(ie.data, offset);
offset += 2;
for (let i = 0; i < count; i++) {
- let key = rsn_cipher[+ord(ie.data, offset + 3)];
+ let key = rsn_cipher[ord(ie.data, offset + 3)];
if (key)
push(cell.crypto.pair, key);
offset += 4;
}
- count = +ord(ie.data, offset);
+ count = ord(ie.data, offset);
offset += 2;
for (let i = 0; i < count; i++) {
'use strict';
import * as libuci from 'uci';
+import { md5 } from 'digest';
import * as fs from 'fs';
import { append, append_raw, append_value, append_vars, comment, push_config, set_default, touch_file } from 'wifi.common';
config.vlan_possible = 1;
if (config.fils) {
- set_default(config, 'erp_domain', substr(digest.md5(config.ssid), 0, 4));
+ set_default(config, 'erp_domain', substr(md5(config.ssid), 0, 4));
set_default(config, 'fils_realm', config.erp_domain);
set_default(config, 'erp_send_reauth_start', 1);
- set_default(config, 'fils_cache_id', substr(digest.md5(config.fils_realm), 0, 4));
+ set_default(config, 'fils_cache_id', substr(md5(config.fils_realm), 0, 4));
}
if (!config.eap_server) {
if (!config.ieee80211r || config.wpa < 2)
return;
- set_default(config, 'mobility_domain', substr(digest.md5(config.ssid), 0, 4));
+ set_default(config, 'mobility_domain', substr(md5(config.ssid), 0, 4));
set_default(config, 'ft_psk_generate_local', config.auth_type == 'psk');
set_default(config, 'ft_iface', config.network_ifname);
if (!config.auth_secret && !config.key)
netifd.setup_failed('FT_KEY_CANT_BE_DERIVED');
- let ft_key = digest.md5(`${mobility_domain}/${auth_secret ?? key}`);
+ let ft_key = md5(`${mobility_domain}/${auth_secret ?? key}`);
set_default(config, 'r0kh', 'ff:ff:ff:ff:ff:ff,*,' + ft_key);
set_default(config, 'r1kh', '00:00:00:00:00:00,00:00:00:00:00:00,' + ft_key);