Skip to contentSkip to conversation

build: properly detect TUNSETPERSIST

PATCH In review Alon Bar-Lev 2 participants 2 messages Apr 8, 2012 – Apr 26, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 build: properly detect TUNSETPERSIST

Do not rely on system symbol throught sources
but on autoconf detection.

---
 configure.ac          |   10 ++++++++++
 src/openvpn/init.c    |    2 +-
 src/openvpn/options.c |    8 ++++----
 src/openvpn/tun.c     |    4 ++--
 4 files changed, 17 insertions(+), 7 deletions(-)
configure.ac +10 -0
index 0f1ca99..d40f7dc 100644
@@ -595,6 +595,16 @@ AC_CHECK_HEADERS(
 	],
 	[have_tap_header="yes"]
 )
+AC_CHECK_DECLS(
+	[TUNSETPERSIST],
+	[AC_DEFINE([ENABLE_FEATURE_TUN_PERSIST], [1], [We have persist tun capability])],
+	,
+	[[
+		#ifdef HAVE_LINUX_IF_TUN_H
+		#include <linux/if_tun.h>
+		#endif
+	]]
+)
 CFLAGS="${old_CFLAGS}"
 test "${have_tap_header}" = "yes" || AC_MSG_ERROR([no tap header could be found])
 
src/openvpn/init.c +1 -1
index bc7718e..d022edc 100644
@@ -954,7 +954,7 @@ do_genkey (const struct options * options)
 bool
 do_persist_tuntap (const struct options *options)
 {
-#ifdef TUNSETPERSIST
+#ifdef ENABLE_FEATURE_TUN_PERSIST
   if (options->persist_config)
     {
       /* sanity check on options for --mktun or --rmtun */
src/openvpn/options.c +4 -4
index bd83843..33fcb87 100644
@@ -725,7 +725,7 @@ static const char usage_message[] =
   "                  for use with the --secret option.\n"
   "--secret file   : Write key to file.\n"
 #endif				/* ENABLE_CRYPTO */
-#ifdef TUNSETPERSIST
+#ifdef ENABLE_FEATURE_TUN_PERSIST
   "\n"
   "Tun/tap config mode (available with linux 2.4+):\n"
   "--mktun         : Create a persistent tunnel.\n"
@@ -791,7 +791,7 @@ init_options (struct options *o, const bool init_gc)
   o->management_echo_buffer_size = 100;
   o->management_state_buffer_size = 100;
 #endif
-#ifdef TUNSETPERSIST
+#ifdef ENABLE_FEATURE_TUN_PERSIST
   o->persist_mode = 1;
 #endif
 #ifndef WIN32
@@ -1420,7 +1420,7 @@ show_settings (const struct options *o)
   
   SHOW_INT (mode);
 
-#ifdef TUNSETPERSIST
+#ifdef ENABLE_FEATURE_TUN_PERSIST
   SHOW_BOOL (persist_config);
   SHOW_INT (persist_mode);
 #endif
@@ -6788,7 +6788,7 @@ add_option (struct options *options,
       options->pkcs11_id_management = true;
     }
 #endif
-#ifdef TUNSETPERSIST
+#ifdef ENABLE_FEATURE_TUN_PERSIST
   else if (streq (p[0], "rmtun"))
     {
       VERIFY_PERMISSION (OPT_P_GENERAL);
src/openvpn/tun.c +2 -2
index b99071c..227bfde 100644
@@ -1517,7 +1517,7 @@ open_tun (const char *dev, const char *dev_type, const char *dev_node, struct tu
 
 #endif /* HAVE_LINUX_IF_TUN_H */
 
-#ifdef TUNSETPERSIST
+#ifdef ENABLE_FEATURE_TUN_PERSIST
 
 /*
  * This can be removed in future
@@ -1567,7 +1567,7 @@ tuncfg (const char *dev, const char *dev_type, const char *dev_node, int persist
   msg (M_INFO, "Persist state set to: %s", (persist_mode ? "ON" : "OFF"));
 }
 
-#endif /* TUNSETPERSIST */
+#endif /* ENABLE_FEATURE_TUN_PERSIST */
 
 void
 close_tun (struct tuntap *tt)
Signature · 1 line
1.7.3.4
#1 lore raw

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

Quoted 7 lines · Alon Bar-Lev

Do not rely on system symbol throught sources but on autoconf detection.

configure.ac | 10 ++++++++++ src/openvpn/init.c |
2 +- src/openvpn/options.c | 8 ++++---- src/openvpn/tun.c |
4 ++-- 4 files changed, 17 insertions(+), 7 deletions(-)

ACK. Applied to master on -testing and stable trees.

commit 88f3a4026c48e92bf3ce18d7611b7b88f7bed0be

Author: Alon Bar-Lev <[email protected]...>
Date:   Sun Apr 8 22:21:47 2012 +0300
    build: properly detect TUNSETPERSIST

    Signed-off-by: Alon Bar-Lev <[email protected]...>
    Acked-by: David Sommerseth <[email protected]...>
    Signed-off-by: David Sommerseth <[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/

iEYEARECAAYFAk+Znx0ACgkQDC186MBRfrosWACfe6M4dSExF+PnxnTUz8SsIada nC0AnAlzgK4la5UDNgdvUZ0FvTMibSSE
=zhhN
-----END PGP SIGNATURE-----