]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
build: properly detect TUNSETPERSIST
authorAlon Bar-Lev <alon.barlev@gmail.com>
Sun, 8 Apr 2012 19:21:47 +0000 (22:21 +0300)
committerDavid Sommerseth <davids@redhat.com>
Thu, 26 Apr 2012 18:04:55 +0000 (20:04 +0200)
Do not rely on system symbol throught sources
but on autoconf detection.

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
Acked-by: David Sommerseth <davids@redhat.com>
Signed-off-by: David Sommerseth <davids@redhat.com>
configure.ac
src/openvpn/init.c
src/openvpn/options.c
src/openvpn/tun.c

index 1f32c9d4b65d42d9501e263ace7d57c5eac63273..773fa4b77b32d23766b0d6308035492bc7e67050 100644 (file)
@@ -598,6 +598,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])
 
index bc7718e40a46e46ba89d02d2cdc8c7ff2608bf45..d022edcac5d17e4723b0ea9c8520eace9adc2d8f 100644 (file)
@@ -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 */
index bd838435921e74487853e39c5a4bbc2a2948d15c..33fcb877d01c70126712eb82c72a675640d660a4 100644 (file)
@@ -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);
index b99071ceaccec50bbcb5966228b90cbccbb90890..227bfdea5c4cfffa1a51268d1f1523c92d771163 100644 (file)
@@ -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)