Revize 8f55a2a5
Přidáno uživatelem Michal Kliment před více než 9 roky(ů)
application/controllers/connection_requests.php | ||
---|---|---|
$gateway = $ip_address_model->get_gateway_of_subnet($subnet_id);
|
||
|
||
if ($gateway && $gateway->id)
|
||
{
|
||
// first try SNMP
|
||
if (module::e('snmp'))
|
||
{
|
||
$mac_address = '';
|
||
|
||
// first try CGI scripts
|
||
if (module::e('cgi'))
|
||
{
|
||
$vars = arr::to_object(array
|
||
(
|
||
'GATEWAY_IP_ADDRESS' => $gateway->ip_address,
|
||
'IP_ADDRESS' => $ip_address
|
||
));
|
||
|
||
$url = text::object_format($vars, Settings::get('cgi_arp_url'));
|
||
|
||
$mac_address = @file_get_contents($url);
|
||
}
|
||
|
||
// now try SNMP
|
||
if (!valid::mac_address($mac_address) && module::e('snmp'))
|
||
{
|
||
try
|
||
{
|
||
... | ... | |
|
||
// try find MAC address in DHCP
|
||
$mac_address = $snmp->getDHCPMacAddressOf($ip_address);
|
||
$this->session->set('connection_request_mac', $mac_address);
|
||
}
|
||
catch (DHCPMacAddressException $e)
|
||
{
|
||
... | ... | |
{
|
||
// try find MAC address in ARP table
|
||
$mac_address = $snmp->getARPMacAddressOf($ip_address);
|
||
$this->session->set('connection_request_mac', $mac_address);
|
||
}
|
||
catch(Exception $e)
|
||
{
|
||
... | ... | |
status::mwarning($e->getMessage());
|
||
}
|
||
}
|
||
// now try CGI scripts
|
||
else if (module::e('cgi'))
|
||
{
|
||
$vars = arr::to_object(array
|
||
(
|
||
'GATEWAY_IP_ADDRESS' => $gateway->ip_address,
|
||
'IP_ADDRESS' => $ip_address
|
||
));
|
||
|
||
$url = text::object_format($vars, Settings::get('cgi_arp_url'));
|
||
|
||
$mac_address = @file_get_contents($url);
|
||
|
||
if ($mac_address !== FALSE)
|
||
{
|
||
$this->session->set('connection_request_mac', $mac_address);
|
||
}
|
||
}
|
||
|
||
$this->session->set('connection_request_mac', $mac_address);
|
||
}
|
||
}
|
||
|
Také k dispozici: Unified diff
Release 1.1.6