diff --git a/emhttp/plugins/dynamix/include/NetworkInfo.php b/emhttp/plugins/dynamix/include/NetworkInfo.php index 43e844f33..acd53232d 100644 --- a/emhttp/plugins/dynamix/include/NetworkInfo.php +++ b/emhttp/plugins/dynamix/include/NetworkInfo.php @@ -30,13 +30,13 @@ function port($eth) { exec("grep -Po 'nameserver \K\S+' /etc/resolv.conf 2>/dev/null",$ns); $eth = $_POST['port'] ?? ''; $vlan = $_POST['vlan'] ?? ''; +$wlan0 = $eth == 'wlan0'; $port = port($eth).($vlan ? ".$vlan" : ""); $v6on = trim(file_get_contents("/proc/sys/net/ipv6/conf/$port/disable_ipv6"))==='0'; $none = _('None'); $error = ""._('Missing').""; $note = in_array($eth,['eth0','wlan0']) && !$vlan ? $error : $none; $link = _(ucfirst(exec("ethtool $eth 2>/dev/null | awk '$1==\"Link\" {print $3;exit}'")) ?: 'Unknown')." ("._(exec("ethtool $eth 2>/dev/null | grep -Pom1 '^\s+Port: \K.*'") ?: ($eth=='wlan0' ? 'wifi' :'not present')).")"; -$speed = _(preg_replace(['/^(\d+)/','/!/'],['$1 ',''],exec("ethtool $eth 2>/dev/null | awk '$1==\"Speed:\" {print $2;exit}'")) ?: 'Unknown'); $ipv4 = array_filter(explode(' ',exec("ip -4 -br addr show $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 $port 2>/dev/null | awk '{print \$3;exit}'") ?: $note; $dns4 = array_filter($ns,function($ns){return strpos($ns,':')===false;}); @@ -50,23 +50,22 @@ if ($v6on) { echo "
| "._('Interface link').": | $link |
| "._('Interface speed').": | $speed |
| "._('Network').": | $att1 |
| "._('Health').": | $att2 |
| "._('Security').": | $att3 |
| "._('Network').": | $attr1 |
| "._('Health').": | $attr2 |
| "._(ucfirst($name0)).": | $rate0 |
| "._(ucfirst($name1)).": | $rate1 |
| "._('Interface link').": | $link |
| "._('Interface speed').": | $speed |
| "._('IPv4 address').": | $ip |