Skip to content

Commit

Permalink
no message
Browse files Browse the repository at this point in the history
  • Loading branch information
Nall-chan committed Jul 19, 2023
1 parent 27ef265 commit 6760f4c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
16 changes: 9 additions & 7 deletions ONVIF Discovery/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -510,24 +510,26 @@ protected function GetTimeOffset(string $IpValue)
private function getIPAdresses()
{
$Interfaces = SYS_GetNetworkInfo();
$InterfaceIndexes = array_column($Interfaces, 'Description', 'InterfaceIndex');
$InterfaceDescriptions = array_column($Interfaces, 'Description', 'InterfaceIndex');
$Networks = net_get_interfaces();
$Addresses = [];
foreach ($Networks as $Interface) {
foreach ($Networks as $InterfaceDescription => $Interface) {
if (!$Interface['up']) {
continue;
}
$InterfaceIndex = array_search($Interface['description'], $InterfaceIndexes);
if (array_key_exists('description', $Interface)) {
$InterfaceDescription = array_search($Interface['description'], $InterfaceDescriptions);
}
foreach ($Interface['unicast'] as $Address) {
switch ($Address['family']) {
case 23:
$family = 'ipv6';
case AF_INET6:
if ($Address['address'] == '::1') {
continue 2;
}
$Address['address'] = '[' . $Address['address'] . ']';
$family = 'ipv6';
break;
case 2:
case AF_INET:
if ($Address['address'] == '127.0.0.1') {
continue 2;
}
Expand All @@ -536,7 +538,7 @@ private function getIPAdresses()
default:
continue 2;
}
$Addresses[$family][$Address['address']] = $InterfaceIndex; //$Interface['description'];
$Addresses[$family][$Address['address']] = $InterfaceDescription;
}
}
return $Addresses;
Expand Down
4 changes: 2 additions & 2 deletions library.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
"version": "6.1"
},
"version": "2.00",
"build": 206,
"date": 1683304881
"build": 207,
"date": 1689768697
}

0 comments on commit 6760f4c

Please sign in to comment.