mirror of
https://github.com/billz/raspap-webgui.git
synced 2023-10-10 13:37:24 +02:00
fix display of multiple ipv4 addresses, netmasks on dashboard
This commit is contained in:
parent
4a5a39c2bc
commit
c2ed6c6e02
@ -29,19 +29,19 @@ function DisplayDashboard()
|
|||||||
|
|
||||||
$ipv4Addrs = '';
|
$ipv4Addrs = '';
|
||||||
$ipv4Netmasks = '';
|
$ipv4Netmasks = '';
|
||||||
if (!preg_match_all('/inet (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\/([0-3][0-9])/i', $stdoutIpWRepeatedSpaces, $matchesIpv4AddrAndSubnet)) {
|
if (!preg_match_all('/inet (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\/([0-3][0-9])/i', $stdoutIpWRepeatedSpaces, $matchesIpv4AddrAndSubnet, PREG_SET_ORDER)) {
|
||||||
$ipv4Addrs = _('No IPv4 Address Found');
|
$ipv4Addrs = _('No IPv4 Address Found');
|
||||||
} else {
|
} else {
|
||||||
$numMatchesIpv4AddrAndSubnet = count($matchesIpv4AddrAndSubnet);
|
foreach ($matchesIpv4AddrAndSubnet as $inet) {
|
||||||
for ($i = 1; $i < $numMatchesIpv4AddrAndSubnet; $i += 2) {
|
$address = $inet[1];
|
||||||
if ($i > 2) {
|
$suffix = (int) $inet[2];
|
||||||
$ipv4Netmasks .= ' ';
|
$netmask = long2ip(-1 << (32 - $suffix));
|
||||||
$ipv4Addrs .= ' ';
|
|
||||||
}
|
|
||||||
|
|
||||||
$ipv4Addrs .= $matchesIpv4AddrAndSubnet[$i][0];
|
$ipv4Addrs .= " $address";
|
||||||
$ipv4Netmasks .= long2ip(-1 << (32 -(int)$matchesIpv4AddrAndSubnet[$i+1][0]));
|
$ipv4Netmasks .= " $netmask";
|
||||||
}
|
}
|
||||||
|
$ipv4Addrs = trim($ipv4Addrs);
|
||||||
|
$ipv4Netmasks = trim($ipv4Netmasks);
|
||||||
}
|
}
|
||||||
|
|
||||||
$ipv6Addrs = '';
|
$ipv6Addrs = '';
|
||||||
|
Loading…
Reference in New Issue
Block a user