mirror of
https://github.com/billz/raspap-webgui.git
synced 2023-10-10 13:37:24 +02:00
Showing multiple IPv4/IPv6 addresses.
Signed-off-by: D9ping <D9ping@users.noreply.github.com>
This commit is contained in:
parent
f81bae5f35
commit
6b05989498
@ -26,14 +26,36 @@ function DisplayDashboard(){
|
|||||||
preg_match('/link\/ether ([0-9a-f:]+)/i', $stdoutIpWRepeatedSpaces, $matchesMacAddr ) || $matchesMacAddr[1] = _('No MAC Address Found');
|
preg_match('/link\/ether ([0-9a-f:]+)/i', $stdoutIpWRepeatedSpaces, $matchesMacAddr ) || $matchesMacAddr[1] = _('No MAC Address Found');
|
||||||
$macAddr = $matchesMacAddr[1];
|
$macAddr = $matchesMacAddr[1];
|
||||||
|
|
||||||
preg_match('/inet (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\/(([0-3][0-9]))/i', $stdoutIpWRepeatedSpaces, $matchesIpv4AddrAndSubnet) || $matchesIpv4Addr[1] = _('No IPv4 Address Found');
|
$ipv4Addrs = '';
|
||||||
$ipv4Addr = $matchesIpv4AddrAndSubnet[1];
|
$ipv4Netmasks = '';
|
||||||
$ipv4Netmask = long2ip(-1 << (32 -(int)$matchesIpv4AddrAndSubnet[2]));
|
if (!preg_match_all('/inet (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\/([0-3][0-9])/i', $stdoutIpWRepeatedSpaces, $matchesIpv4AddrAndSubnet)) {
|
||||||
// TODO multiple ipv4 addresses
|
$ipv4Addrs = _('No IPv4 Address Found');
|
||||||
|
} else {
|
||||||
|
$numMatchesIpv4AddrAndSubnet = count($matchesIpv4AddrAndSubnet);
|
||||||
|
for ($i = 1; $i < $numMatchesIpv4AddrAndSubnet; $i += 2) {
|
||||||
|
if ($i > 2) {
|
||||||
|
$ipv4Netmasks .= ' ';
|
||||||
|
$ipv4Addrs .= ' ';
|
||||||
|
}
|
||||||
|
|
||||||
preg_match('/inet6 ([a-f0-9:]+)/i', $stdoutIpWRepeatedSpaces, $matchesIpv4Addr ) || $matchesIpv6Addr[1] = _('No IPv6 Address Found');
|
$ipv4Addrs .= $matchesIpv4AddrAndSubnet[$i][0];
|
||||||
$ipv6Addr = $matchesIpv6Addr[1];
|
$ipv4Netmasks .= long2ip(-1 << (32 -(int)$matchesIpv4AddrAndSubnet[$i+1][0]));
|
||||||
// TODO multiple ipv6 addresses
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$ipv6Addrs = '';
|
||||||
|
if (!preg_match_all('/inet6 ([a-f0-9:]+)/i', $stdoutIpWRepeatedSpaces, $matchesIpv6Addr)) {
|
||||||
|
$ipv6Addrs = _('No IPv6 Address Found');
|
||||||
|
} else {
|
||||||
|
$numMatchesIpv6Addr = count($matchesIpv6Addr);
|
||||||
|
for ($i = 1; $i < $numMatchesIpv6Addr; ++$i) {
|
||||||
|
if ($i > 1) {
|
||||||
|
$ipv6Addrs .= ' ';
|
||||||
|
}
|
||||||
|
|
||||||
|
$ipv6Addrs .= $matchesIpv6Addr[$i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
preg_match('/state (UP|DOWN)/i', $stdoutIpWRepeatedSpaces, $matchesState ) || $matchesState[1] = 'unknown';
|
preg_match('/state (UP|DOWN)/i', $stdoutIpWRepeatedSpaces, $matchesState ) || $matchesState[1] = 'unknown';
|
||||||
$interfaceState = $matchesState[1];
|
$interfaceState = $matchesState[1];
|
||||||
@ -165,9 +187,9 @@ function DisplayDashboard(){
|
|||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<h4><?php echo _("Interface Information"); ?></h4>
|
<h4><?php echo _("Interface Information"); ?></h4>
|
||||||
<div class="info-item"><?php echo _("Interface Name"); ?></div> <?php echo RASPI_WIFI_CLIENT_INTERFACE; ?><br />
|
<div class="info-item"><?php echo _("Interface Name"); ?></div> <?php echo RASPI_WIFI_CLIENT_INTERFACE; ?><br />
|
||||||
<div class="info-item"><?php echo _("IPv4 Address"); ?></div> <?php echo htmlspecialchars($ipv4Addr, ENT_QUOTES); ?><br />
|
<div class="info-item"><?php echo _("IPv4 Address"); ?></div> <?php echo htmlspecialchars($ipv4Addrs, ENT_QUOTES); ?><br />
|
||||||
<div class="info-item"><?php echo _("Subnet Mask"); ?></div> <?php echo htmlspecialchars($ipv4Netmask, ENT_QUOTES); ?><br />
|
<div class="info-item"><?php echo _("Subnet Mask"); ?></div> <?php echo htmlspecialchars($ipv4Netmasks, ENT_QUOTES); ?><br />
|
||||||
<div class="info-item"><?php echo _("IPv6 Address"); ?></div> <?php echo htmlspecialchars($ipv6Addr, ENT_QUOTES); ?><br />
|
<div class="info-item"><?php echo _("IPv6 Address"); ?></div> <?php echo htmlspecialchars($ipv6Addrs, ENT_QUOTES); ?><br />
|
||||||
<div class="info-item"><?php echo _("Mac Address"); ?></div> <?php echo htmlspecialchars($macAddr, ENT_QUOTES); ?><br /><br />
|
<div class="info-item"><?php echo _("Mac Address"); ?></div> <?php echo htmlspecialchars($macAddr, ENT_QUOTES); ?><br /><br />
|
||||||
<h4><?php echo _("Interface Statistics"); ?></h4>
|
<h4><?php echo _("Interface Statistics"); ?></h4>
|
||||||
<div class="info-item"><?php echo _("Received Packets"); ?></div> <?php echo htmlspecialchars($strRxPackets, ENT_QUOTES); ?><br />
|
<div class="info-item"><?php echo _("Received Packets"); ?></div> <?php echo htmlspecialchars($strRxPackets, ENT_QUOTES); ?><br />
|
||||||
|
Loading…
Reference in New Issue
Block a user