tun-device: Rearrange headers to build properly when tun devices not supported

This commit is contained in:
Martin Willi
2014-06-03 12:24:34 +02:00
parent ce24e0d3e5
commit 43c5388470
+15 -21
View File
@@ -16,6 +16,21 @@
* for more details.
*/
#include "tun_device.h"
#include <utils/debug.h>
#include <threading/thread.h>
#if !defined(__APPLE__) && !defined(__linux__) && !defined(HAVE_NET_IF_TUN_H)
tun_device_t *tun_device_create(const char *name_tmpl)
{
DBG1(DBG_LIB, "TUN devices are not supported");
return NULL;
}
#else /* TUN devices supported */
#include <errno.h>
#include <fcntl.h>
#include <netinet/in.h>
@@ -27,22 +42,6 @@
#include <unistd.h>
#include <net/if.h>
#if !defined(__APPLE__) && !defined(__linux__) && !defined(HAVE_NET_IF_TUN_H)
#include "tun_device.h"
#include <utils/debug.h>
#warning TUN devices are not supported!
tun_device_t *tun_device_create(const char *name_tmpl)
{
DBG1(DBG_LIB, "TUN devices are not supported");
return NULL;
}
#else /* TUN devices supported */
#ifdef __APPLE__
#include <net/if_utun.h>
#include <netinet/in_var.h>
@@ -58,11 +57,6 @@ tun_device_t *tun_device_create(const char *name_tmpl)
#include <net/if_tun.h>
#endif
#include "tun_device.h"
#include <utils/debug.h>
#include <threading/thread.h>
#define TUN_DEFAULT_MTU 1500
typedef struct private_tun_device_t private_tun_device_t;