Print helpful error message on --mktun/--rmtun if not available.
PATCH 1/1 Print helpful error message on --mktun/--rmtun if not available.
OpenVPN only supports --mktun/--rmtun to create/destroy persistant tunnels on Linux. On BSD OSes, "ifconfig tun0 create" can do the same job, so we do not actually need to support it - but the previous error message ("unknown option") wasn't helpful. So always accept the option now, and on non-supported systems, direct user to manpage.
Trac #85
--- src/openvpn/init.c | 10 ++++++++-- src/openvpn/options.c | 2 -- 2 files changed, 8 insertions(+), 4 deletions(-)
src/openvpn/init.c +8 -2
@@ -887,7 +887,6 @@ do_genkey (const struct options * options)bool do_persist_tuntap (const struct options *options) { -#ifdef ENABLE_FEATURE_TUN_PERSIST if (options->persist_config) {/* sanity check on options for --mktun or --rmtun */
@@ -901,14 +900,21 @@ do_persist_tuntap (const struct options *options) )msg (M_FATAL |M_OPTERR ,"options --mktun or --rmtun should only be used together with --dev" ); +#ifdef ENABLE_FEATURE_TUN_PERSIST tuncfg (options->dev, options->dev_type, options->dev_node, options->persist_mode, options->username, options->groupname, &options->tuntap_options);if (options->persist_mode && options->lladdr)set_lladdr (options->dev, options->lladdr,NULL );return true; - } +#else +msg (M_FATAL |M_OPTERR , +"options --mktun and --rmtun are not available on your operating " +"system. Please check 'man tun' (or 'tap'), whether your system " +"supports using 'ifconfig %s create' / 'destroy' to create/remove " +"persistant tunnel interfaces." , options->dev );#endif + }return false; }
src/openvpn/options.c +0 -2
@@ -7023,7 +7023,6 @@ add_option (struct options *options, options->pkcs11_id_management = true; }#endif -#ifdef ENABLE_FEATURE_TUN_PERSIST else if (streq (p[0], "rmtun")) {VERIFY_PERMISSION (OPT_P_GENERAL );
@@ -7036,7 +7035,6 @@ add_option (struct options *options, options->persist_config = true; options->persist_mode =1 ; } -#endif else if (streq (p[0 ],"peer-id" )) {VERIFY_PERMISSION (OPT_P_PEER_ID );
Signature · 1 line
2.2.2
Quoted 63 lines · Gert Doering
OpenVPN only supports --mktun/--rmtun to create/destroy persistant tunnels on Linux. On BSD OSes, "ifconfig tun0 create" can do the same job, so we do not actually need to support it - but the previous error message ("unknown option") wasn't helpful. So always accept the option now, and on non-supported systems, direct user to manpage.
Trac #85
Signed-off-by Gert Doering <[email protected]...>--- src/openvpn/init.c | 10 ++++++++-- src/openvpn/options.c | 2 -- 2 files changed, 8 insertions(+), 4 deletions(-)src/openvpn/init.c +8
-2@@ -887,7 +887,6 @@ do_genkey (const struct options * options)bool do_persist_tuntap (const struct options *options) { -#ifdef ENABLE_FEATURE_TUN_PERSIST if (options->persist_config) {/* sanity check on options for --mktun or --rmtun */ @@ -901,14 +900,21 @@ do_persist_tuntap (const struct options *options) )msg (M_FATAL |M_OPTERR ,"options --mktun or --rmtun should only be used together with --dev" ); +#ifdef ENABLE_FEATURE_TUN_PERSIST tuncfg (options->dev, options->dev_type, options->dev_node, options->persist_mode, options->username, options->groupname, &options->tuntap_options);if (options->persist_mode && options->lladdr)set_lladdr (options->dev, options->lladdr,NULL );return true; - } +#else +msg (M_FATAL |M_OPTERR , +"options --mktun and --rmtun are not available on your operating " +"system. Please check 'man tun' (or 'tap'), whether your system " +"supports using 'ifconfig %s create' / 'destroy' to create/remove " +"persistant tunnel interfaces." , options->dev );#endif + }return false; }src/openvpn/options.c +0
-1@@ -7023,7 +7023,6 @@ add_option (struct options *options, options->pkcs11_id_management = true; }#endif -#ifdef ENABLE_FEATURE_TUN_PERSIST else if (streq (p[0], "rmtun")) {VERIFY_PERMISSION (OPT_P_GENERAL );
src/openvpn/options.c add_option (struct options *options, · line 7040
Quoted 7 lines
src/openvpn/options.c +0
-1@@ -7036,7 +7035,6 @@ add_option (struct options *options, options->persist_config = true; options->persist_mode =1 ; } -#endif else if (streq (p[0 ],"peer-id" )) {VERIFY_PERMISSION (OPT_P_PEER_ID );
(Lets try again, this time to the mailing list)
ACK.
Signature · 3 lines
kind regards, David Sommerseth
Patch has been applied to the master and release/2.3 branches.
commit 4ad2b65d9deb3197d847d7dcc36715aa5394836f (master) commit 1a7fc1ea2207580693b2801099f8a473f1c07828 (release/2.3)
Author: Gert Doering Date: Tue Apr 28 13:04:23 2015 +0200
Print helpful error message on --mktun/--rmtun if not available.
Signed-off-by: Gert Doering <[email protected]...>
Acked-by: David Sommerseth <[email protected]...>
Message-Id: <[email protected]...>
URL: http://article.gmane.org/gmane.network.openvpn.devel/9617--
kind regards,
Gert Doering