fix /dev/tun path issue (closes: #1541), bump release number
[openwrt/svn-archive/archive.git] / net / chillispot / patches / 010-linux_dev_tun.patch
1 --- chillispot-1.1.0/src/tun.c.orig 2006-09-24 19:48:25.000000000 +0200
2 +++ chillispot-1.1.0/src/tun.c 2007-04-02 00:38:12.000000000 +0200
3 @@ -77,6 +77,7 @@
4 #include <linux/if_tun.h>
5 #include <linux/netlink.h>
6 #include <linux/rtnetlink.h>
7 +#include <linux/version.h>
8
9 #elif defined (__FreeBSD__) || defined (__OpenBSD__) || defined (__NetBSD__)
10 #include <net/if.h>
11 @@ -673,6 +674,11 @@
12
13 #if defined(__linux__)
14 struct ifreq ifr;
15 +# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18)
16 +# define TUN_DEV "/dev/tun"
17 +# else
18 +# define TUN_DEV "/dev/net/tun"
19 +# endif
20
21 #elif defined(__FreeBSD__) defined (__OpenBSD__) || defined (__NetBSD__) || defined (__APPLE__)
22 char devname[IFNAMSIZ+5]; /* "/dev/" + ifname */
23 @@ -701,7 +707,7 @@
24
25 #if defined(__linux__)
26 /* Open the actual tun device */
27 - if (((*tun)->fd = open("/dev/net/tun", O_RDWR)) < 0) {
28 + if (((*tun)->fd = open(TUN_DEV, O_RDWR)) < 0) {
29 sys_err(LOG_ERR, __FILE__, __LINE__, errno, "open() failed");
30 return -1;
31 }