Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
38235b79
Commit
38235b79
authored
Jun 30, 2015
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
diagnostics: NDP table improvement for #225
parent
cc718022
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
25 deletions
+9
-25
diag_ndp.php
src/www/diag_ndp.php
+9
-25
No files found.
src/www/diag_ndp.php
View file @
38235b79
<?php
<?php
/*
/*
Copyright (C) 2014 Deciso B.V.
Copyright (C) 2014 Deciso B.V.
Copyright (C) 2004-2010 Scott Ullrich <sullrich@gmail.com>
Copyright (C) 2004-2010 Scott Ullrich <sullrich@gmail.com>
...
@@ -44,9 +45,6 @@ foreach ($ifdescrs as $key =>$interface) {
...
@@ -44,9 +45,6 @@ foreach ($ifdescrs as $key =>$interface) {
$hwif
[
$config
[
'interfaces'
][
$key
][
'if'
]]
=
$interface
;
$hwif
[
$config
[
'interfaces'
][
$key
][
'if'
]]
=
$interface
;
}
}
/* Array ( [0] => Neighbor [1] => Linklayer [2] => Address
[3] => Netif [4] => Expire [5] => S
[6] => Flags ) */
$data
=
array
();
$data
=
array
();
array_shift
(
$rawdata
);
array_shift
(
$rawdata
);
foreach
(
$rawdata
as
$line
)
{
foreach
(
$rawdata
as
$line
)
{
...
@@ -56,30 +54,16 @@ foreach ($rawdata as $line) {
...
@@ -56,30 +54,16 @@ foreach ($rawdata as $line) {
$ndpent
[
'ipv6'
]
=
trim
(
$elements
[
0
]);
$ndpent
[
'ipv6'
]
=
trim
(
$elements
[
0
]);
$ndpent
[
'mac'
]
=
trim
(
$elements
[
1
]);
$ndpent
[
'mac'
]
=
trim
(
$elements
[
1
]);
$ndpent
[
'interface'
]
=
trim
(
$elements
[
2
]);
$ndpent
[
'interface'
]
=
trim
(
$elements
[
2
]);
$data
[]
=
$ndpent
;
$ndpent
[
'dnsresolve'
]
=
'Z_ '
;
}
if
(
is_ipaddr
(
$ndpent
[
'ipv6'
]))
{
list
(
$ip
,
$scope
)
=
explode
(
'%'
,
$ndpent
[
'ipv6'
]);
/* FIXME: Not ipv6 compatible dns resolving. PHP needs fixing */
$hostname
=
gethostbyaddr
(
$ip
);
function
_getHostName
(
$mac
,
$ip
)
if
(
$hostname
!==
false
&&
$hostname
!==
$ip
)
{
{
$ndpent
[
'dnsresolve'
]
=
$hostname
;
if
(
is_ipaddr
(
$ip
))
{
}
list
(
$ip
,
$scope
)
=
explode
(
"%"
,
$ip
);
if
(
gethostbyaddr
(
$ip
)
<>
""
and
gethostbyaddr
(
$ip
)
<>
$ip
)
return
gethostbyaddr
(
$ip
);
else
return
""
;
}
}
}
// Resolve hostnames and replace Z_ with "". The intention
$data
[]
=
$ndpent
;
// is to sort the list by hostnames, alpha and then the non
// resolvable addresses will appear last in the list.
foreach
(
$data
as
&
$entry
)
{
$dns
=
trim
(
_getHostName
(
$entry
[
'mac'
],
$entry
[
'ipv6'
]));
if
(
trim
(
$dns
))
$entry
[
'dnsresolve'
]
=
"
$dns
"
;
else
$entry
[
'dnsresolve'
]
=
"Z_ "
;
}
}
// Sort the data alpha first
// Sort the data alpha first
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment