summaryrefslogtreecommitdiff
path: root/ssh.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2005-12-13 19:33:19 +1100
committerDamien Miller <djm@mindrot.org>2005-12-13 19:33:19 +1100
commit7b58e800364870d05630514945687d2f26e3c065 (patch)
treef8b436c13a767fcb014125513fe53b6bc0bde9a2 /ssh.c
parent957d4e430ed40265cffc483abdc5b0e6a58c69ed (diff)
downloadopenssh-git-7b58e800364870d05630514945687d2f26e3c065.tar.gz
- reyk@cvs.openbsd.org 2005/12/08 18:34:11
[auth-options.c includes.h misc.c misc.h readconf.c servconf.c] [serverloop.c ssh.c ssh_config.5 sshd_config.5 configure.ac] two changes to the new ssh tunnel support. this breaks compatibility with the initial commit but is required for a portable approach. - make the tunnel id u_int and platform friendly, use predefined types. - support configuration of layer 2 (ethernet) or layer 3 (point-to-point, default) modes. configuration is done using the Tunnel (yes|point-to-point|ethernet|no) option is ssh_config(5) and restricted by the PermitTunnel (yes|point-to-point|ethernet|no) option in sshd_config(5). ok djm@, man page bits by jmc@
Diffstat (limited to 'ssh.c')
-rw-r--r--ssh.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/ssh.c b/ssh.c
index 8a4a0e4c..dd627ce2 100644
--- a/ssh.c
+++ b/ssh.c
@@ -40,7 +40,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: ssh.c,v 1.255 2005/12/06 22:38:27 reyk Exp $");
+RCSID("$OpenBSD: ssh.c,v 1.256 2005/12/08 18:34:11 reyk Exp $");
#include <openssl/evp.h>
#include <openssl/err.h>
@@ -341,9 +341,10 @@ again:
exit(0);
break;
case 'w':
- options.tun_open = 1;
+ if (options.tun_open == -1)
+ options.tun_open = SSH_TUNMODE_DEFAULT;
options.tun_local = a2tun(optarg, &options.tun_remote);
- if (options.tun_local < -1) {
+ if (options.tun_local == SSH_TUNID_ERR) {
fprintf(stderr, "Bad tun device '%s'\n", optarg);
exit(1);
}
@@ -1067,12 +1068,13 @@ ssh_session2_setup(int id, void *arg)
packet_send();
}
- if (options.tun_open) {
+ if (options.tun_open != SSH_TUNMODE_NO) {
Channel *c;
int fd;
debug("Requesting tun.");
- if ((fd = tun_open(options.tun_local)) >= 0) {
+ if ((fd = tun_open(options.tun_local,
+ options.tun_open)) >= 0) {
c = channel_new("tun", SSH_CHANNEL_OPENING, fd, fd, -1,
CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT,
0, "tun", 1);
@@ -1082,6 +1084,7 @@ ssh_session2_setup(int id, void *arg)
packet_put_int(c->self);
packet_put_int(c->local_window_max);
packet_put_int(c->local_maxpacket);
+ packet_put_int(options.tun_open);
packet_put_int(options.tun_remote);
packet_send();
}