From: Antonio Quartulli
Date: Fri, 24 Jun 2022 08:37:46 +0000 (+0200)
Subject: dco: add helper function to detect if DCO is enabled or not
X-Git-Tag: v2.6_beta1~176
X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4f1671fabdce2df94f01e63ff97191325c5bfa8c;p=thirdparty%2Fopenvpn.git
dco: add helper function to detect if DCO is enabled or not
Signed-off-by: Antonio Quartulli
Acked-by: Arne Schwabe
Message-Id: <20220624083809.23487-3-a@unstable.cc>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg24513.html
Signed-off-by: Gert Doering
---
diff --git a/src/openvpn/options.h b/src/openvpn/options.h
index 0e50c19e4..f7e3f2659 100644
--- a/src/openvpn/options.h
+++ b/src/openvpn/options.h
@@ -879,4 +879,24 @@ void options_string_import(struct options *options,
bool key_is_external(const struct options *options);
+#if defined(ENABLE_DCO) && defined(TARGET_LINUX)
+
+/**
+ * Returns whether the current configuration has dco enabled.
+ */
+static inline bool
+dco_enabled(const struct options *o)
+{
+ return !o->tuntap_options.disable_dco;
+}
+
+#else /* if defined(ENABLE_DCO) && defined(TARGET_LINUX) */
+
+static inline bool
+dco_enabled(const struct options *o)
+{
+ return false;
+}
+
+#endif
#endif /* ifndef OPTIONS_H */
diff --git a/src/openvpn/tun.h b/src/openvpn/tun.h
index 60cd574df..5fcea5903 100644
--- a/src/openvpn/tun.h
+++ b/src/openvpn/tun.h
@@ -139,6 +139,7 @@ struct tuntap_options {
struct tuntap_options {
int txqueuelen;
+ bool disable_dco;
};
#else /* if defined(_WIN32) || defined(TARGET_ANDROID) */