aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonio Quartulli2022-08-02 15:03:12 +0200
committerGert Doering2022-08-18 19:33:48 +0200
commit78b8d0e162e1fa34780ee3d3ea84691539a0b1f3 (patch)
treea27a5fdadbad8516d139b136bb43fbafdacc252f
parent31346b8d8df6fb09faa56d53508205a8b74c15df (diff)
downloadopenvpn-78b8d0e162e1fa34780ee3d3ea84691539a0b1f3.zip
openvpn-78b8d0e162e1fa34780ee3d3ea84691539a0b1f3.tar.gz
dco: move availability check to the end of check_option_conflict() function
To better arrange the order DCO option conflict messages are printed, we decided to first perform all needed checks on provided options and, only at the end, if no conflict was detected, to check if DCO is really available on the system. This way a user gets prompted with all warnings about their configuration first and, when everything is fixed, they will see if DCO is available or not. While at it, compress the first check in just one if to make the code simpler. Signed-off-by: Antonio Quartulli <a@unstable.cc> Acked-by: Frank Lichtenheld <frank@lichtenheld.com> Message-Id: <20220802130312.18871-1-a@unstable.cc> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg24783.html Signed-off-by: Gert Doering <gert@greenie.muc.de>
-rw-r--r--src/openvpn/dco.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/src/openvpn/dco.c b/src/openvpn/dco.c
index 9eb2685..a067c70 100644
--- a/src/openvpn/dco.c
+++ b/src/openvpn/dco.c
@@ -311,18 +311,11 @@ dco_check_option_conflict_ce(const struct connection_entry *ce, int msglevel)
bool
dco_check_option_conflict(int msglevel, const struct options *o)
{
- if (o->tuntap_options.disable_dco)
- {
- /* already disabled by --disable-dco, no need to print warnings */
- return false;
- }
-
- if (!dco_available(msglevel))
- {
- return false;
- }
-
- if (!o->dev)
+ /* check if DCO was already disabled by the user or if no dev name was
+ * specified at all. In the latter case, later logic will most likely stop
+ * OpenVPN, so no need to print any message here.
+ */
+ if (o->tuntap_options.disable_dco || !o->dev)
{
return false;
}
@@ -399,7 +392,10 @@ dco_check_option_conflict(int msglevel, const struct options *o)
}
gc_free(&gc);
- return true;
+ /* now that all options have been confirmed to be supported, check
+ * if DCO is truly available on the system
+ */
+ return dco_available(msglevel);
}
bool