summaryrefslogtreecommitdiffstats
path: root/tun.c
diff options
context:
space:
mode:
authorDavid Sommerseth <dazo@users.sourceforge.net>2011-11-24 22:45:21 +0100
committerDavid Sommerseth <davids@redhat.com>2011-11-25 17:23:37 +0100
commite7d1ac82f9a21ef91030e4f104d4ef0810b07f8e (patch)
treeb0605ee7195c40eb08c340bfdb4d53cce6f8e71c /tun.c
parent53fb2c5c465ea97fccdc8be1823fff2616f08b50 (diff)
downloadopenvpn-e7d1ac82f9a21ef91030e4f104d4ef0810b07f8e.tar.gz
openvpn-e7d1ac82f9a21ef91030e4f104d4ef0810b07f8e.tar.xz
openvpn-e7d1ac82f9a21ef91030e4f104d4ef0810b07f8e.zip
Fix bug after removing Linux 2.2 support
In commit ce637abdafdc19547fc97192033a4d1703ecaf23 the Linux 2.2 support was removed. When this happened an extra error check was avoided which would normally kicked in if the tun/tap device would not be available. Instead the following line was filling the log continously: Thu Nov 24 22:33:15 2011 read from TUN/TAP : File descriptor in bad state (code=77) This patch changes the msg() declarations to use the M_FATAL *) flag, which will halt the execution of the program in these error sitauations. As the program will really halt, the return declarations was also removed. *) #define M_ERR (M_FATAL | M_ERRNO) (from error.h) Signed-off-by: David Sommerseth <dazo@users.sourceforge.net> Acked-by: Gert Doering <gert@greenie.muc.de>
Diffstat (limited to 'tun.c')
-rw-r--r--tun.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/tun.c b/tun.c
index 7a3b2e9..d71d902 100644
--- a/tun.c
+++ b/tun.c
@@ -1397,8 +1397,7 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu
*/
if ((tt->fd = open (node, O_RDWR)) < 0)
{
- msg (M_WARN | M_ERRNO, "Note: Cannot open TUN/TAP dev %s", node);
- return;
+ msg (M_ERR, "ERROR: Cannot open TUN/TAP dev %s", node);
}
/*
@@ -1441,8 +1440,7 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu
*/
if (ioctl (tt->fd, TUNSETIFF, (void *) &ifr) < 0)
{
- msg (M_WARN | M_ERRNO, "Note: Cannot ioctl TUNSETIFF %s", dev);
- return;
+ msg (M_ERR, "ERROR: Cannot ioctl TUNSETIFF %s", dev);
}
msg (M_INFO, "TUN/TAP device %s opened", ifr.ifr_name);