diff --git a/Shorewall/lib.base b/Shorewall/lib.base index 6fdc9a00b..bd9d3d9cf 100644 --- a/Shorewall/lib.base +++ b/Shorewall/lib.base @@ -135,6 +135,32 @@ mutex_off() 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 # diff --git a/Shorewall/lib.common b/Shorewall/lib.common index ab561b355..353bfa5d2 100644 --- a/Shorewall/lib.common +++ b/Shorewall/lib.common @@ -411,32 +411,6 @@ in_network() # $1 = IP address, $2 = CIDR network 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 # device