[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@
This commit is contained in:
Damien Miller 2006-01-02 23:41:21 +11:00
parent 5444618987
commit a1d9a18e14
2 changed files with 17 additions and 6 deletions

View File

@ -23,6 +23,11 @@
- djm@cvs.openbsd.org 2006/01/02 01:20:31 - djm@cvs.openbsd.org 2006/01/02 01:20:31
[sftp-client.c sftp-common.h sftp-server.c] [sftp-client.c sftp-common.h sftp-server.c]
use a common max. packet length, no binary change 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 20060101
- (djm) [Makefile.in configure.ac includes.h misc.c] - (djm) [Makefile.in configure.ac includes.h misc.c]
@ -3613,4 +3618,4 @@
- (djm) Trim deprecated options from INSTALL. Mention UsePAM - (djm) Trim deprecated options from INSTALL. Mention UsePAM
- (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu
$Id: ChangeLog,v 1.4069 2006/01/02 12:40:50 djm Exp $ $Id: ChangeLog,v 1.4070 2006/01/02 12:41:21 djm Exp $

12
misc.c
View File

@ -24,7 +24,7 @@
*/ */
#include "includes.h" #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 #ifdef SSH_TUN_OPENBSD
#include <net/if.h> #include <net/if.h>
@ -581,11 +581,17 @@ tun_open(int tun, int mode)
if (ioctl(sock, SIOCGIFFLAGS, &ifr) == -1) if (ioctl(sock, SIOCGIFFLAGS, &ifr) == -1)
goto failed; 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; ifr.ifr_flags |= IFF_LINK0;
else
ifr.ifr_flags &= ~IFF_LINK0;
if (ioctl(sock, SIOCSIFFLAGS, &ifr) == -1) if (ioctl(sock, SIOCSIFFLAGS, &ifr) == -1)
goto failed; goto failed;
}
/* Bring interface up */
ifr.ifr_flags |= IFF_UP; ifr.ifr_flags |= IFF_UP;
if (ioctl(sock, SIOCSIFFLAGS, &ifr) == -1) if (ioctl(sock, SIOCSIFFLAGS, &ifr) == -1)
goto failed; goto failed;