forked from extern/shorewall_code
More removal/relocation of functions.
Signed-off-by: Tom Eastep <teastep@shorewall.net>
This commit is contained in:
parent
f8c7a284a5
commit
35974535b2
@ -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
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user