diff options
Diffstat (limited to 'regress/dynamic-forward.sh')
-rw-r--r-- | regress/dynamic-forward.sh | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/regress/dynamic-forward.sh b/regress/dynamic-forward.sh index 4674a7baf..d1ab8059b 100644 --- a/regress/dynamic-forward.sh +++ b/regress/dynamic-forward.sh | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: dynamic-forward.sh,v 1.4 2004/06/22 22:55:56 dtucker Exp $ | 1 | # $OpenBSD: dynamic-forward.sh,v 1.9 2011/06/03 00:29:52 dtucker Exp $ |
2 | # Placed in the Public Domain. | 2 | # Placed in the Public Domain. |
3 | 3 | ||
4 | tid="dynamic forwarding" | 4 | tid="dynamic forwarding" |
@@ -20,9 +20,23 @@ trace "will use ProxyCommand $proxycmd" | |||
20 | start_sshd | 20 | start_sshd |
21 | 21 | ||
22 | for p in 1 2; do | 22 | for p in 1 2; do |
23 | n=0 | ||
24 | error="1" | ||
23 | trace "start dynamic forwarding, fork to background" | 25 | trace "start dynamic forwarding, fork to background" |
24 | ${SSH} -$p -F $OBJ/ssh_config -f -D $FWDPORT -q somehost \ | 26 | while [ "$error" -ne 0 -a "$n" -lt 3 ]; do |
25 | exec sh -c \'"echo \$\$ > $OBJ/remote_pid; exec sleep 444"\' | 27 | n=`expr $n + 1` |
28 | ${SSH} -$p -F $OBJ/ssh_config -f -D $FWDPORT -q \ | ||
29 | -oExitOnForwardFailure=yes somehost exec sh -c \ | ||
30 | \'"echo \$\$ > $OBJ/remote_pid; exec sleep 444"\' | ||
31 | error=$? | ||
32 | if [ "$error" -ne 0 ]; then | ||
33 | trace "forward failed proto $p attempt $n err $error" | ||
34 | sleep $n | ||
35 | fi | ||
36 | done | ||
37 | if [ "$error" -ne 0 ]; then | ||
38 | fatal "failed to start dynamic forwarding proto $p" | ||
39 | fi | ||
26 | 40 | ||
27 | for s in 4 5; do | 41 | for s in 4 5; do |
28 | for h in 127.0.0.1 localhost; do | 42 | for h in 127.0.0.1 localhost; do |
@@ -44,7 +58,4 @@ for p in 1 2; do | |||
44 | else | 58 | else |
45 | fail "no pid file: $OBJ/remote_pid" | 59 | fail "no pid file: $OBJ/remote_pid" |
46 | fi | 60 | fi |
47 | |||
48 | # Must allow time for connection tear-down | ||
49 | sleep 2 | ||
50 | done | 61 | done |