All the checks in there are only relevant during startup, and
specifically the capability check might cause issues when checking a CCD
config later at runtime.
So move them to their own function and call it only during startup.
Acked-by: Antonio Quartulli <a@unstable.cc>
Message-Id: <
20220817210857.1558-1-timo@rothenpieler.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg24969.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
}
}
-static bool
-dco_check_option_conflict_platform(int msglevel, const struct options *o)
+bool
+dco_check_startup_option_conflict(int msglevel, const struct options *o)
{
#if defined(TARGET_LINUX)
/* if the device name is fixed, we need to check if an interface with this
return false;
}
- if (!dco_check_option_conflict_platform(msglevel, o))
- {
- return false;
- }
-
if (dev_type_enum(o->dev, o->dev_type) != DEV_TYPE_TUN)
{
msg(msglevel, "Note: dev-type not tun, disabling data channel offload.");
*/
bool dco_check_option_conflict(int msglevel, const struct options *o);
+/**
+ * Check whether the options struct has any further option that is not supported
+ * by our current dco implementation during early startup.
+ * If so print a warning at warning level for the first conflicting option
+ * found and return false.
+ *
+ * @param msglevel the msg level to use to print the warnings
+ * @param o the options struct that hold the options
+ * @return true if no conflict was detected, false otherwise
+ */
+bool dco_check_startup_option_conflict(int msglevel, const struct options *o);
+
/**
* Check whether any of the options pushed by the server is not supported by
* our current dco implementation. If so print a warning at warning level
return false;
}
+static inline bool
+dco_check_startup_option_conflict(int msglevel, const struct options *o)
+{
+ return false;
+}
+
static inline bool
dco_check_pull_options(int msglevel, const struct options *o)
{
/* check if any option should force disabling DCO */
#if defined(TARGET_LINUX) || defined(TARGET_FREEBSD)
- o->tuntap_options.disable_dco = !dco_check_option_conflict(D_DCO, o);
+ o->tuntap_options.disable_dco = !dco_check_option_conflict(D_DCO, o)
+ || !dco_check_startup_option_conflict(D_DCO, o);
#endif
if (dco_enabled(o) && o->dev_node)