Simplify --compress parsing in options.c
PATCH v3 1/4 Simplify --compress parsing in options.c
This removes a level of identation and make the "stub" condition easier to see.
--- src/openvpn/options.c | 87 +++++++++++++++++++++---------------------- 1 file changed, 43 insertions(+), 44 deletions(-)
src/openvpn/options.c +43 -44
@@ -8458,60 +8458,59 @@ add_option(struct options *options, else if (streq(p[0], "compress") && !p[2]) {VERIFY_PERMISSION (OPT_P_COMP ); +const char *alg ="stub" ;if (p[1 ]) { -if (streq (p[1 ],"stub" )) - { - options->comp.alg =COMP_ALG_STUB ; - options->comp.flags |= (COMP_F_SWAP |COMP_F_ADVERTISE_STUBS_ONLY ); - } -else if (streq (p[1 ],"stub-v2" )) - { - options->comp.alg =COMP_ALGV2_UNCOMPRESSED ; - options->comp.flags |=COMP_F_ADVERTISE_STUBS_ONLY ; - } -else if (streq (p[1 ],"migrate" )) - { - options->comp.alg =COMP_ALG_UNDEF ; - options->comp.flags =COMP_F_MIGRATE ; + alg = p[1 ]; + } - } -else if (options->comp.flags &COMP_F_ALLOW_STUB_ONLY ) - { -/* Also printed on a push to hint at configuration problems */ -msg (msglevel,"Cannot set compress to '%s', " -"allow-compression is set to 'no'" , p[1 ]); - goto err; - } +if (streq (alg,"stub" )) + { + options->comp.alg =COMP_ALG_STUB ; + options->comp.flags |= (COMP_F_SWAP |COMP_F_ADVERTISE_STUBS_ONLY ); + } +else if (streq (alg,"stub-v2" )) + { + options->comp.alg =COMP_ALGV2_UNCOMPRESSED ; + options->comp.flags |=COMP_F_ADVERTISE_STUBS_ONLY ; + } +else if (streq (alg,"migrate" )) + { + options->comp.alg =COMP_ALG_UNDEF ; + options->comp.flags =COMP_F_MIGRATE ; + + } +else if (options->comp.flags &COMP_F_ALLOW_STUB_ONLY ) + { +/* Also printed on a push to hint at configuration problems */ +msg (msglevel,"Cannot set compress to '%s', " +"allow-compression is set to 'no'" , alg); + goto err; + }#if defined(ENABLE_LZO ) - else if (streq(p[1], "lzo")) - { - options->comp.alg =COMP_ALG_LZO ; - options->comp.flags &= ~(COMP_F_ADAPTIVE |COMP_F_SWAP ); - } + else if (streq(alg, "lzo")) + { + options->comp.alg =COMP_ALG_LZO ; + options->comp.flags &= ~(COMP_F_ADAPTIVE |COMP_F_SWAP ); + }#endif #if defined(ENABLE_LZ4 ) - else if (streq(p[1], "lz4")) - { - options->comp.alg =COMP_ALG_LZ4 ; - options->comp.flags |=COMP_F_SWAP ; - } - else if (streq(p[1], "lz4-v2")) - { - options->comp.alg =COMP_ALGV2_LZ4 ; - } -#endif - else - { -msg (msglevel,"bad comp option: %s" , p[1 ]); - goto err; - } + else if (streq(alg, "lz4")) + { + options->comp.alg =COMP_ALG_LZ4 ; + options->comp.flags |=COMP_F_SWAP ; + } + else if (streq(alg, "lz4-v2")) + { + options->comp.alg =COMP_ALGV2_LZ4 ; } +#endif else { - options->comp.alg =COMP_ALG_STUB ; - options->comp.flags |=COMP_F_SWAP ; +msg (msglevel,"bad comp option: %s" , alg); + goto err; } +show_compression_warning (&options->comp); }#endif /* USE_COMP */
Signature · 1 line
2.37.1 (Apple Git-137.1)
PATCH v3 2/4 Refuse connection if server pushes an option contradicting allow-compress
This removes also the checks in options.c itself as they we now bail out later and no longer need to ignore them during parsing.
--- Changes.rst | 4 ++++ src/openvpn/comp.c | 29 +++++++++++++++++++++++++++++ src/openvpn/comp.h | 8 ++++++++ src/openvpn/init.c | 8 ++++++++ src/openvpn/multi.c | 8 ++++++++ src/openvpn/options.c | 27 ++++----------------------- 6 files changed, 61 insertions(+), 23 deletions(-)
Changes.rst +4 -0
@@ -232,6 +232,10 @@ User-visible Changes - The ``client-pending-auth`` management command now requires also the key id. The management version has been changed to 5 to indicate this change. +- (OpenVPN 2.6.2) A client will now refuse a connection if pushed compression + settings will contradict the setting of allow-compression as this almost + always results in a non-working connection. + Common errors with OpenSSL 3.0 and OpenVPN 2.6 ---------------------------------------------- Both OpenVPN 2.6 and OpenSSL 3.0 tighten the security considerable, so some
src/openvpn/comp.c +29 -0
@@ -157,4 +157,33 @@ comp_generate_peer_info_string(const struct compress_options *opt, struct buffer } } +bool +check_compression_settings_valid (struct compress_options *info,int msglevel) +{ +if ((info->flags &COMP_F_ALLOW_STUB_ONLY ) &&comp_non_stub_enabled (info)) + { +msg (msglevel,"Compression is not allowed since allow-compression is " +"set to 'no'" ); +return false; + } +#ifndef ENABLE_LZ4 +if (info->alg ==COMP_ALGV2_LZ4 || info->alg ==COMP_ALG_LZ4 ) + { +msg (msglevel,"OpenVPN is compiled without LZ4 support. Requested " +"compression cannot be enabled." ); +return false; + } +#endif +#ifndef ENABLE_LZO +if (info->alg ==COMP_ALG_LZO || info->alg ==COMP_ALG_LZ4 ) + { +msg (msglevel,"OpenVPN is compiled without LZO support. Requested " +"compression cannot be enabled." ); +return false; + } +#endif +return true; +} + +#endif /* USE_COMP */
src/openvpn/comp.h +8 -0
@@ -196,5 +196,13 @@ comp_non_stub_enabled(const struct compress_options *info) && info->alg !=COMP_ALG_UNDEF ; } +/** +* Checks if the compression settings are valid. Takes into account the +* flags of allow-compression and also the whether algorithms are compiled +* in +*/ +bool +check_compression_settings_valid (struct compress_options *info,int msglevel); +#endif /* USE_COMP */ #endif /* ifndef OPENVPN_COMP_H */
src/openvpn/init.c +8 -0
@@ -2637,6 +2637,14 @@ do_deferred_options(struct context *c, const unsigned int found)#ifdef USE_COMP if (found &OPT_P_COMP ) { +if (!check_compression_settings_valid (&c->options.comp,D_PUSH_ERRORS )) + { +msg (D_PUSH_ERRORS ,"OPTIONS ERROR: server pushed compression " +"settings that are not allowed and will result " +"in a non-working connection. " +"See also allow-compression in the manual." ); +return false; + }msg (D_PUSH_DEBUG ,"OPTIONS IMPORT: compression parms modified" );comp_uninit (c->c2.comp_context); c->c2.comp_context =comp_init (&c->options.comp);
src/openvpn/multi.c +8 -0
@@ -2766,6 +2766,14 @@ multi_connection_established(struct multi_context *m, struct multi_instance *mi) cc_succeeded = false; } +#ifdef USE_COMP +if (!check_compression_settings_valid (&mi->context.options.comp,D_MULTI_ERRORS )) + { +msg (D_MULTI_ERRORS ,"MULTI: client has been rejected due to invalid compression options" ); + cc_succeeded = false; + } +#endif +if (cc_succeeded) {multi_client_connect_late_setup (m, mi, *option_types_found);
src/openvpn/options.c +4 -23
@@ -3779,6 +3779,9 @@ options_postprocess_mutate(struct options *o, struct env_set *es)/* this depends on o->windows_driver, which is set above */ options_postprocess_mutate_invariant (o); +/* check that compression settings in the options are okay */ +check_compression_settings_valid (&o->comp,M_USAGE ); +/* * Save certain parms before modifying options during connect, especially * when using --pull
@@ -8405,21 +8408,12 @@ add_option(struct options *options,/* All lzo variants do not use swap */ options->comp.flags &= ~COMP_F_SWAP ; -#if defined(ENABLE_LZO) +if (p[1 ] &&streq (p[1 ],"no" )) -#endif { options->comp.alg =COMP_ALG_STUB ; options->comp.flags &= ~COMP_F_ADAPTIVE ; } -#if defined(ENABLE_LZO) - else if (options->comp.flags & COMP_F_ALLOW_STUB_ONLY) - { - /* Also printed on a push to hint at configuration problems */ - msg(msglevel, "Cannot set comp-lzo to '%s', " - "allow-compression is set to 'no'", p[1]); - goto err; - }else if (p[1 ]) {if (streq (p[1 ],"yes" ))
@@ -8444,7 +8438,6 @@ add_option(struct options *options, options->comp.flags |=COMP_F_ADAPTIVE ; }show_compression_warning (&options->comp); -#endif /* if defined(ENABLE_LZO) */ }else if (streq (p[0 ],"comp-noadapt" ) && !p[1 ]) {
@@ -8478,23 +8471,12 @@ add_option(struct options *options, { options->comp.alg =COMP_ALG_UNDEF ; options->comp.flags =COMP_F_MIGRATE ; - } - else if (options->comp.flags & COMP_F_ALLOW_STUB_ONLY) - { -/* Also printed on a push to hint at configuration problems */ -msg (msglevel,"Cannot set compress to '%s', " -"allow-compression is set to 'no'" , alg); - goto err; - } -#if defined(ENABLE_LZO ) else if (streq(alg, "lzo")) { options->comp.alg =COMP_ALG_LZO ; options->comp.flags &= ~(COMP_F_ADAPTIVE |COMP_F_SWAP ); } -#endif -#if defined(ENABLE_LZ4 ) else if (streq(alg, "lz4")) { options->comp.alg =COMP_ALG_LZ4 ;
@@ -8504,7 +8486,6 @@ add_option(struct options *options, { options->comp.alg =COMP_ALGV2_LZ4 ; } -#endif else {msg (msglevel,"bad comp option: %s" , alg);
Signature · 1 line
2.37.1 (Apple Git-137.1)
PATCH v3 3/4 Add 'allow-compression stub-only' internally for DCO
In reply to Arne SchwabeThis changes the "no" setting of allow-compression to also refuse framing. This is important for our DCO implementation as these do not implement framing.
This behaviour surfaced when a commercial VPN provider was pushing "comp-lzo no" to a client with DCO. While we are technically at fault here for announcing comp-lzo no support by announcing IV_LZO_STUB=1, the VPN provider continues to push "comp-lzo no" even in absense of that flag.
As the new default we default to allow-compression stub-only if a stub option is found in the config and to allow-compression no otherwise. This ensures that we only enable DCO when no compression framing is used.
This will now also bail out if the server pushes a compression setting that we do not support as mismatching compression is almost never a working connection. In my lz4-v2 and lzo-v2 you might have a connection that works mostly but some packets will be dropped since they compressed which is not desirable either since it becomes very hard to debug.
Patch v2: bail out if server pushes an unsupported method. Also include this
bail out logic when OpenVPN is compiled without compression support.
Patch v3: always parse all compression option and move logic to check method
--- doc/man-sections/protocol-options.rst | 4 ++- src/openvpn/comp.c | 47 ++++++++++++++++++--------- src/openvpn/comp.h | 2 +- src/openvpn/options.c | 18 ++++++++-- 4 files changed, 50 insertions(+), 21 deletions(-)
doc/man-sections/protocol-options.rst +3 -1
@@ -25,7 +25,9 @@ configured in a compatible way between both the local and remote side. compression at the same time is not a feasible option. :code:`no` (default) - OpenVPN will refuse any non-stub compression. + OpenVPN will refuse any compression. If data-channel offloading + is enabled. OpenVPN will additionally also refuse compression + framing (stub). :code:`yes` OpenVPN will send and receive compressed packets.
src/openvpn/comp.c +31 -16
67 lines not on this page · raw message
src/openvpn/comp.h +1 -1
@@ -60,7 +60,7 @@* we still accept other compressions to be pushed */ #define COMP_F_MIGRATE (1<<5)/* push stub-v2 or comp-lzo no when we see a client with comp-lzo in occ */ #define COMP_F_ALLOW_ASYM (1<<6)/* Compression was explicitly set to allow asymetric compression */ - +#define COMP_F_ALLOW_NOCOMP_ONLY (1<<7)/* Do not allow compression framing (breaks DCO) */ /* * Length of prepended prefix on compressed packets
src/openvpn/options.c +15 -3
@@ -3644,10 +3644,16 @@ options_set_backwards_compatible_options(struct options *o)* * Disable compression by default starting with 2.6.0 if no other * compression related option has been explicitly set */ -if (!comp_non_stub_enabled (&o->comp) && !need_compatibility_before (o,20600 ) - && (o->comp.flags ==0 )) +if (!need_compatibility_before (o,20600 ) && (o->comp.flags ==0 )) { - o->comp.flags =COMP_F_ALLOW_STUB_ONLY |COMP_F_ADVERTISE_STUBS_ONLY ; +if (o->comp.alg ==COMP_ALG_UNDEF ) + { + o->comp.flags =COMP_F_ALLOW_NOCOMP_ONLY ; + } +else if (!comp_non_stub_enabled (&o->comp)) + { + o->comp.flags =COMP_F_ALLOW_STUB_ONLY |COMP_F_ADVERTISE_STUBS_ONLY ; + } }#endif }
@@ -3749,6 +3755,12 @@ options_postprocess_mutate(struct options *o, struct env_set *es) o->tuntap_options.disable_dco = !dco_check_option (D_DCO , o) || !dco_check_startup_option (D_DCO , o); } +#ifdef USE_COMP +if (dco_enabled (o)) + { + o->comp.flags |=COMP_F_ALLOW_NOCOMP_ONLY ; + } +#endif #ifdef _WIN32if (dco_enabled (o))
Signature · 1 line
2.37.1 (Apple Git-137.1)
PATCH v3 4/4 Parse compression options and bail out when compression is disabled
In reply to Arne SchwabeThis change keeps the option parsing of compression options even when compression is disabled. This allows OpenVPN to also refuse/reject connections that try to use compression when compression is completely disabled.
--- src/openvpn/comp.c | 14 ++++--- src/openvpn/comp.h | 85 ++++++++++++++++++++++--------------------- src/openvpn/init.c | 2 - src/openvpn/multi.c | 2 - src/openvpn/options.c | 12 +----- src/openvpn/options.h | 4 -- 6 files changed, 54 insertions(+), 65 deletions(-)
src/openvpn/comp.c +9 -5
@@ -29,10 +29,11 @@#include "syshead.h" -#ifdef USE_COMP -#include "comp.h" #include "error.h" + +#ifdef USE_COMP +#include "otime.h" #include "memdbg.h"
@@ -158,6 +159,7 @@ comp_generate_peer_info_string(const struct compress_options *opt, struct bufferbuf_printf (out,"IV_COMP_STUB=1\n" ); buf_printf(out, "IV_COMP_STUBv2=1\n"); } +#endif /* USE_COMP */ bool check_compression_settings_valid (struct compress_options *info,int msglevel)
@@ -170,8 +172,13 @@ check_compression_settings_valid(struct compress_options *info, int msglevel)if (info->alg !=COMP_ALGV2_UNCOMPRESSED && info->alg !=COMP_ALG_UNDEF && (info->flags &COMP_F_ALLOW_NOCOMP_ONLY )) { +#ifdef USE_COMP msg (msglevel,"Compression or compression stub framing is not allowed " "since data-channel offloading is enabled." ); +#else +msg (msglevel,"Compression or compression stub framing is not allowed " +"since OpenVPN was built without compression support." ); +#endif return false; }
@@ -199,6 +206,3 @@ check_compression_settings_valid(struct compress_options *info, int msglevel)#endif return true; } - - -#endif /* USE_COMP */
src/openvpn/comp.h +43 -42
109 lines not on this page · raw message
src/openvpn/init.c +0 -2
@@ -2634,7 +2634,6 @@ do_deferred_options(struct context *c, const unsigned int found) } } -#ifdef USE_COMP if (found &OPT_P_COMP ) {if (!check_compression_settings_valid (&c->options.comp,D_PUSH_ERRORS ))
@@ -2649,7 +2648,6 @@ do_deferred_options(struct context *c, const unsigned int found)comp_uninit (c->c2.comp_context); c->c2.comp_context =comp_init (&c->options.comp); } -#endif if (found &OPT_P_SHAPER ) {
src/openvpn/multi.c +0 -2
@@ -2766,13 +2766,11 @@ multi_connection_established(struct multi_context *m, struct multi_instance *mi) cc_succeeded = false; } -#ifdef USE_COMP if (!check_compression_settings_valid (&mi->context.options.comp,D_MULTI_ERRORS )) {msg (D_MULTI_ERRORS ,"MULTI: client has been rejected due to invalid compression options" ); cc_succeeded = false; } -#endif if (cc_succeeded) {
src/openvpn/options.c +2 -10
@@ -1906,10 +1906,8 @@ show_settings(const struct options *o)SHOW_BOOL (fast_io); -#ifdef USE_COMP SHOW_INT (comp.alg);SHOW_INT (comp.flags); -#endif SHOW_STR (route_script);SHOW_STR (route_default_gateway);
@@ -3320,9 +3318,7 @@ pre_connect_save(struct options *o) o->pre_connect->ping_send_timeout = o->ping_send_timeout;/* Miscellaneous Options */ -#ifdef USE_COMP o->pre_connect->comp = o->comp; -#endif }void
@@ -3386,9 +3382,7 @@ pre_connect_restore(struct options *o, struct gc_arena *gc) o->ping_send_timeout = pp->ping_send_timeout;/* Miscellaneous Options */ -#ifdef USE_COMP o->comp = pp->comp; -#endif } o->push_continuation =0 ;
@@ -3655,6 +3649,8 @@ options_set_backwards_compatible_options(struct options *o) o->comp.flags = COMP_F_ALLOW_STUB_ONLY | COMP_F_ADVERTISE_STUBS_ONLY; } } +#else /* ifdef USE_COMP */ + o->comp.flags =COMP_F_ALLOW_NOCOMP_ONLY ;#endif }
@@ -5669,7 +5665,6 @@ set_user_script(struct options *options,#endif } -#ifdef USE_COMP static void show_compression_warning (struct compress_options *info) {
@@ -5688,7 +5683,6 @@ show_compression_warning(struct compress_options *info) } } } -#endif bool key_is_external (const struct options *options)
@@ -8370,7 +8364,6 @@ add_option(struct options *options, options->passtos = true; }#endif -#if defined(USE_COMP ) else if (streq(p[0], "allow-compression") && p[1] && !p[2]) {VERIFY_PERMISSION (OPT_P_GENERAL );
@@ -8506,7 +8499,6 @@ add_option(struct options *options,show_compression_warning (&options->comp); } -#endif /* USE_COMP */ else if (streq (p[0 ],"show-ciphers" ) && !p[1 ]) {VERIFY_PERMISSION (OPT_P_GENERAL );
src/openvpn/options.h +0 -4
@@ -87,9 +87,7 @@ struct options_pre_connectint ping_rec_timeout_action;int foreign_option_index; -#ifdef USE_COMP struct compress_options comp; -#endif };#if !defined(ENABLE_CRYPTO_OPENSSL ) && !defined(ENABLE_CRYPTO_MBEDTLS )
@@ -395,9 +393,7 @@ struct options/* optimize TUN/TAP/UDP writes */ bool fast_io; -#ifdef USE_COMP struct compress_options comp; -#endif /* buffer sizes */ int rcvbuf;
Signature · 1 line
2.37.1 (Apple Git-137.1)
"git show -w" shows that this is mostly whitespace changes and streq()'ing alg instead of p[1] - with alg defaulting to "stub" now (instead of having an else{} clause for "no option" that does the same).
There is a minor difference, as "compress <no args>" would set COMP_F_SWAP beforehand, and now adds COMP_F_ADVERTISE_STUBS_ONLY, which might warrant an update to the documentation (it says "Additionally, 'stub' and 'stub-v2' will disable announcing lzo and lz4 compression", so there is a documented difference to 'empty').
Client-side tested on Linux / t_client with and without compression.
Your patch has been applied to the master and release/2.6 branch.
commit bfc00a01c10bbdd9683aab5db2c2e7dcbb2f7378 (master) commit 5fed4be1bf4b2c6e4ff0117bceb9613fa68b412d (release/2.6)
Author: Arne Schwabe Date: Thu Mar 23 18:05:58 2023 +0100
Simplify --compress parsing in options.c
Signed-off-by: Arne Schwabe <[email protected]...>
Acked-by: Gert Doering <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg26501.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
[Openvpn-devel] [PATCH applied] Re: Refuse connection if server pushes an option contradicting allow-compress
In reply to Arne SchwabeWe had a long and heated discussion about this... I wanted a 3-liner that just does the "if (DCO && compression) { explode(); }" bit, but this is indeed making the code more readable - and my fix might have interfered with server / ccd/ option handling anyway.
This patch in itself does not change any behaviour yet (= a client without any compression option in its config will accept "comp-lzo no", going to stub mode, and will not accept "compress $nonstub").
Tested over dinner on the client/server testbeds, with and without compression. This all passed.
I have also tested pushing a compression option to an "unsuspecting client" ("comp-lzo no" works, "compress lz4" is refused) and also having something in ccd/ on an "unsuspecting DCO server without compression" (will reject the client, even for "comp-lzo no" or "stub-v2").
"compress migrate" plus a client with "comp-lzo" will also still do the right thing and push "compress stub-v2".
Your patch has been applied to the master and release/2.6 branch.
commit e86bc8b2967484afdb1e96efddb8d91185c4cc2c (master) commit e950ca1b9fca58e97aacedc5c0229856aa1e4e86 (release/2.6)
Author: Arne Schwabe Date: Thu Mar 23 18:05:59 2023 +0100
Refuse connection if server pushes an option contradicting allow-compress
Signed-off-by: Arne Schwabe <[email protected]...>
Acked-by: Gert Doering <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg26503.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
Re: [Openvpn-devel] [PATCH v3 3/4] Add 'allow-compression stub-only' internally for DCO
In reply to Arne SchwabeHi,
Quoted 6 lines · Arne Schwabe
index
435e1ca9e..92f7456a4100644src/openvpn/options.c +0
-0@@ -3644,10 +3644,16 @@ options_set_backwards_compatible_options(struct options *o)* * Disable compression by default starting with 2.6.0 if no other
src/openvpn/options.c options_set_backwards_compatible_options(struct options *o) · line 3652
Quoted 10 lines
src/openvpn/options.c +5
-3* compression related option has been explicitly set */ -if (!comp_non_stub_enabled (&o->comp) && !need_compatibility_before (o,20600 ) - && (o->comp.flags ==0 )) +if (!need_compatibility_before (o,20600 ) && (o->comp.flags ==0 )) { - o->comp.flags =COMP_F_ALLOW_STUB_ONLY |COMP_F_ADVERTISE_STUBS_ONLY ; +if (o->comp.alg ==COMP_ALG_UNDEF ) + { + o->comp.flags =COMP_F_ALLOW_NOCOMP_ONLY ; + }
This breaks the scenario in question ("no compress in config, server pushes 'comp-lzo no'") unconditionally.
I thought we agreed that we only want to break this for "if DCO", because this is what we *have* to break.
src/openvpn/options.c options_postprocess_mutate(struct options *o, struct env_set *es) · line 3763
Quoted 10 lines
src/openvpn/options.c +6
-0@@ -3749,6 +3755,12 @@ options_postprocess_mutate(struct options *o, struct env_set *es) o->tuntap_options.disable_dco = !dco_check_option (D_DCO , o) || !dco_check_startup_option (D_DCO , o); } +#ifdef USE_COMP +if (dco_enabled (o)) + { + o->comp.flags |=COMP_F_ALLOW_NOCOMP_ONLY ; + } +#endif
... and that's the code for it.
So, NAK, some more hours wasted on testing.
gert
Signature · 6 lines
"If was one thing all people took for granted, was conviction that if you
feed honest figures into a computer, honest figures come out. Never doubted
it myself till I met a computer with a sense of humor."
Robert A. Heinlein, The Moon is a Harsh Mistress
Gert Doering - Munich, Germany [email protected]...Re: [Openvpn-devel] [PATCH v3 4/4] Parse compression options and bail out when compression is disabled
In reply to Arne SchwabeHi,
Quoted 3 lines · Arne Schwabe
This change keeps the option parsing of compression options even when compression is disabled. This allows OpenVPN to also refuse/reject connections that try to use compression when compression is completely disabled.
Amazing as that might be, if you actually disable compression, master + 4/4 does not compile anymore...
depbase=echo init.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'; cc -DHAVE_CONFIG_H -I. -I../.. -I../../include -I../../include -I../../src/compat -DPLUGIN_LIBDIR=\"/usr/local/lib/openvpn/plugins\" -Wall -g -O2 -std=c99 -MT init.o -MD -MP -MF $depbase.Tpo -c -o init.o init.c && mv -f $depbase.Tpo $depbase.Po
init.c:2648:9: warning: implicit declaration of function 'comp_uninit' is
invalid in C99 [-Wimplicit-function-declaration]
comp_uninit(c->c2.comp_context);
^
init.c:2648:27: error: no member named 'comp_context' in 'struct context_2'; did
you mean 'mda_context'?
comp_uninit(c->c2.comp_context);
^~~~~~~~~~~~
mda_context
./openvpn.h:459:33: note: 'mda_context' declared here
struct man_def_auth_context mda_context;
^init.c:2649:30: warning: implicit declaration of function 'comp_init' is invalid
in C99 [-Wimplicit-function-declaration]
c->c2.comp_context = comp_init(&c->options.comp);
init.c:2649:15: error: no member named 'comp_context' in 'struct context_2'; did
you mean 'mda_context'?
c->c2.comp_context = comp_init(&c->options.comp);
^~~~~~~~~~~~
mda_context
./openvpn.h:459:33: note: 'mda_context' declared here
struct man_def_auth_context mda_context;
^
init.c:2649:28: error: assigning to 'struct man_def_auth_context' from
incompatible type 'int'
c->c2.comp_context = comp_init(&c->options.comp);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~2 warnings and 3 errors generated.
*** Error code 1
so, NAK.
gert
Signature · 6 lines
"If was one thing all people took for granted, was conviction that if you
feed honest figures into a computer, honest figures come out. Never doubted
it myself till I met a computer with a sense of humor."
Robert A. Heinlein, The Moon is a Harsh Mistress
Gert Doering - Munich, Germany [email protected]...