projects
/
tinc
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
3b455b8
)
Wrap the tun/tap code in #ifdef HAVE_TUNTAP
author
Ivo Timmermans
<ivo@lychnis.net>
Sun, 15 Oct 2000 19:53:15 +0000
(19:53 +0000)
committer
Ivo Timmermans
<ivo@lychnis.net>
Sun, 15 Oct 2000 19:53:15 +0000
(19:53 +0000)
src/net.c
patch
|
blob
|
history
diff --git
a/src/net.c
b/src/net.c
index
0e251be
..
fecf7e6
100644
(file)
--- a/
src/net.c
+++ b/
src/net.c
@@
-17,7
+17,7
@@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- $Id: net.c,v 1.35.4.3
6 2000/10/15 00:59:34 guus
Exp $
+ $Id: net.c,v 1.35.4.3
7 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 */
#include <net/if.h>
/* Next two includes are for tun/tap support */
#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 <xalloc.h>
#include <utils.h>
#include <xalloc.h>
@@
-332,12
+335,19
@@
int setup_tap_fd(void)
int nfd;
const char *tapfname;
config_t const *cfg;
int nfd;
const char *tapfname;
config_t const *cfg;
+
+#ifdef HAVE_TUNTAP
struct ifreq ifr;
struct ifreq ifr;
+#endif
cp
if((cfg = get_config_val(config, tapdevice)))
tapfname = cfg->data.ptr;
else
cp
if((cfg = get_config_val(config, tapdevice)))
tapfname = cfg->data.ptr;
else
+#ifdef HAVE_TUNTAP
tapfname = "/dev/misc/net/tun";
tapfname = "/dev/misc/net/tun";
+#else
+ tapfname = "/dev/tap0";
+#endif
cp
if((nfd = open(tapfname, O_RDWR | O_NONBLOCK)) < 0)
{
cp
if((nfd = open(tapfname, O_RDWR | O_NONBLOCK)) < 0)
{
@@
-347,8
+357,8
@@
cp
cp
tap_fd = nfd;
cp
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));
cp
ifr.ifr_flags = IFF_TAP;
memset(&ifr, 0, sizeof(ifr));
cp
ifr.ifr_flags = IFF_TAP;
@@
-363,6
+373,7
@@
cp
else
/* Setup inetaddr/netmask etc */;
}
else
/* Setup inetaddr/netmask etc */;
}
+#endif
cp
return 0;
cp
return 0;