1
0
mirror of https://github.com/billz/raspap-webgui.git synced 2023-10-10 13:37:24 +02:00

bridged $clients only show MAC

This commit is contained in:
Taikuh 2020-03-25 14:42:53 +08:00
parent f0db12664d
commit 2a42c56ab3
2 changed files with 25 additions and 8 deletions

View File

@ -663,6 +663,10 @@ msgstr "Attempting to start TOR"
msgid "Attempting to stop TOR" msgid "Attempting to stop TOR"
msgstr "Attempting to stop TOR" msgstr "Attempting to stop TOR"
#: template/dashboard.php
msgid "<em>Bridged AP mode is enabled. To find the Hostname and IP of your connected clients, please cross-reference the MAC addresses here with those from your router's admin page.</em>"
msgstr "<em>Bridged AP mode is enabled. To find the Hostname and IP of your connected clients, please cross-reference the MAC addresses here with those from your router's admin page.</em>"
#: common form controls #: common form controls
msgid "Save settings" msgid "Save settings"
msgstr "Save settings" msgstr "Save settings"

View File

@ -8,7 +8,7 @@ if ($arrHostapdConf['WifiAPEnable'] == 1) {
$MACPattern = '"([[:xdigit:]]{2}:){5}[[:xdigit:]]{2}"'; $MACPattern = '"([[:xdigit:]]{2}:){5}[[:xdigit:]]{2}"';
if ($arrHostapdConf['BridgedEnable'] == 1) { if ($arrHostapdConf['BridgedEnable'] == 1) {
$moreLink = "index.php?page=hostapd_conf"; $moreLink = "index.php?page=hostapd_conf";
exec('arp -i '.$client_iface.' -a | grep -E $(iw dev '.$client_iface.' station dump | grep -oE '.$MACPattern.' | paste -sd "|") | tr -d "()" | awk -F" " \'{print $7 " " $4 " " $2 " " $1}\'', $clients); exec('iw dev '.$client_iface.' station dump | grep -oE '.$MACPattern, $clients);
} else { } else {
$moreLink = "index.php?page=dhcpd_conf"; $moreLink = "index.php?page=dhcpd_conf";
exec('cat '.RASPI_DNSMASQ_LEASES.'| grep -E $(arp -i '.$client_iface.' -n | grep -oE '.$MACPattern.' | paste -sd "|")', $clients); exec('cat '.RASPI_DNSMASQ_LEASES.'| grep -E $(arp -i '.$client_iface.' -n | grep -oE '.$MACPattern.' | paste -sd "|")', $clients);
@ -78,18 +78,31 @@ $ifaceStatus = $wlan0up ? "up" : "down";
<table class="table table-hover"> <table class="table table-hover">
<thead> <thead>
<tr> <tr>
<?php if ($arrHostapdConf['BridgedEnable'] == 1) : ?>
<th><?php echo _("MAC Address"); ?></th>
<?php else : ?>
<th><?php echo _("Host name"); ?></th> <th><?php echo _("Host name"); ?></th>
<th><?php echo _("IP Address"); ?></th> <th><?php echo _("IP Address"); ?></th>
<th><?php echo _("MAC Address"); ?></th> <th><?php echo _("MAC Address"); ?></th>
<?php endif; ?>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php foreach (array_slice($clients,0, 2) as $client) : ?> <?php if ($arrHostapdConf['BridgedEnable'] == 1) : ?>
<?php $props = explode(' ', $client) ?>
<tr> <tr>
<td><?php echo _("<em>Bridged AP mode is enabled. To find the Hostname and IP of your connected clients, please cross-reference the MAC addresses here with those from your router's admin page.</em>");?></td>
</tr>
<?php endif; ?>
<?php foreach (array_slice($clients,0, 2) as $client) : ?>
<tr>
<?php if ($arrHostapdConf['BridgedEnable'] == 1): ?>
<td><?php echo htmlspecialchars($client, ENT_QUOTES) ?></td>
<?php else : ?>
<?php $props = explode(' ', $client) ?>
<td><?php echo htmlspecialchars($props[3], ENT_QUOTES) ?></td> <td><?php echo htmlspecialchars($props[3], ENT_QUOTES) ?></td>
<td><?php echo htmlspecialchars($props[2], ENT_QUOTES) ?></td> <td><?php echo htmlspecialchars($props[2], ENT_QUOTES) ?></td>
<td><?php echo htmlspecialchars($props[1], ENT_QUOTES) ?></td> <td><?php echo htmlspecialchars($props[1], ENT_QUOTES) ?></td>
<?php endif; ?>
</tr> </tr>
<?php endforeach ?> <?php endforeach ?>
</tbody> </tbody>