diff options
author | Damien Miller <djm@mindrot.org> | 2005-12-13 19:33:19 +1100 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2005-12-13 19:33:19 +1100 |
commit | 7b58e800364870d05630514945687d2f26e3c065 (patch) | |
tree | f8b436c13a767fcb014125513fe53b6bc0bde9a2 /ssh.c | |
parent | 957d4e430ed40265cffc483abdc5b0e6a58c69ed (diff) |
- 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.c | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -40,7 +40,7 @@ | |||
40 | */ | 40 | */ |
41 | 41 | ||
42 | #include "includes.h" | 42 | #include "includes.h" |
43 | RCSID("$OpenBSD: ssh.c,v 1.255 2005/12/06 22:38:27 reyk Exp $"); | 43 | RCSID("$OpenBSD: ssh.c,v 1.256 2005/12/08 18:34:11 reyk Exp $"); |
44 | 44 | ||
45 | #include <openssl/evp.h> | 45 | #include <openssl/evp.h> |
46 | #include <openssl/err.h> | 46 | #include <openssl/err.h> |
@@ -341,9 +341,10 @@ again: | |||
341 | exit(0); | 341 | exit(0); |
342 | break; | 342 | break; |
343 | case 'w': | 343 | case 'w': |
344 | options.tun_open = 1; | 344 | if (options.tun_open == -1) |
345 | options.tun_open = SSH_TUNMODE_DEFAULT; | ||
345 | options.tun_local = a2tun(optarg, &options.tun_remote); | 346 | options.tun_local = a2tun(optarg, &options.tun_remote); |
346 | if (options.tun_local < -1) { | 347 | if (options.tun_local == SSH_TUNID_ERR) { |
347 | fprintf(stderr, "Bad tun device '%s'\n", optarg); | 348 | fprintf(stderr, "Bad tun device '%s'\n", optarg); |
348 | exit(1); | 349 | exit(1); |
349 | } | 350 | } |
@@ -1067,12 +1068,13 @@ ssh_session2_setup(int id, void *arg) | |||
1067 | packet_send(); | 1068 | packet_send(); |
1068 | } | 1069 | } |
1069 | 1070 | ||
1070 | if (options.tun_open) { | 1071 | if (options.tun_open != SSH_TUNMODE_NO) { |
1071 | Channel *c; | 1072 | Channel *c; |
1072 | int fd; | 1073 | int fd; |
1073 | 1074 | ||
1074 | debug("Requesting tun."); | 1075 | debug("Requesting tun."); |
1075 | if ((fd = tun_open(options.tun_local)) >= 0) { | 1076 | if ((fd = tun_open(options.tun_local, |
1077 | options.tun_open)) >= 0) { | ||
1076 | c = channel_new("tun", SSH_CHANNEL_OPENING, fd, fd, -1, | 1078 | c = channel_new("tun", SSH_CHANNEL_OPENING, fd, fd, -1, |
1077 | CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT, | 1079 | CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT, |
1078 | 0, "tun", 1); | 1080 | 0, "tun", 1); |
@@ -1082,6 +1084,7 @@ ssh_session2_setup(int id, void *arg) | |||
1082 | packet_put_int(c->self); | 1084 | packet_put_int(c->self); |
1083 | packet_put_int(c->local_window_max); | 1085 | packet_put_int(c->local_window_max); |
1084 | packet_put_int(c->local_maxpacket); | 1086 | packet_put_int(c->local_maxpacket); |
1087 | packet_put_int(options.tun_open); | ||
1085 | packet_put_int(options.tun_remote); | 1088 | packet_put_int(options.tun_remote); |
1086 | packet_send(); | 1089 | packet_send(); |
1087 | } | 1090 | } |