File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -16,10 +16,14 @@ function hasArg {
16
16
# Adds the given argument if it's not already specified.
17
17
function addArg {
18
18
local arg=" ${1} "
19
- [ $# -ge 1 ] && local val= " ${2} "
19
+ shift
20
20
if ! hasArg " ${arg} " " ${USER_ARGS[@]} " ; then
21
21
ARGS+=(" ${arg} " )
22
- [ $# -ge 1 ] && ARGS+=(" ${val} " )
22
+ if [ $# -ge 1 ]; then
23
+ for val in " $@ " ; do
24
+ ARGS+=(" ${val} " )
25
+ done
26
+ fi
23
27
fi
24
28
}
25
29
Original file line number Diff line number Diff line change @@ -55,8 +55,7 @@ routes+=("$OVPN_K8S_SERVICE_NETWORK" "$OVPN_K8S_POD_NETWORK")
55
55
56
56
for route in " ${routes[@]} " ; do
57
57
if [[ " $route " =~ ^(( [0 - 9 ]| [1 - 9 ][0 - 9 ]| 1 [0 - 9 ]{2 }| 2 [0 - 4 ][0 - 9 ]| 25 [0 - 5 ])\.){3 }([0 - 9 ]| [1 - 9 ][0 - 9 ]| 1 [0 - 9 ]{2 }| 2 [0 - 4 ][0 - 9 ]| 25 [0 - 5 ])(\/ ([0 - 9 ]| [1 - 2 ][0 - 9 ]| 3 [0 - 2 ])) $ ]]; then
58
- network_route=$( getroute $route )
59
- addArg " --push" " route ${network_route} "
58
+ addArg " --push" " route $( getroute $route ) "
60
59
else
61
60
echo " $( date " +%a %b %d %H:%M:%S %Y" ) Dropping invalid route '${route} '."
62
61
routes=(" ${routes[@]/ $route } " )
@@ -97,7 +96,7 @@ if [ -d "${OVPN_OTP_AUTH:-}" ]; then
97
96
fi
98
97
99
98
if [ -n " ${OVPN_MANAGEMENT_PORT} " ]; then
100
- addArg " --management" " 127.0.0.1 ${OVPN_MANAGEMENT_PORT} "
99
+ addArg " --management" " 127.0.0.1" " ${OVPN_MANAGEMENT_PORT} "
101
100
fi
102
101
103
102
if [ -n " ${OVPN_STATUS} " ]; then
@@ -111,4 +110,4 @@ if [ $DEBUG ]; then
111
110
fi
112
111
113
112
echo " $( date " +%a %b %d %H:%M:%S %Y" ) Running 'openvpn ${ARGS[@]} ${USER_ARGS[@]} '"
114
- exec openvpn ${ARGS[@]} ${USER_ARGS[@]} 1> /dev/stderr 2> /dev/stderr
113
+ exec openvpn " ${ARGS[@]} ${USER_ARGS[@]} " 1> /dev/stderr 2> /dev/stderr
You can’t perform that action at this time.
0 commit comments