Removed "TunnelOptions" option. Its function is now fulfilled by "PermitTunnel"(sshd) and "Tunnel" (ssh): you can append to the type of tunnel a ":" followed by options (e.g. Tunnel=ethernet:my_option)

This commit is contained in:
Giuseppe Guerrini 2024-10-01 00:46:09 +02:00
parent ad8b4217d5
commit e0296cdb1e
4 changed files with 17 additions and 8 deletions

View File

@ -21,7 +21,9 @@ begins with the prefix. The number of adapters created in this way is the number
of simultaneous sessions that can be opened. For clients (ssh.exe) one
single instance is usually enough, but for servers (sshd.exe) a largest number
of reserved adapters is required. The name prefix SSH looks for can be
configured by setting the new option "TunnelOptions". At the moment, only
configured by appendig a ":" caracter and the prefix it to "ethernet" string
in "Tunnel" (or "PermitTunnel" sor sshd) option.
(e.g: "Tunnel=ethernet:MY_PREFIX")) . At the moment, only
ASCII characters are allowed, although Windows uses WCHAR for adapter names
(property "FriendlyName").

View File

@ -411,8 +411,9 @@ sys_tun_outfilter(struct ssh *ssh, struct Channel *c,
// whose IfIndex match the given value. If the index is not
// specified ("any"), the function takes the adapters whose
// friendly name starts with "SSH Tunnel" (case insensitive)
// or whatever is configured (see "TunnelOptions" configuration
// item).
// or whatever is configured. The name prefix SSH looks for can be
// configured by appendig a ":" caracter and the prefix it to "ethernet" string
// in "Tunnel" (or "PermitTunnel" sor sshd) option.
// - If a matching adapter if found, the function tries to open
// and activate it. In case of failure, it takes the next matching
// adapter.

View File

@ -1949,6 +1949,13 @@ parse_pubkey_algos:
intptr = &options->tun_open;
multistate_ptr = multistate_tunnel;
arg = argv_next(&ac, &av);
if (arg != NULL) {
char* opt = strchr(arg, ':');
if (opt != NULL) {
options->tun_options = xstrdup(opt + 1);
*opt = '\0';
}
}
goto parse_multistate_arg;
case oTunnelDevice:
@ -2830,8 +2837,6 @@ fill_default_options(Options * options)
options->hash_known_hosts = 0;
if (options->tun_open == -1)
options->tun_open = SSH_TUNMODE_NO;
if (options->tun_options == NULL)
options->tun_options = xstrdup("");
if (options->tun_local == -1)
options->tun_local = SSH_TUNID_ANY;
if (options->tun_remote == -1)
@ -3582,7 +3587,9 @@ dump_client_config(Options *o, const char *host)
dump_cfg_fmtint(oStreamLocalBindUnlink, o->fwd_opts.streamlocal_bind_unlink);
dump_cfg_fmtint(oStrictHostKeyChecking, o->strict_host_key_checking);
dump_cfg_fmtint(oTCPKeepAlive, o->tcp_keep_alive);
dump_cfg_fmtint(oTunnel, o->tun_open);
printf("%s %s%s%s\n", lookup_opcode_name(oTunnel), fmt_intarg(oTunnel, o->tun_open),
((o->tun_options == NULL) ? "" : ":"),
((o->tun_options == NULL) ? "" : o->tun_options));
dump_cfg_fmtint(oVerifyHostKeyDNS, o->verify_host_key_dns);
dump_cfg_fmtint(oVisualHostKey, o->visual_host_key);
dump_cfg_fmtint(oUpdateHostkeys, o->update_hostkeys);

View File

@ -472,8 +472,6 @@ fill_default_server_options(ServerOptions *options)
}
if (options->permit_tun == -1)
options->permit_tun = SSH_TUNMODE_NO;
if (options->tun_options == NULL)
options->tun_options = xstrdup("");
if (options->ip_qos_interactive == -1)
options->ip_qos_interactive = IPTOS_DSCP_AF21;
if (options->ip_qos_bulk == -1)
@ -3026,6 +3024,7 @@ copy_set_server_options(ServerOptions *dst, ServerOptions *src, int preauth)
free(dst->chroot_directory);
dst->chroot_directory = NULL;
}
M_CP_STROPT(tun_options);
/* Subsystems require merging. */
servconf_merge_subsystems(dst, src);