mirror of
https://gitlab.com/shorewall/code.git
synced 2025-06-25 12:13:29 +02:00
Restore find_interface_by_mac()
This commit is contained in:
parent
894d4e5aa5
commit
f723bc2ef1
@ -598,6 +598,32 @@ chain_exists() # $1 = chain name
|
|||||||
qt $IPTABLES -L $1 -n
|
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
|
# Find interface address--returns the first IP address assigned to the passed
|
||||||
# device
|
# device
|
||||||
|
Loading…
x
Reference in New Issue
Block a user