Wrap the tun/tap code in #ifdef HAVE_TUNTAP
This commit is contained in:
parent
3b455b8f31
commit
e5130495d7
1 changed files with 14 additions and 3 deletions
17
src/net.c
17
src/net.c
|
@ -17,7 +17,7 @@
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
|
||||||
$Id: net.c,v 1.35.4.36 2000/10/15 00:59:34 guus Exp $
|
$Id: net.c,v 1.35.4.37 2000/10/15 19:53:15 zarq Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
@ -39,7 +39,10 @@
|
||||||
|
|
||||||
/* Next two includes are for tun/tap support */
|
/* Next two includes are for tun/tap support */
|
||||||
#include <net/if.h>
|
#include <net/if.h>
|
||||||
#include "/usr/src/linux/include/linux/if_tun.h"
|
|
||||||
|
#ifdef HAVE_LINUX_IF_TUN_H
|
||||||
|
#include <linux/if_tun.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <utils.h>
|
#include <utils.h>
|
||||||
#include <xalloc.h>
|
#include <xalloc.h>
|
||||||
|
@ -332,12 +335,19 @@ int setup_tap_fd(void)
|
||||||
int nfd;
|
int nfd;
|
||||||
const char *tapfname;
|
const char *tapfname;
|
||||||
config_t const *cfg;
|
config_t const *cfg;
|
||||||
|
|
||||||
|
#ifdef HAVE_TUNTAP
|
||||||
struct ifreq ifr;
|
struct ifreq ifr;
|
||||||
|
#endif
|
||||||
cp
|
cp
|
||||||
if((cfg = get_config_val(config, tapdevice)))
|
if((cfg = get_config_val(config, tapdevice)))
|
||||||
tapfname = cfg->data.ptr;
|
tapfname = cfg->data.ptr;
|
||||||
else
|
else
|
||||||
|
#ifdef HAVE_TUNTAP
|
||||||
tapfname = "/dev/misc/net/tun";
|
tapfname = "/dev/misc/net/tun";
|
||||||
|
#else
|
||||||
|
tapfname = "/dev/tap0";
|
||||||
|
#endif
|
||||||
cp
|
cp
|
||||||
if((nfd = open(tapfname, O_RDWR | O_NONBLOCK)) < 0)
|
if((nfd = open(tapfname, O_RDWR | O_NONBLOCK)) < 0)
|
||||||
{
|
{
|
||||||
|
@ -347,8 +357,8 @@ cp
|
||||||
cp
|
cp
|
||||||
tap_fd = nfd;
|
tap_fd = nfd;
|
||||||
|
|
||||||
|
#ifdef HAVE_TUNTAP
|
||||||
/* Ok now check if this is an old ethertap or a new tun/tap thingie */
|
/* Ok now check if this is an old ethertap or a new tun/tap thingie */
|
||||||
|
|
||||||
memset(&ifr, 0, sizeof(ifr));
|
memset(&ifr, 0, sizeof(ifr));
|
||||||
cp
|
cp
|
||||||
ifr.ifr_flags = IFF_TAP;
|
ifr.ifr_flags = IFF_TAP;
|
||||||
|
@ -363,6 +373,7 @@ cp
|
||||||
else
|
else
|
||||||
/* Setup inetaddr/netmask etc */;
|
/* Setup inetaddr/netmask etc */;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
cp
|
cp
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue