diff options
author | Damien Miller <djm@mindrot.org> | 2013-06-10 13:07:11 +1000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2013-06-10 13:07:11 +1000 |
commit | 36187093ea0b2d2240c043417b8949611687e105 (patch) | |
tree | e399ca31e1573856ddff2f8cdfb6ea051b57ed1d /channels.c | |
parent | ae133d4b31af05bb232d797419f498f3ae7e9f2d (diff) |
- dtucker@cvs.openbsd.org 2013/06/07 15:37:52
[channels.c channels.h clientloop.c]
Add an "ABANDONED" channel state and use for mux sessions that are
disconnected via the ~. escape sequence. Channels in this state will
be able to close if the server responds, but do not count as active channels.
This means that if you ~. all of the mux clients when using ControlPersist
on a broken network, the backgrounded mux master will exit when the
Control Persist time expires rather than hanging around indefinitely.
bz#1917, also reported and tested by tedu@. ok djm@ markus@.
Diffstat (limited to 'channels.c')
-rw-r--r-- | channels.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/channels.c b/channels.c index d50a4a298..b48e6aebb 100644 --- a/channels.c +++ b/channels.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: channels.c,v 1.322 2013/06/01 13:15:51 dtucker Exp $ */ | 1 | /* $OpenBSD: channels.c,v 1.323 2013/06/07 15:37:52 dtucker Exp $ */ |
2 | /* | 2 | /* |
3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -213,6 +213,7 @@ channel_lookup(int id) | |||
213 | case SSH_CHANNEL_OPEN: | 213 | case SSH_CHANNEL_OPEN: |
214 | case SSH_CHANNEL_INPUT_DRAINING: | 214 | case SSH_CHANNEL_INPUT_DRAINING: |
215 | case SSH_CHANNEL_OUTPUT_DRAINING: | 215 | case SSH_CHANNEL_OUTPUT_DRAINING: |
216 | case SSH_CHANNEL_ABANDONED: | ||
216 | return (c); | 217 | return (c); |
217 | } | 218 | } |
218 | logit("Non-public channel %d, type %d.", id, c->type); | 219 | logit("Non-public channel %d, type %d.", id, c->type); |
@@ -530,6 +531,7 @@ channel_still_open(void) | |||
530 | case SSH_CHANNEL_DYNAMIC: | 531 | case SSH_CHANNEL_DYNAMIC: |
531 | case SSH_CHANNEL_CONNECTING: | 532 | case SSH_CHANNEL_CONNECTING: |
532 | case SSH_CHANNEL_ZOMBIE: | 533 | case SSH_CHANNEL_ZOMBIE: |
534 | case SSH_CHANNEL_ABANDONED: | ||
533 | continue; | 535 | continue; |
534 | case SSH_CHANNEL_LARVAL: | 536 | case SSH_CHANNEL_LARVAL: |
535 | if (!compat20) | 537 | if (!compat20) |
@@ -575,6 +577,7 @@ channel_find_open(void) | |||
575 | case SSH_CHANNEL_OPENING: | 577 | case SSH_CHANNEL_OPENING: |
576 | case SSH_CHANNEL_CONNECTING: | 578 | case SSH_CHANNEL_CONNECTING: |
577 | case SSH_CHANNEL_ZOMBIE: | 579 | case SSH_CHANNEL_ZOMBIE: |
580 | case SSH_CHANNEL_ABANDONED: | ||
578 | continue; | 581 | continue; |
579 | case SSH_CHANNEL_LARVAL: | 582 | case SSH_CHANNEL_LARVAL: |
580 | case SSH_CHANNEL_AUTH_SOCKET: | 583 | case SSH_CHANNEL_AUTH_SOCKET: |
@@ -622,6 +625,7 @@ channel_open_message(void) | |||
622 | case SSH_CHANNEL_CLOSED: | 625 | case SSH_CHANNEL_CLOSED: |
623 | case SSH_CHANNEL_AUTH_SOCKET: | 626 | case SSH_CHANNEL_AUTH_SOCKET: |
624 | case SSH_CHANNEL_ZOMBIE: | 627 | case SSH_CHANNEL_ZOMBIE: |
628 | case SSH_CHANNEL_ABANDONED: | ||
625 | case SSH_CHANNEL_MUX_CLIENT: | 629 | case SSH_CHANNEL_MUX_CLIENT: |
626 | case SSH_CHANNEL_MUX_LISTENER: | 630 | case SSH_CHANNEL_MUX_LISTENER: |
627 | continue; | 631 | continue; |
@@ -2491,7 +2495,7 @@ channel_input_close_confirmation(int type, u_int32_t seq, void *ctxt) | |||
2491 | if (c == NULL) | 2495 | if (c == NULL) |
2492 | packet_disconnect("Received close confirmation for " | 2496 | packet_disconnect("Received close confirmation for " |
2493 | "out-of-range channel %d.", id); | 2497 | "out-of-range channel %d.", id); |
2494 | if (c->type != SSH_CHANNEL_CLOSED) | 2498 | if (c->type != SSH_CHANNEL_CLOSED && c->type != SSH_CHANNEL_ABANDONED) |
2495 | packet_disconnect("Received close confirmation for " | 2499 | packet_disconnect("Received close confirmation for " |
2496 | "non-closed channel %d (type %d).", id, c->type); | 2500 | "non-closed channel %d (type %d).", id, c->type); |
2497 | channel_free(c); | 2501 | channel_free(c); |