]> andersk Git - openssh.git/blobdiff - serverloop.c
fix spacing of include
[openssh.git] / serverloop.c
index 199f7696d05be9a55dde2cfa41df95c6862836c6..23f8831ef04b894d49d8945a57a603931f1d78d1 100644 (file)
@@ -35,7 +35,9 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: serverloop.c,v 1.122 2005/12/06 22:38:27 reyk Exp $");
+RCSID("$OpenBSD: serverloop.c,v 1.125 2006/02/07 01:42:00 stevesk Exp $");
+
+#include <termios.h>
 
 #include "xmalloc.h"
 #include "packet.h"
@@ -917,25 +919,41 @@ static Channel *
 server_request_tun(void)
 {
        Channel *c = NULL;
-       int sock, tun;
+       int mode, tun;
+       int sock;
 
-       if (!options.permit_tun) {
-               packet_send_debug("Server has disabled tunnel device forwarding.");
+       mode = packet_get_int();
+       switch (mode) {
+       case SSH_TUNMODE_POINTOPOINT:
+       case SSH_TUNMODE_ETHERNET:
+               break;
+       default:
+               packet_send_debug("Unsupported tunnel device mode.");
+               return NULL;
+       }
+       if ((options.permit_tun & mode) == 0) {
+               packet_send_debug("Server has rejected tunnel device "
+                   "forwarding");
                return NULL;
        }
 
        tun = packet_get_int();
        if (forced_tun_device != -1) {
-               if (tun != -1 && forced_tun_device != tun)
+               if (tun != SSH_TUNID_ANY && forced_tun_device != tun)
                        goto done;
                tun = forced_tun_device;
        }
-       sock = tun_open(tun);
+       sock = tun_open(tun, mode);
        if (sock < 0)
                goto done;
        c = channel_new("tun", SSH_CHANNEL_OPEN, sock, sock, -1,
            CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT, 0, "tun", 1);
        c->datagram = 1;
+#if defined(SSH_TUN_FILTER)
+       if (mode == SSH_TUNMODE_POINTOPOINT)
+               channel_register_filter(c->self, sys_tun_infilter,
+                   sys_tun_outfilter);
+#endif
 
  done:
        if (c == NULL)
This page took 0.039277 seconds and 4 git commands to generate.