Bugzilla – Attachment 926 Details for
Bug 920
Enable client multiplexing to fall back to enhance transparency
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Add automatic multiplexing option
automux2.diff (text/plain), 5.41 KB, created by
Damien Miller
on 2005-06-03 12:55:29 AEST
(
hide
)
Description:
Add automatic multiplexing option
Filename:
MIME Type:
Creator:
Damien Miller
Created:
2005-06-03 12:55:29 AEST
Size:
5.41 KB
patch
obsolete
>Same diff again, with a little extra debug for Jakob. > >ok? > >Index: clientloop.c >=================================================================== >RCS file: /cvs/src/usr.bin/ssh/clientloop.c,v >retrieving revision 1.136 >diff -u -p -r1.136 clientloop.c >--- clientloop.c 10 Mar 2005 22:01:05 -0000 1.136 >+++ clientloop.c 31 May 2005 01:30:45 -0000 >@@ -616,13 +616,15 @@ client_process_control(fd_set * readset) > > switch (command) { > case SSHMUX_COMMAND_OPEN: >- if (options.control_master == 2) >+ if (options.control_master == SSHCTL_MASTER_ASK || >+ options.control_master == SSHCTL_MASTER_AUTO_ASK) > allowed = ask_permission("Allow shared connection " > "to %s? ", host); > /* continue below */ > break; > case SSHMUX_COMMAND_TERMINATE: >- if (options.control_master == 2) >+ if (options.control_master == SSHCTL_MASTER_ASK || >+ options.control_master == SSHCTL_MASTER_AUTO_ASK) > allowed = ask_permission("Terminate shared connection " > "to %s? ", host); > if (allowed) >Index: readconf.c >=================================================================== >RCS file: /cvs/src/usr.bin/ssh/readconf.c,v >retrieving revision 1.140 >diff -u -p -r1.140 readconf.c >--- readconf.c 16 May 2005 15:30:51 -0000 1.140 >+++ readconf.c 31 May 2005 01:30:46 -0000 >@@ -794,7 +794,27 @@ parse_int: > > case oControlMaster: > intptr = &options->control_master; >- goto parse_yesnoask; >+ arg = strdelim(&s); >+ if (!arg || *arg == '\0') >+ fatal("%.200s line %d: Missing ControlMaster argument.", >+ filename, linenum); >+ value = 0; /* To avoid compiler warning... */ >+ if (strcmp(arg, "yes") == 0 || strcmp(arg, "true") == 0) >+ value = SSHCTL_MASTER_YES; >+ else if (strcmp(arg, "no") == 0 || strcmp(arg, "false") == 0) >+ value = SSHCTL_MASTER_NO; >+ else if (strcmp(arg, "auto") == 0) >+ value = SSHCTL_MASTER_AUTO; >+ else if (strcmp(arg, "ask") == 0) >+ value = SSHCTL_MASTER_ASK; >+ else if (strcmp(arg, "autoask") == 0) >+ value = SSHCTL_MASTER_AUTO_ASK; >+ else >+ fatal("%.200s line %d: Bad ControlMaster argument.", >+ filename, linenum); >+ if (*activep && *intptr == -1) >+ *intptr = value; >+ break; > > case oHashKnownHosts: > intptr = &options->hash_known_hosts; >Index: readconf.h >=================================================================== >RCS file: /cvs/src/usr.bin/ssh/readconf.h,v >retrieving revision 1.66 >diff -u -p -r1.66 readconf.h >--- readconf.h 1 Mar 2005 10:40:27 -0000 1.66 >+++ readconf.h 31 May 2005 01:30:46 -0000 >@@ -116,6 +116,11 @@ typedef struct { > int hash_known_hosts; > } Options; > >+#define SSHCTL_MASTER_NO 0 >+#define SSHCTL_MASTER_YES 1 >+#define SSHCTL_MASTER_AUTO 2 >+#define SSHCTL_MASTER_ASK 3 >+#define SSHCTL_MASTER_AUTO_ASK 4 > > void initialize_options(Options *); > void fill_default_options(Options *); >Index: ssh.c >=================================================================== >RCS file: /cvs/src/usr.bin/ssh/ssh.c,v >retrieving revision 1.240 >diff -u -p -r1.240 ssh.c >--- ssh.c 27 May 2005 08:30:37 -0000 1.240 >+++ ssh.c 31 May 2005 01:30:46 -0000 >@@ -381,8 +381,10 @@ again: > } > break; > case 'M': >- options.control_master = >- (options.control_master >= 1) ? 2 : 1; >+ if (options.control_master == SSHCTL_MASTER_YES) >+ options.control_master = SSHCTL_MASTER_ASK; >+ else >+ options.control_master = SSHCTL_MASTER_YES; > break; > case 'p': > options.port = a2port(optarg); >@@ -607,11 +609,8 @@ again: > } > if (mux_command != 0 && options.control_path == NULL) > fatal("No ControlPath specified for \"-O\" command"); >- if (options.control_path != NULL && options.control_master == 0) { >- if (mux_command == 0) >- mux_command = SSHMUX_COMMAND_OPEN; >+ if (options.control_path != NULL) > control_client(options.control_path); >- } > > /* Open a connection to the remote host. */ > if (ssh_connect(host, &hostaddr, options.port, >@@ -1070,9 +1069,12 @@ ssh_control_listener(void) > struct sockaddr_un addr; > mode_t old_umask; > >- if (options.control_path == NULL || options.control_master <= 0) >+ if (options.control_path == NULL || >+ options.control_master == SSHCTL_MASTER_NO) > return; > >+ debug("setting up multiplex master socket"); >+ > memset(&addr, '\0', sizeof(addr)); > addr.sun_family = AF_UNIX; > addr.sun_len = offsetof(struct sockaddr_un, sun_path) + >@@ -1282,6 +1284,20 @@ control_client(const char *path) > char *term; > extern char **environ; > u_int flags; >+ >+ if (mux_command == 0) >+ mux_command = SSHMUX_COMMAND_OPEN; >+ >+ switch (options.control_master) { >+ case SSHCTL_MASTER_AUTO: >+ case SSHCTL_MASTER_AUTO_ASK: >+ debug("auto-mux: Trying existing master"); >+ /* FALLTHROUGH */ >+ case SSHCTL_MASTER_NO: >+ break; >+ default: >+ return; >+ } > > memset(&addr, '\0', sizeof(addr)); > addr.sun_family = AF_UNIX; >Index: ssh_config.5 >=================================================================== >RCS file: /cvs/src/usr.bin/ssh/ssh_config.5,v >retrieving revision 1.54 >diff -u -p -r1.54 ssh_config.5 >--- ssh_config.5 23 May 2005 23:32:46 -0000 1.54 >+++ ssh_config.5 31 May 2005 01:30:46 -0000 >@@ -278,6 +278,16 @@ If the > can not be opened, > .Nm ssh > will continue without connecting to a master instance. >+.Pp >+Two additional options allow for "opportunistic" multiplexing: try to use a >+master connection but fall back to creating a new one if one does not already >+exist. These options are: >+.Dq auto >+and >+.Dq autoask . >+The latter requires confirmation like the >+.Dq ask >+option. > .It Cm ControlPath > Specify the path to the control socket used for connection sharing. > See
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 920
:
705
| 926 |
928