Skip to contentSkip to conversation

Fix bug after removing Linux 2.2 support

PATCH Superseded David Sommerseth 3 participants 5 messages Nov 24, 2011 – Nov 25, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix bug after removing Linux 2.2 support

From: David Sommerseth <[email protected]...>

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)

---
 tun.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
tun.c +2 -4
index 7a3b2e9..1defe58 100644
@@ -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, "Note: 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, "Note: Cannot ioctl TUNSETIFF %s", dev);
 	}
 
       msg (M_INFO, "TUN/TAP device %s opened", ifr.ifr_name);
Signature · 1 line
1.7.4.4
#1 lore raw

Hi,

tun.c open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu · line 1400

Quoted 3 lines · David Sommerseth
tun.c +1 -2
-	  msg (M_WARN | M_ERRNO, "Note: Cannot open TUN/TAP dev %s", node);
-	  return;
+	  msg (M_ERR, "Note: Cannot open TUN/TAP dev %s", node);

Agree in principle, but if you do so, please change s/Note:/ERROR:/ :-)

gert

Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             [email protected]...
fax: +49-89-35655025                        [email protected]...
#2 lore raw

PATCH v2 1/1 Fix bug after removing Linux 2.2 support

From: David Sommerseth <[email protected]...>

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)

---
 tun.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
tun.c +2 -4
index 7a3b2e9..d71d902 100644
@@ -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);
Signature · 1 line
1.7.4.4
#3 lore raw

Hi,

Quoted 3 lines · David Sommerseth

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.

ACK.

These really are fatal errors and there is no use in going on.

gert

Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             [email protected]...
fax: +49-89-35655025                        [email protected]...
#4 lore raw
In reply to David Sommerseth

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 16 lines · David Sommerseth

From: David Sommerseth <[email protected]...>

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.

Quoted 5 lines

*) #define M_ERR (M_FATAL | M_ERRNO) (from error.h)

tun.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)

Applied to master branch in -stable and -testing.

commit e7d1ac82f9a21ef91030e4f104d4ef0810b07f8e

Author: David Sommerseth <[email protected]...>
Date:   Thu Nov 24 22:45:21 2011 +0100
    Fix bug after removing Linux 2.2 support

    Signed-off-by: David Sommerseth <[email protected]...>
    Acked-by: Gert Doering <[email protected]...>

kind regards,

David Sommerseth
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk7PwpkACgkQDC186MBRfroAkgCfdqLb4FuOFhunFZrtzBsYjrhL yv0AniPang2dib+ltujnseCdnUWrTkxb
=2gSS
-----END PGP SIGNATURE-----