Skip to contentSkip to conversation

test_crypto: fix test_occ_mtu_calculation with --disable-fragment

PATCH In review Frank Lichtenheld 3 participants 3 messages Jun 24, 2022 – Oct 19, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 test_crypto: fix test_occ_mtu_calculation with --disable-fragment

Doesn't make sense to test with fragment, if the code ignores it.

---
 tests/unit_tests/openvpn/test_crypto.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
tests/unit_tests/openvpn/test_crypto.c +4 -2
index 83572b82..aec4e049 100644
@@ -299,13 +299,15 @@ test_occ_mtu_calculation(void **state)
     linkmtu = calc_options_string_link_mtu(&o, &f);
     assert_int_equal(linkmtu, 1445);
 
+#if defined(ENABLE_FRAGMENT)
     /* secret, comp-lzo yes, cipher BF-CBC, auth SHA1, fragment 1200 */
     o.ce.fragment = 1200;
     linkmtu = calc_options_string_link_mtu(&o, &f);
     assert_int_equal(linkmtu, 1449);
+    o.ce.fragment = 0;
+#endif
 
     o.comp.alg = COMP_ALG_UNDEF;
-    o.ce.fragment = 0;
 #endif
 
     /* TLS mode */
@@ -350,7 +352,7 @@ test_occ_mtu_calculation(void **state)
     assert_int_equal(linkmtu, 1449);
 
 
-#if defined(USE_COMP)
+#if defined(USE_COMP) && defined(ENABLE_FRAGMENT)
     o.comp.alg = COMP_ALG_LZO;
 
     /* tls client, auth SHA1, cipher AES-256-GCM, fragment, comp-lzo yes */
Signature · 1 line
2.30.2
#2 lore raw
In reply to Frank Lichtenheld

Change makes sense :-) - have not tested any actual builds without ENABLE_FRAGMENT to verify that it exploded *before*, but it looks like this will fix it.

Your patch has been applied to the master branch.

commit 252e5d6888261d7b2aae1034c834fba8a393cef4

Author: Frank Lichtenheld
Date:   Fri Jun 24 14:26:57 2022 +0200
     test_crypto: fix test_occ_mtu_calculation with --disable-fragment

     Signed-off-by: Frank Lichtenheld <[email protected]...>
     Acked-by: Arne Schwabe <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg24550.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering