RE: [PATCH 1/1] service: only attempt to load the 'tun' modules if necessary



-----Original Message-----
From: Thomas Haller [mailto:thaller redhat com]
Sent: Friday, 04 July, 2014 18:28
To: networkmanager-list gnome org; Bastien Nocera
Cc: John Frankish; Thomas Haller
Subject: [PATCH 1/1] service: only attempt to load the 'tun' modules if
necessary

'tun' support might be compiled into the kernel, thus modprobe will always
fail.

https://mail.gnome.org/archives/networkmanager-list/2014-
July/msg00014.html

Signed-off-by: Thomas Haller <thaller redhat com>
---
 src/nm-openvpn-service.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/nm-openvpn-service.c b/src/nm-openvpn-service.c index
84968e8..b45eb28 100644
--- a/src/nm-openvpn-service.c
+++ b/src/nm-openvpn-service.c
@@ -1623,7 +1623,8 @@ main (int argc, char *argv[])
      if (debug)
              g_message ("nm-openvpn-service (version " DIST_VERSION
") starting...");

-     if (system ("/sbin/modprobe tun") == -1)
+     if (   !g_file_test ("/sys/class/misc/tun", G_FILE_TEST_EXISTS)
+         && (system ("/sbin/modprobe tun") == -1))
              exit (EXIT_FAILURE);

      plugin = nm_openvpn_plugin_new ();
--
1.9.3

Everything works fine now :)

Thanks



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]