diff --git a/src/captiveportal/index.php b/src/captiveportal/index.php index 818457dee..85787338f 100644 --- a/src/captiveportal/index.php +++ b/src/captiveportal/index.php @@ -90,22 +90,25 @@ $passthrumac = isset($cpcfg['passthrumacadd']); function ip_to_mac($addr) { $cmd = '/usr/sbin/arp -n ' . $addr; + $ret = false; exec($cmd, $out, $ret); if ($ret) { log_error('The command `' . $cmd . '\' failed to execute'); } else { - $mac = explode(' ', $out); + $mac = explode(' ', $out[0]); if (isset($mac[3])) { - return array('macaddr' => $mac[3]); + $ret = $mac[3]; } } + + return $ret; } /* find MAC address for client */ if ($macfilter || $passthrumac) { $tmpres = ip_to_mac($clientip); - if (!is_array($tmpres)) { + if (!$tmpres) { /* unable to find MAC address - shouldn't happen! - bail out */ captiveportal_logportalauth("unauthenticated","noclientmac",$clientip,"ERROR"); echo "An error occurred. Please check the system logs for more information."; @@ -113,7 +116,7 @@ if ($macfilter || $passthrumac) { ob_flush(); return; } - $clientmac = $tmpres['macaddr']; + $clientmac = $tmpres; unset($tmpres); }