mirror of
https://github.com/vdsm/virtual-dsm.git
synced 2025-02-24 13:30:02 +08:00
fix: Port forwarding (#530)
This commit is contained in:
parent
d65b5a089a
commit
e70ed1900f
@ -94,34 +94,20 @@ configureDNS() {
|
|||||||
getPorts() {
|
getPorts() {
|
||||||
|
|
||||||
local list=$1
|
local list=$1
|
||||||
local args=""
|
|
||||||
local vnc="5900"
|
local vnc="5900"
|
||||||
|
|
||||||
list="${list//,/ }"
|
|
||||||
list="${list## }"
|
|
||||||
list="${list%% }"
|
|
||||||
|
|
||||||
if [[ "${DISPLAY,,}" == "vnc" ]] && [[ "$list" != *"$vnc"* ]]; then
|
if [[ "${DISPLAY,,}" == "vnc" ]] && [[ "$list" != *"$vnc"* ]]; then
|
||||||
if [ -z "$list" ]; then
|
[ -z "$list" ] && list="$vnc" || list="$list,$vnc"
|
||||||
list="$vnc"
|
|
||||||
else
|
|
||||||
list="$list $vnc"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$list" ]; then
|
[ -z "$list" ] && return 0
|
||||||
if [[ "$list" != *" "* ]]; then
|
|
||||||
args=" ! --dport $list"
|
if [[ "$list" != *","* ]]; then
|
||||||
|
echo " ! --dport $list"
|
||||||
else
|
else
|
||||||
args=" -m multiport ! --dports "
|
echo " -m multiport ! --dports $list"
|
||||||
for port in $list; do
|
|
||||||
args="${args}${port},"
|
|
||||||
done
|
|
||||||
args="${args%?}"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "$args"
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user