]> andersk Git - openssh.git/commitdiff
- reyk@cvs.openbsd.org 2006/01/02 07:53:44
authordjm <djm>
Mon, 2 Jan 2006 12:41:21 +0000 (12:41 +0000)
committerdjm <djm>
Mon, 2 Jan 2006 12:41:21 +0000 (12:41 +0000)
     [misc.c]
     clarify tun(4) opening - set the mode and bring the interface up. also
     (re)sets the tun(4) layer 2 LINK0 flag for existing tunnel interfaces.
     suggested and ok by djm@

ChangeLog
misc.c

index 0ac09025daa95bd16926d9b6e6e7192d39199edc..f92e6814e98ad532b75e204dbd6329c93e0c94fa 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
    - djm@cvs.openbsd.org 2006/01/02 01:20:31
      [sftp-client.c sftp-common.h sftp-server.c]
      use a common max. packet length, no binary change
+   - reyk@cvs.openbsd.org 2006/01/02 07:53:44
+     [misc.c]
+     clarify tun(4) opening - set the mode and bring the interface up. also
+     (re)sets the tun(4) layer 2 LINK0 flag for existing tunnel interfaces.
+     suggested and ok by djm@
 
 20060101
  - (djm) [Makefile.in configure.ac includes.h misc.c]
diff --git a/misc.c b/misc.c
index 26d7cad2c196f406fbd14b7c55e85900ad6b3af0..0339cede4b62129cf59c01cbb931de8e4caeb7f1 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -24,7 +24,7 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: misc.c,v 1.39 2006/01/01 10:08:48 stevesk Exp $");
+RCSID("$OpenBSD: misc.c,v 1.40 2006/01/02 07:53:44 reyk Exp $");
 
 #ifdef SSH_TUN_OPENBSD
 #include <net/if.h>
@@ -581,11 +581,17 @@ tun_open(int tun, int mode)
 
        if (ioctl(sock, SIOCGIFFLAGS, &ifr) == -1)
                goto failed;
-       if (mode == SSH_TUNMODE_ETHERNET) {
+
+       /* Set interface mode */
+       ifr.ifr_flags &= ~IFF_UP;
+       if (mode == SSH_TUNMODE_ETHERNET)
                ifr.ifr_flags |= IFF_LINK0;
-               if (ioctl(sock, SIOCSIFFLAGS, &ifr) == -1)
-                       goto failed;
-       }
+       else
+               ifr.ifr_flags &= ~IFF_LINK0;
+       if (ioctl(sock, SIOCSIFFLAGS, &ifr) == -1)
+               goto failed;
+
+       /* Bring interface up */
        ifr.ifr_flags |= IFF_UP;
        if (ioctl(sock, SIOCSIFFLAGS, &ifr) == -1)
                goto failed;
This page took 0.718702 seconds and 5 git commands to generate.