mirror of
https://gitlab.com/shorewall/code.git
synced 2024-12-23 22:58:52 +01:00
Improve MAC detection
git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@7676 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
parent
81bd913a08
commit
39f4885b20
@ -912,11 +912,17 @@ find_mac() # $1 = IP address, $2 = interface
|
||||
{
|
||||
qt ping -nc 1 -t 2 -I $2 $1
|
||||
|
||||
local result=$(arp -na | awk "/[(]$1[)].* on $2$/ {print \$4}")
|
||||
local result=$(arp -na | awk "/[(]$1[)].* $2$/ {print \$4}")
|
||||
|
||||
[ -n "$result" -a "$result" != "<incomplete>" ] || fatal_error "Cannot determine the MAC address of $1 through $2"
|
||||
case $result in
|
||||
\<*\>)
|
||||
;;
|
||||
*)
|
||||
[ -n "$result" ] && echo $result && return
|
||||
;;
|
||||
esac
|
||||
|
||||
echo $result
|
||||
fatal_error "Cannot determine the MAC address of $1 through $2"
|
||||
}
|
||||
|
||||
################################################################################
|
||||
|
Loading…
Reference in New Issue
Block a user