Commit c3d166fc authored by David Woodhouse's avatar David Woodhouse

Split out os_setup_tun() for Windows vs. sane platforms

Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent d0ec3d44
......@@ -445,18 +445,17 @@ int dumb_socketpair(int socks[2], int make_overlapped);
} while (0)
/****************************************************************************/
/* tun-win32.c */
int win32_setup_tun(struct openconnect_info *vpninfo);
/* script.c */
int setenv_int(const char *opt, int value);
void set_script_env(struct openconnect_info *vpninfo);
int script_config_tun(struct openconnect_info *vpninfo, const char *reason);
/* tun.c */
/* tun.c / tun-win32.c */
void os_shutdown_tun(struct openconnect_info *vpninfo);
int os_read_tun(struct openconnect_info *vpninfo, struct pkt *pkt, int new_pkt);
int os_write_tun(struct openconnect_info *vpninfo, struct pkt *pkt);
int os_setup_tun(struct openconnect_info *vpninfo);
/* dtls.c */
unsigned char unhex(const char *data);
......
......@@ -196,7 +196,7 @@ static int open_tun(struct openconnect_info *vpninfo, char *guid, char *name)
return 1;
}
int win32_setup_tun(struct openconnect_info *vpninfo)
int os_setup_tun(struct openconnect_info *vpninfo)
{
if (search_taps(vpninfo, open_tun) != 1)
return -1;
......
......@@ -143,6 +143,8 @@ static int link_proto(int unit_nr, const char *devname, uint64_t flags)
}
#endif
#ifndef _WIN32
#ifdef SIOCIFCREATE
static int bsd_open_tun(char *tun_name)
{
......@@ -171,12 +173,10 @@ static int bsd_open_tun(char *tun_name)
#define bsd_open_tun(tun_name) open(tun_name, O_RDWR)
#endif
static int os_setup_tun(struct openconnect_info *vpninfo)
int os_setup_tun(struct openconnect_info *vpninfo)
{
int tun_fd = -1;
#ifdef _WIN32
tun_fd = win32_setup_tun(vpninfo);
#elif defined(IFF_TUN) /* Linux */
#ifdef IFF_TUN /* Linux */
struct ifreq ifr;
int tunerr;
......@@ -322,7 +322,6 @@ static int os_setup_tun(struct openconnect_info *vpninfo)
return tun_fd;
}
#ifndef _WIN32
int openconnect_setup_tun_fd(struct openconnect_info *vpninfo, int tun_fd)
{
set_fd_cloexec(tun_fd);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment