Fixes Trac #71 (see comments 37 to 43)

Signed-off-by: Selva Nair <selva.n...@gmail.com>
---
 src/openvpn/tun.c |   18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c
index b70410d..11027dd 100644
--- a/src/openvpn/tun.c
+++ b/src/openvpn/tun.c
@@ -62,7 +62,7 @@ static void netsh_ifconfig (const struct tuntap_options *to,
                            const in_addr_t ip,
                            const in_addr_t netmask,
                            const unsigned int flags);
-static void netsh_command (const struct argv *a, int n);
+static void netsh_command (const struct argv *a, int n, int msglevel);

 static const char *netsh_get_id (const char *dev_node, struct gc_arena *gc);

@@ -1246,7 +1246,7 @@ do_ifconfig (struct tuntap *tt,
                     NETSH_PATH_SUFFIX,
                     win32_version_info() == WIN_XP ? actual : iface,
                     ifconfig_ipv6_local);
-       netsh_command (&argv, 4);
+       netsh_command (&argv, 4, M_FATAL);

        /* explicit route needed */
        /* on windows, OpenVPN does ifconfig first, open_tun later, so
@@ -4246,7 +4246,7 @@ dhcp_renew (const struct tuntap *tt)
  */

 static void
-netsh_command (const struct argv *a, int n)
+netsh_command (const struct argv *a, int n, int msglevel)
 {
   int i;
   for (i = 0; i < n; ++i)
@@ -4261,7 +4261,7 @@ netsh_command (const struct argv *a, int n)
        return;
       openvpn_sleep (4);
     }
-  msg (M_FATAL, "NETSH: command failed");
+  msg (msglevel, "NETSH: command failed");
 }

 void
@@ -4411,7 +4411,7 @@ netsh_ifconfig_options (const char *type,
                   NETSH_PATH_SUFFIX,
                   type,
                   flex_name);
-      netsh_command (&argv, 2);
+      netsh_command (&argv, 2, M_FATAL);
     }

   /* add new DNS/WINS settings to TAP interface */
@@ -4432,7 +4432,7 @@ netsh_ifconfig_options (const char *type,
                         type,
                         flex_name,
                         print_in_addr_t (addr_list[i], 0, &gc));
-           netsh_command (&argv, 2);
+           netsh_command (&argv, 2, M_FATAL);

            ++count;
          }
@@ -4507,7 +4507,7 @@ netsh_ifconfig (const struct tuntap_options *to,
                       print_in_addr_t (ip, 0, &gc),
                       print_in_addr_t (netmask, 0, &gc));

-         netsh_command (&argv, 4);
+         netsh_command (&argv, 4, M_FATAL);
        }
     }

@@ -4553,7 +4553,7 @@ netsh_enable_dhcp (const struct tuntap_options *to,
               NETSH_PATH_SUFFIX,
               actual_name);

-  netsh_command (&argv, 4);
+  netsh_command (&argv, 4, M_FATAL);

   argv_reset (&argv);
 }
@@ -5269,7 +5269,7 @@ close_tun (struct tuntap *tt)
                     tt->actual_name,
                     ifconfig_ipv6_local );

-         netsh_command (&argv, 1);
+         netsh_command (&argv, 1, M_WARN);
           argv_reset (&argv);
        }
 #if 1
-- 
1.7.10.4


Reply via email to