Skip to contentSkip to conversation

fix compilation issues with small and w/o debug

PATCH In review Ilya Ponetayev 3 participants 3 messages Jun 17, 2022 – Jun 21, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix compilation issues with small and w/o debug

---
 src/openvpn/init.c      | 2 +-
 src/openvpn/mtcp.c      | 2 ++
 src/openvpn/packet_id.c | 2 ++
 src/openvpn/reliable.c  | 2 ++
 4 files changed, 7 insertions(+), 1 deletion(-)
src/openvpn/init.c +1 -1
index b0c62a85..f06afc29 100644
@@ -2491,7 +2491,7 @@ frame_finalize_options(struct context *c, const struct options *o)
     size_t tailroom = headroom;
 
 #ifdef USE_COMP
-    msg(D_MTU_DEBUG, "MTU: adding %lu buffer tailroom for compression for %lu "
+    msg(D_MTU_DEBUG, "MTU: adding %zu buffer tailroom for compression for %zu "
         "bytes of payload",
         COMP_EXTRA_BUFFER(payload_size), payload_size);
     tailroom += COMP_EXTRA_BUFFER(payload_size);
src/openvpn/mtcp.c +2 -0
index b725bebb..b3c153fe 100644
@@ -72,6 +72,7 @@ struct ta_iow_flags
     unsigned int sock;
 };
 
+#ifdef ENABLE_DEBUG
 static const char *
 pract(int action)
 {
@@ -114,6 +115,7 @@ pract(int action)
             return "?";
     }
 }
+#endif /* ENABLE_DEBUG */
 
 static struct multi_instance *
 multi_create_instance_tcp(struct multi_context *m)
src/openvpn/packet_id.c +2 -0
index e357909d..851b506c 100644
@@ -53,11 +53,13 @@
 #define SEQ_UNSEEN  ((time_t)0)
 #define SEQ_EXPIRED ((time_t)1)
 
+#ifdef ENABLE_DEBUG
 static void packet_id_debug_print(int msglevel,
                                   const struct packet_id_rec *p,
                                   const struct packet_id_net *pin,
                                   const char *message,
                                   int value);
+#endif /* ENABLE_DEBUG */
 
 static inline void
 packet_id_debug(int msglevel,
src/openvpn/reliable.c +2 -0
index 37244435..73473625 100644
@@ -394,6 +394,7 @@ reliable_send_purge(struct reliable *rel, const struct reliable_ack *ack)
     }
 }
 
+#ifdef ENABLE_DEBUG
 /* print the current sequence of active packet IDs */
 static const char *
 reliable_print_ids(const struct reliable *rel, struct gc_arena *gc)
@@ -412,6 +413,7 @@ reliable_print_ids(const struct reliable *rel, struct gc_arena *gc)
     }
     return BSTR(&out);
 }
+#endif /* ENABLE_DEBUG */
 
 /* true if at least one free buffer available */
 bool
Signature · 1 line
2.34.1
Acked-by on v1 1/1
#1 lore raw

I can confirm that this fixes issues seen with

./configure --enable-small --disable-debug --enable-werror

(compile tested on Debian 11 amd64, gcc 10.2.1)

The init.c change did not fix a warning for my compiler, but it looks correct and might be a warning with different compilers.

Regards,
Frank

Quoted 90 lines

Ilya Ponetayev <[email protected]...> hat am 17.06.2022 06:13 CEST geschrieben:

---
 src/openvpn/init.c      | 2 +-
 src/openvpn/mtcp.c      | 2 ++
 src/openvpn/packet_id.c | 2 ++
 src/openvpn/reliable.c  | 2 ++
 4 files changed, 7 insertions(+), 1 deletion(-)
src/openvpn/init.c +1 -1
index b0c62a85..f06afc29 100644
@@ -2491,7 +2491,7 @@ frame_finalize_options(struct context *c, const struct options *o)
     size_t tailroom = headroom;
 
 #ifdef USE_COMP
-    msg(D_MTU_DEBUG, "MTU: adding %lu buffer tailroom for compression for %lu "
+    msg(D_MTU_DEBUG, "MTU: adding %zu buffer tailroom for compression for %zu "
         "bytes of payload",
         COMP_EXTRA_BUFFER(payload_size), payload_size);
     tailroom += COMP_EXTRA_BUFFER(payload_size);
src/openvpn/mtcp.c +2 -0
index b725bebb..b3c153fe 100644
@@ -72,6 +72,7 @@ struct ta_iow_flags
     unsigned int sock;
 };
 
+#ifdef ENABLE_DEBUG
 static const char *
 pract(int action)
 {
@@ -114,6 +115,7 @@ pract(int action)
             return "?";
     }
 }
+#endif /* ENABLE_DEBUG */
 
 static struct multi_instance *
 multi_create_instance_tcp(struct multi_context *m)
src/openvpn/packet_id.c +2 -0
index e357909d..851b506c 100644
@@ -53,11 +53,13 @@
 #define SEQ_UNSEEN  ((time_t)0)
 #define SEQ_EXPIRED ((time_t)1)
 
+#ifdef ENABLE_DEBUG
 static void packet_id_debug_print(int msglevel,
                                   const struct packet_id_rec *p,
                                   const struct packet_id_net *pin,
                                   const char *message,
                                   int value);
+#endif /* ENABLE_DEBUG */
 
 static inline void
 packet_id_debug(int msglevel,
src/openvpn/reliable.c +2 -0
index 37244435..73473625 100644
@@ -394,6 +394,7 @@ reliable_send_purge(struct reliable *rel, const struct reliable_ack *ack)
     }
 }
 
+#ifdef ENABLE_DEBUG
 /* print the current sequence of active packet IDs */
 static const char *
 reliable_print_ids(const struct reliable *rel, struct gc_arena *gc)
@@ -412,6 +413,7 @@ reliable_print_ids(const struct reliable *rel, struct gc_arena *gc)
     }
     return BSTR(&out);
 }
+#endif /* ENABLE_DEBUG */
 
 /* true if at least one free buffer available */
 bool
Signature · 8 lines
2.34.1



_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

--
Frank Lichtenheld

#2 lore raw
In reply to Ilya Ponetayev

I discussed the use of "%zu" and Windows/MinGW builds with Selva, who said this will work (it will create warnings, thus no -Werror builds, but since release builds are MSVC, this should be acceptable).

Uncrustify said I have to add a newline before one of the #endif lines, so I did.

Generally speaking: we're adding #ifdef again - maybe we should see how much of a difference this creates if we *remove* "--disable-debug" and all the ENABLE_DEBUG conditionals. Resulting binary size, and runtime.

Your patch has been applied to the master branch.

commit 8c815699ba616151e6bc5074cd150f3ebf053d4a

Author: Ilya Ponetayev
Date:   Fri Jun 17 07:13:26 2022 +0300
     fix compilation issues with small and w/o debug

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

--
kind regards,

Gert Doering