mirror of
https://gitlab.com/shorewall/code.git
synced 2025-08-13 17:54:04 +02:00
Improve undefined interface checking
git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@1225 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
@ -502,11 +502,11 @@ ip_vlsm() {
|
||||
|
||||
#
|
||||
# Chain name base for an interface -- replace all periods with underscores in the passed name.
|
||||
# The result is echoed (less "+" and anything following).
|
||||
# The result is echoed (less trailing "+").
|
||||
#
|
||||
chain_base() #$1 = interface
|
||||
{
|
||||
local c=${1%%+*}
|
||||
local c=${1%%+}
|
||||
|
||||
while true; do
|
||||
case $c in
|
||||
@ -524,31 +524,18 @@ chain_base() #$1 = interface
|
||||
done
|
||||
}
|
||||
|
||||
#
|
||||
# Remove trailing digits from a name
|
||||
#
|
||||
strip_trailing_digits() {
|
||||
echo $1 | sed s'/[0-9].*$//'
|
||||
}
|
||||
|
||||
#
|
||||
# Loosly Match the name of an interface
|
||||
#
|
||||
|
||||
if_match() # $1 = Name in interfaces file - may end in "+"
|
||||
# $2 = Name from routing table
|
||||
# $2 = Full interface name - may also end in "+"
|
||||
{
|
||||
local if_file=$1
|
||||
local rt_table=$2
|
||||
local pattern=${1%+}
|
||||
local interface=${2%+}
|
||||
|
||||
case $if_file in
|
||||
*+)
|
||||
test "$(strip_trailing_digits $rt_table)" = "${if_file%+}"
|
||||
;;
|
||||
*)
|
||||
test "$rt_table" = "$if_file"
|
||||
;;
|
||||
esac
|
||||
test "x${interface:0:${#pattern}}" = "x${pattern}"
|
||||
|
||||
}
|
||||
|
||||
#
|
||||
|
Reference in New Issue
Block a user