More removal/relocation of functions.

Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
Tom Eastep 2010-03-05 07:29:27 -08:00
parent f8c7a284a5
commit 35974535b2
2 changed files with 26 additions and 26 deletions

View File

@ -135,6 +135,32 @@ mutex_off()
rm -f ${LOCKFILE:=${VARDIR}/lock} rm -f ${LOCKFILE:=${VARDIR}/lock}
} }
#
# 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
}
[ -z "$LEFTSHIFT" ] && . ${SHAREDIR}/lib.common [ -z "$LEFTSHIFT" ] && . ${SHAREDIR}/lib.common
# #

View File

@ -411,32 +411,6 @@ in_network() # $1 = IP address, $2 = CIDR network
test $(( $(decodeaddr $1) & $netmask)) = $(( $(decodeaddr ${2%/*}) & $netmask )) test $(( $(decodeaddr $1) & $netmask)) = $(( $(decodeaddr ${2%/*}) & $netmask ))
} }
#
# 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 # Find interface address--returns the first IP address assigned to the passed
# device # device