diff options
-rw-r--r-- | doc/openvpn.8 | 5 | ||||
-rw-r--r-- | src/openvpn/options.c | 13 |
2 files changed, 17 insertions, 1 deletions
diff --git a/doc/openvpn.8 b/doc/openvpn.8 index c3d95a2..6fd6aa3 100644 --- a/doc/openvpn.8 +++ b/doc/openvpn.8 @@ -1891,6 +1891,11 @@ reasons for having OpenVPN fail if it detects problems in a config file. Having said that, there are valid reasons for wanting new software features to gracefully degrade when encountered by older software versions. + +It is also possible to tag a single directive so as not to trigger +a fatal error if the directive isn't recognized. To do this, +prepend the following before the directive: +.B setenv opt .\"********************************************************* .TP .B \-\-setenv-safe name value diff --git a/src/openvpn/options.c b/src/openvpn/options.c index 9dc1531..a74639d 100644 --- a/src/openvpn/options.c +++ b/src/openvpn/options.c @@ -4031,7 +4031,18 @@ add_option (struct options *options, const bool pull_mode = BOOL_CAST (permission_mask & OPT_P_PULL_MODE); int msglevel_fc = msglevel_forward_compatible (options, msglevel); - ASSERT (MAX_PARMS >= 5); + ASSERT (MAX_PARMS >= 7); + + /* + * If directive begins with "setenv opt" prefix, don't raise an error if + * directive is unrecognized. + */ + if (streq (p[0], "setenv") && p[1] && streq (p[1], "opt") && !(permission_mask & OPT_P_PULL_MODE)) + { + p += 2; + msglevel_fc = M_WARN; + } + if (!file) { file = "[CMD-LINE]"; |