mirror of
https://gitlab.com/shorewall/code.git
synced 2024-11-15 04:04:10 +01:00
Fix adding range of aliases
git-svn-id: https://shorewall.svn.sourceforge.net/svnroot/shorewall/trunk@730 fbd18981-670d-0410-9b5c-8dc0c1a9a2bb
This commit is contained in:
parent
47b75c3c87
commit
8466316f97
@ -3002,15 +3002,17 @@ setup_masq()
|
||||
esac
|
||||
|
||||
if [ -n "$address" -a -n "$ADD_SNAT_ALIASES" ]; then
|
||||
for addr in `ip_range $address` ; do
|
||||
if ! list_search $addr $aliases_to_add; then
|
||||
aliases_to_add="$aliases_to_add $addr $fullinterface"
|
||||
case $fullinterface in
|
||||
*:*)
|
||||
fullinterface=${fullinterface%:*}:$((${fullinterface#*:} + 1 ))
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
for addr in `separate_list $address`; do
|
||||
for addr1 in `ip_range_explicit $addr` ; do
|
||||
if ! list_search $addr1 $aliases_to_add; then
|
||||
aliases_to_add="$aliases_to_add $addr1 $fullinterface"
|
||||
case $fullinterface in
|
||||
*:*)
|
||||
fullinterface=${fullinterface%:*}:$((${fullinterface#*:} + 1 ))
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
done
|
||||
done
|
||||
fi
|
||||
|
||||
|
@ -308,6 +308,33 @@ ip_range() {
|
||||
done
|
||||
}
|
||||
|
||||
ip_range_explicit() {
|
||||
local first last
|
||||
|
||||
case $1 in
|
||||
[0-9]*.*.*.*-*.*.*.*)
|
||||
;;
|
||||
*)
|
||||
echo $1
|
||||
return
|
||||
;;
|
||||
esac
|
||||
|
||||
first=`decodeaddr ${1%-*}`
|
||||
last=`decodeaddr ${1#*-}`
|
||||
|
||||
if [ $first -gt $last ]; then
|
||||
fatal_error "Invalid IP address range: $1"
|
||||
fi
|
||||
|
||||
l=$(( $last + 1 ))
|
||||
|
||||
while [ $first -le $last ]; do
|
||||
echo `encodeaddr $first`
|
||||
first=$(($first + 1))
|
||||
done
|
||||
}
|
||||
|
||||
#
|
||||
# Netmask from CIDR
|
||||
#
|
||||
|
Loading…
Reference in New Issue
Block a user