diff --git a/emhttp/plugins/dynamix/include/NetworkInfo.php b/emhttp/plugins/dynamix/include/NetworkInfo.php
index d9f2c7a9f..5f6d36897 100644
--- a/emhttp/plugins/dynamix/include/NetworkInfo.php
+++ b/emhttp/plugins/dynamix/include/NetworkInfo.php
@@ -22,8 +22,8 @@ if (isset($_POST['listen'])) {
function port($eth) {
$sys = "/sys/class/net";
- if (substr($eth,0,4)=='wlan') return $eth;
- $x = preg_replace('/[^0-9]/','',$eth) ?: '0';
+ if (substr($eth,0,4) == 'wlan') return $eth;
+ $x = preg_replace('/[^0-9]/', '', $eth) ?: '0';
return file_exists("$sys/br{$x}") ? "br{$x}" : (file_exists("$sys/bond{$x}") ? "bond{$x}" : "eth{$x}");
}
@@ -38,25 +38,25 @@ $error = ""._('Missing')."";
$note = in_array($eth,['eth0','wlan0']) && !$vlan ? $error : $none;
$ipv4 = array_filter(explode(' ',exec("ip -4 -br addr show ".escapeshellarg($port)." scope global 2>/dev/null | awk '{\$1=\$2=\"\";print;exit}' | sed -r 's/ metric [0-9]+//g; s/\/[0-9]+//g'")));
$gw4 = exec("ip -4 route show default dev ".escapeshellarg($port)." 2>/dev/null | awk '{print \$3;exit}'") ?: $note;
-$dns4 = array_filter($ns,function($ns){return strpos($ns,':')===false;});
+$dns4 = array_filter($ns,function($ns){return strpos($ns,':') === false;});
$domain = exec("grep -Pom1 'domain \K.*' /etc/resolv.conf 2>/dev/null") ?: '---';
if ($v6on) {
$ipv6 = array_filter(explode(' ',exec("ip -6 -br addr show ".escapeshellarg($port)." scope global -temporary 2>/dev/null | awk '{\$1=\$2=\"\";print;exit}' | sed -r 's/ metric [0-9]+//g; s/\/[0-9]+//g'")));
$gw6 = exec("ip -6 route show default dev ".escapeshellarg($port)." 2>/dev/null | awk '{print \$3;exit}'") ?: $note;
- $dns6 = array_filter($ns,function($ns){return strpos($ns,':')!==false;});
+ $dns6 = array_filter($ns,function($ns){return strpos($ns,':') !== false;});
}
echo "
";
echo "| | |
";
if ($wlan0) {
- exec("iw wlan0 link | awk '/^\s+(SSID|freq|signal|[rt]x bitrate): /{print \$1,\$2,\$3,\$4,\$5}'",$speed);
+ exec("iw wlan0 link | awk '/^\s+(SSID|freq|signal|[rt]x bitrate): /{print \$1,\$2,\$3,\$4}'", $speed);
if (count($speed) == 5) {
- $network = explode(': ',$speed[0])[1];
- $freq = explode(': ',$speed[1])[1];
- $signal = explode(': ',$speed[2])[1];
- $rxrate = explode(': ',$speed[3])[1];
- $txrate = explode(': ',$speed[4])[1];
+ $network = explode(': ', $speed[0])[1];
+ $freq = explode(': ', $speed[1])[1];
+ $signal = explode(': ', $speed[2])[1];
+ $rxrate = explode(': ', $speed[3])[1];
+ $txrate = explode(': ', $speed[4])[1];
$tmp = '/var/tmp/attr';
$band = [];
$attr = is_readable($tmp) ? (array)parse_ini_file($tmp,true) : [];
@@ -70,6 +70,7 @@ if ($wlan0) {
}
if (!in_array($id, $band)) $band[] = $id;
}
+ sort($band);
$band = '('.implode(', ', $band).')';
} else {
$network = $signal = $rxrate = $txrate = _('Unknown');
diff --git a/emhttp/plugins/dynamix/include/Wireless.php b/emhttp/plugins/dynamix/include/Wireless.php
index 6a271455e..86d11588b 100644
--- a/emhttp/plugins/dynamix/include/Wireless.php
+++ b/emhttp/plugins/dynamix/include/Wireless.php
@@ -45,6 +45,8 @@ function scanWifi($port) {
if (str_starts_with($network, '\\x00')) continue;
if (empty($wlan[$network])) {
$wlan[$network] = $attr;
+ // store MAC address only
+ $wlan[$network][0] = substr($wlan[$network][0],4,17);
} else {
// group radio frequencies
$wlan[$network][1] .= ' '.$attr[1];
@@ -135,10 +137,10 @@ case 'join':
if (is_readable($ssl)) extract(parse_ini_file($ssl));
$token = parse_ini_file($var)['csrf_token'];
$ssid = rawurldecode($_POST['ssid']);
- $drop = $_POST['task']==1;
- $manual = $_POST['task']==3;
- $user = _var($wifi[$ssid],'USERNAME') && isset($cipher,$key,$iv) ? openssl_decrypt($wifi[$ssid]['USERNAME'],$cipher,$key,0,$iv) : _var($wifi[$ssid],'USERNAME');
- $passwd = _var($wifi[$ssid],'PASSWORD') && isset($cipher,$key,$iv) ? openssl_decrypt($wifi[$ssid]['PASSWORD'],$cipher,$key,0,$iv) : _var($wifi[$ssid],'PASSWORD');
+ $drop = $_POST['task'] == 1;
+ $manual = $_POST['task'] == 3;
+ $user = _var($wifi[$ssid],'USERNAME') && isset($cipher, $key, $iv) ? openssl_decrypt($wifi[$ssid]['USERNAME'], $cipher, $key, 0, $iv) : _var($wifi[$ssid],'USERNAME');
+ $passwd = _var($wifi[$ssid],'PASSWORD') && isset($cipher, $key, $iv) ? openssl_decrypt($wifi[$ssid]['PASSWORD'], $cipher, $key, 0, $iv) : _var($wifi[$ssid],'PASSWORD');
$join = _var($wifi[$ssid],'AUTOJOIN','no');
$dhcp4 = _var($wifi[$ssid],'DHCP4','yes');
$dns4 = _var($wifi[$ssid],'DNS4','no');
@@ -157,11 +159,11 @@ case 'join':
$attr2 = $attr[$ssid]['ATTR2'] ?? '';
$attr3 = $attr[$ssid]['ATTR3'] ?? '';
$attr4 = $attr[$ssid]['ATTR4'] ?? '';
- $ieee1 = strpos($attr3,'IEEE')!==false;
- $ieee2 = strpos($safe,'IEEE')!==false;
+ $ieee1 = strpos($attr3,'IEEE') !== false;
+ $ieee2 = strpos($safe,'IEEE') !== false;
$hide0 = ($manual || !$ieee2) && !$ieee1 ? 'hide' : '';
$hide1 = $safe=='OPEN' || !$attr3 ? 'hide' : '';
- $hide2 = $dhcp4=='no' ? '': 'hide';
+ $hide2 = $dhcp4=='no' ? '' : 'hide';
$hide3 = $dns4=='no' ? 'hide' : '';
$hide4 = $dhcp6=='no' ? '' : 'hide';
$hide5 = $dhcp6=='' ? 'hide' : '';