]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
dco: add helper function to detect if DCO is enabled or not
authorAntonio Quartulli <a@unstable.cc>
Fri, 24 Jun 2022 08:37:46 +0000 (10:37 +0200)
committerGert Doering <gert@greenie.muc.de>
Tue, 28 Jun 2022 15:09:22 +0000 (17:09 +0200)
Signed-off-by: Antonio Quartulli <a@unstable.cc>
Acked-by: Arne Schwabe <arne@rfc2549.org>
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 <gert@greenie.muc.de>
src/openvpn/options.h
src/openvpn/tun.h

index 0e50c19e42cd7f9e188039d50f9980bd0ab6fd42..f7e3f2659d841ca033615c438691be47da58d1e8 100644 (file)
@@ -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 */
index 60cd574dfe849ed7948dfc2ad4abf33409fee6af..5fcea5903f75ac4c6e8f69823a6d9ff1980da07e 100644 (file)
@@ -139,6 +139,7 @@ struct tuntap_options {
 
 struct tuntap_options {
     int txqueuelen;
+    bool disable_dco;
 };
 
 #else  /* if defined(_WIN32) || defined(TARGET_ANDROID) */