summaryrefslogtreecommitdiff
path: root/clientloop.c
diff options
context:
space:
mode:
Diffstat (limited to 'clientloop.c')
-rw-r--r--clientloop.c46
1 files changed, 45 insertions, 1 deletions
diff --git a/clientloop.c b/clientloop.c
index 1aeb412a9..538644c20 100644
--- a/clientloop.c
+++ b/clientloop.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: clientloop.c,v 1.179 2007/03/20 03:56:12 tedu Exp $ */ 1/* $OpenBSD: clientloop.c,v 1.180 2007/08/07 07:32:53 djm 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
@@ -1773,6 +1773,50 @@ client_request_agent(const char *request_type, int rchan)
1773 return c; 1773 return c;
1774} 1774}
1775 1775
1776int
1777client_request_tun_fwd(int tun_mode, int local_tun, int remote_tun)
1778{
1779 Channel *c;
1780 int fd;
1781
1782 if (tun_mode == SSH_TUNMODE_NO)
1783 return 0;
1784
1785 if (!compat20) {
1786 error("Tunnel forwarding is not support for protocol 1");
1787 return -1;
1788 }
1789
1790 debug("Requesting tun unit %d in mode %d", local_tun, tun_mode);
1791
1792 /* Open local tunnel device */
1793 if ((fd = tun_open(local_tun, tun_mode)) == -1) {
1794 error("Tunnel device open failed.");
1795 return -1;
1796 }
1797
1798 c = channel_new("tun", SSH_CHANNEL_OPENING, fd, fd, -1,
1799 CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT, 0, "tun", 1);
1800 c->datagram = 1;
1801
1802#if defined(SSH_TUN_FILTER)
1803 if (options.tun_open == SSH_TUNMODE_POINTOPOINT)
1804 channel_register_filter(c->self, sys_tun_infilter,
1805 sys_tun_outfilter);
1806#endif
1807
1808 packet_start(SSH2_MSG_CHANNEL_OPEN);
1809 packet_put_cstring("tun@openssh.com");
1810 packet_put_int(c->self);
1811 packet_put_int(c->local_window_max);
1812 packet_put_int(c->local_maxpacket);
1813 packet_put_int(tun_mode);
1814 packet_put_int(remote_tun);
1815 packet_send();
1816
1817 return 0;
1818}
1819
1776/* XXXX move to generic input handler */ 1820/* XXXX move to generic input handler */
1777static void 1821static void
1778client_input_channel_open(int type, u_int32_t seq, void *ctxt) 1822client_input_channel_open(int type, u_int32_t seq, void *ctxt)