Restore find_interface_by_mac()

This commit is contained in:
Tom Eastep 2009-06-15 07:33:41 -07:00
parent 894d4e5aa5
commit f723bc2ef1

View File

@ -598,6 +598,32 @@ chain_exists() # $1 = chain name
qt $IPTABLES -L $1 -n
}
#
# Find the interface with the passed MAC address
#
find_interface_by_mac() {
local mac
mac=$1
local first
local second
local rest
local dev
ip link list | while read first second rest; do
case $first in
*:)
dev=$second
;;
*)
if [ "$second" = $mac ]; then
echo ${dev%:}
return
fi
esac
done
}
#
# Find interface address--returns the first IP address assigned to the passed
# device