Skip to contentSkip to conversation

Change in openvpn[master]: comp: Make sure comp flags are treated as unsigned

Openvpn-devel Superseded flichtenheld (Code Review) 2 participants 7 messages Jul 24, 2025 – Aug 27, 2025 1 message not in the archive

v8 of 10 Superseded Latest is v10 →

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1753360288000.I6a0d352a039a0936cb9bbedf6168cd6eecd053ea@...2715...

#1 lore raw

Attention is currently required from: plaisthos.

Hello plaisthos,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1102?usp=email

to review the following change.

Change subject: comp: Make sure comp flags are treated as unsigned
......................................................................

comp: Make sure comp flags are treated as unsigned

compress_options.flags is already unsigned. Make sure the individual flags are as well to avoid spurious conversion warnings.

Change-Id I6a0d352a039a0936cb9bbedf6168cd6eecd053ea

---
M src/openvpn/comp.h

1 file changed, 8 insertions(+), 8 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/02/1102/1

src/openvpn/comp.h +8 -8
index 0bb0d32..ee9c16a 100644
@@ -33,22 +33,22 @@
 
 /* Compression flags */
 /* Removed
- #define COMP_F_ADAPTIVE             (1<<0) / * COMP_ALG_LZO only * /
- #define COMP_F_ALLOW_COMPRESS       (1<<1) / * not only incoming is compressed but also outgoing * /
+ #define COMP_F_ADAPTIVE             (1u<<0) / * COMP_ALG_LZO only * /
+ #define COMP_F_ALLOW_COMPRESS       (1u<<1) / * not only incoming is compressed but also outgoing * /
  */
 /** initial command byte is swapped with last byte in buffer to preserve payload alignment */
-#define COMP_F_SWAP                 (1<<2)
+#define COMP_F_SWAP                 (1u<<2)
 /** tell server that we only support compression stubs */
-#define COMP_F_ADVERTISE_STUBS_ONLY (1<<3)
+#define COMP_F_ADVERTISE_STUBS_ONLY (1u<<3)
 /** Only accept stub compression, even with COMP_F_ADVERTISE_STUBS_ONLY
  * we still accept other compressions to be pushed */
-#define COMP_F_ALLOW_STUB_ONLY      (1<<4)
+#define COMP_F_ALLOW_STUB_ONLY      (1u<<4)
 /** push stub-v2 or comp-lzo no when we see a client with comp-lzo in occ */
-#define COMP_F_MIGRATE              (1<<5)
+#define COMP_F_MIGRATE              (1u<<5)
 /** Compression was explicitly set to allow asymetric compression */
-#define COMP_F_ALLOW_ASYM           (1<<6)
+#define COMP_F_ALLOW_ASYM           (1u<<6)
 /** Do not allow compression framing (breaks DCO) */
-#define COMP_F_ALLOW_NOCOMP_ONLY    (1<<7)
+#define COMP_F_ALLOW_NOCOMP_ONLY    (1u<<7)
 
 /* algorithms */
 #define COMP_ALG_UNDEF  0

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1102?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I6a0d352a039a0936cb9bbedf6168cd6eecd053ea
Gerrit-Change-Number: 1102
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-MessageType: newchange

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: plaisthos.

Hello plaisthos,

I'd like you to reexamine a change. Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1102?usp=email

to look at the new patch set (#4).

Change subject: comp: Make sure comp flags are treated as unsigned
......................................................................

comp: Make sure comp flags are treated as unsigned

compress_options.flags is already unsigned. Make sure the individual flags are as well to avoid spurious conversion warnings.

Change-Id I6a0d352a039a0936cb9bbedf6168cd6eecd053ea

---
M src/openvpn/comp.h

1 file changed, 8 insertions(+), 8 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/02/1102/4

src/openvpn/comp.h +8 -8
index 265e15d..0354896 100644
@@ -32,23 +32,23 @@
 
 /* Compression flags */
 /* Removed
- #define COMP_F_ADAPTIVE             (1<<0) / * COMP_ALG_LZO only * /
- #define COMP_F_ALLOW_COMPRESS       (1<<1) / * not only incoming is compressed but also outgoing *
+ #define COMP_F_ADAPTIVE             (1u<<0) / * COMP_ALG_LZO only * /
+ #define COMP_F_ALLOW_COMPRESS       (1u<<1) / * not only incoming is compressed but also outgoing *
  /
  */
 /** initial command byte is swapped with last byte in buffer to preserve payload alignment */
-#define COMP_F_SWAP                 (1 << 2)
+#define COMP_F_SWAP                 (1u << 2)
 /** tell server that we only support compression stubs */
-#define COMP_F_ADVERTISE_STUBS_ONLY (1 << 3)
+#define COMP_F_ADVERTISE_STUBS_ONLY (1u << 3)
 /** Only accept stub compression, even with COMP_F_ADVERTISE_STUBS_ONLY
  * we still accept other compressions to be pushed */
-#define COMP_F_ALLOW_STUB_ONLY      (1 << 4)
+#define COMP_F_ALLOW_STUB_ONLY      (1u << 4)
 /** push stub-v2 or comp-lzo no when we see a client with comp-lzo in occ */
-#define COMP_F_MIGRATE              (1 << 5)
+#define COMP_F_MIGRATE              (1u << 5)
 /** Compression was explicitly set to allow asymetric compression */
-#define COMP_F_ALLOW_ASYM           (1 << 6)
+#define COMP_F_ALLOW_ASYM           (1u << 6)
 /** Do not allow compression framing (breaks DCO) */
-#define COMP_F_ALLOW_NOCOMP_ONLY    (1 << 7)
+#define COMP_F_ALLOW_NOCOMP_ONLY    (1u << 7)
 
 /* algorithms */
 #define COMP_ALG_UNDEF  0

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1102?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I6a0d352a039a0936cb9bbedf6168cd6eecd053ea
Gerrit-Change-Number: 1102
Gerrit-PatchSet: 4
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-MessageType: newpatchset

#3 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld.

plaisthos has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/1102?usp=email )

Change subject: comp: Make sure comp flags are treated as unsigned
......................................................................

Patch Set 8: Code-Review+2

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1102?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I6a0d352a039a0936cb9bbedf6168cd6eecd053ea
Gerrit-Change-Number: 1102
Gerrit-PatchSet: 8
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Tue, 26 Aug 2025 12:44:31 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

#4 lore raw

PATCH v8 1/1 comp: Make sure comp flags are treated as unsigned

In reply to a message not in the archive

From: Frank Lichtenheld <[email protected]...>

compress_options.flags is already unsigned. Make sure the individual flags are as well to avoid spurious conversion warnings.

Change-Id I6a0d352a039a0936cb9bbedf6168cd6eecd053ea

---

This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1102
This mail reflects revision 8 of this Change.

Acked-by according to Gerrit (reflected above):
Arne Schwabe <[email protected]...>

src/openvpn/comp.h +8 -8
index 265e15d..0354896 100644
@@ -32,23 +32,23 @@
 
 /* Compression flags */
 /* Removed
- #define COMP_F_ADAPTIVE             (1<<0) / * COMP_ALG_LZO only * /
- #define COMP_F_ALLOW_COMPRESS       (1<<1) / * not only incoming is compressed but also outgoing *
+ #define COMP_F_ADAPTIVE             (1u<<0) / * COMP_ALG_LZO only * /
+ #define COMP_F_ALLOW_COMPRESS       (1u<<1) / * not only incoming is compressed but also outgoing *
  /
  */
 /** initial command byte is swapped with last byte in buffer to preserve payload alignment */
-#define COMP_F_SWAP                 (1 << 2)
+#define COMP_F_SWAP                 (1u << 2)
 /** tell server that we only support compression stubs */
-#define COMP_F_ADVERTISE_STUBS_ONLY (1 << 3)
+#define COMP_F_ADVERTISE_STUBS_ONLY (1u << 3)
 /** Only accept stub compression, even with COMP_F_ADVERTISE_STUBS_ONLY
  * we still accept other compressions to be pushed */
-#define COMP_F_ALLOW_STUB_ONLY      (1 << 4)
+#define COMP_F_ALLOW_STUB_ONLY      (1u << 4)
 /** push stub-v2 or comp-lzo no when we see a client with comp-lzo in occ */
-#define COMP_F_MIGRATE              (1 << 5)
+#define COMP_F_MIGRATE              (1u << 5)
 /** Compression was explicitly set to allow asymetric compression */
-#define COMP_F_ALLOW_ASYM           (1 << 6)
+#define COMP_F_ALLOW_ASYM           (1u << 6)
 /** Do not allow compression framing (breaks DCO) */
-#define COMP_F_ALLOW_NOCOMP_ONLY    (1 << 7)
+#define COMP_F_ALLOW_NOCOMP_ONLY    (1u << 7)
 
 /* algorithms */
 #define COMP_ALG_UNDEF  0
#5 lore raw

[Openvpn-devel] [PATCH applied] Re: comp: Make sure comp flags are treated as unsigned

Stared a bit at the change - this is all values well within the range of all integers involved (max value is 1<<7) so the impact *should* be zero, and BB confirms that everything still works - minus a few integer conversion warnings...

Your patch has been applied to the master branch.

commit 2f6467f7db8273e8094656e46a6ae60cbc1d0af9

Author: Frank Lichtenheld
Date:   Tue Aug 26 20:50:00 2025 +0200
     comp: Make sure comp flags are treated as unsigned

     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]/msg32689.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#6 lore raw
In reply to a message not in the archive

cron2 has uploaded a new patch set (#9) to the change originally created by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1102?usp=email )

The following approvals got outdated and were removed:
Code-Review+2 by plaisthos

Change subject: comp: Make sure comp flags are treated as unsigned
......................................................................

comp: Make sure comp flags are treated as unsigned

compress_options.flags is already unsigned. Make sure the individual flags are as well to avoid spurious conversion warnings.

Change-Id I6a0d352a039a0936cb9bbedf6168cd6eecd053ea

Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg32689.html

---
M src/openvpn/comp.h

1 file changed, 8 insertions(+), 8 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/02/1102/9

src/openvpn/comp.h +8 -8
index 265e15d..0354896 100644
@@ -32,23 +32,23 @@
 
 /* Compression flags */
 /* Removed
- #define COMP_F_ADAPTIVE             (1<<0) / * COMP_ALG_LZO only * /
- #define COMP_F_ALLOW_COMPRESS       (1<<1) / * not only incoming is compressed but also outgoing *
+ #define COMP_F_ADAPTIVE             (1u<<0) / * COMP_ALG_LZO only * /
+ #define COMP_F_ALLOW_COMPRESS       (1u<<1) / * not only incoming is compressed but also outgoing *
  /
  */
 /** initial command byte is swapped with last byte in buffer to preserve payload alignment */
-#define COMP_F_SWAP                 (1 << 2)
+#define COMP_F_SWAP                 (1u << 2)
 /** tell server that we only support compression stubs */
-#define COMP_F_ADVERTISE_STUBS_ONLY (1 << 3)
+#define COMP_F_ADVERTISE_STUBS_ONLY (1u << 3)
 /** Only accept stub compression, even with COMP_F_ADVERTISE_STUBS_ONLY
  * we still accept other compressions to be pushed */
-#define COMP_F_ALLOW_STUB_ONLY      (1 << 4)
+#define COMP_F_ALLOW_STUB_ONLY      (1u << 4)
 /** push stub-v2 or comp-lzo no when we see a client with comp-lzo in occ */
-#define COMP_F_MIGRATE              (1 << 5)
+#define COMP_F_MIGRATE              (1u << 5)
 /** Compression was explicitly set to allow asymetric compression */
-#define COMP_F_ALLOW_ASYM           (1 << 6)
+#define COMP_F_ALLOW_ASYM           (1u << 6)
 /** Do not allow compression framing (breaks DCO) */
-#define COMP_F_ALLOW_NOCOMP_ONLY    (1 << 7)
+#define COMP_F_ALLOW_NOCOMP_ONLY    (1u << 7)
 
 /* algorithms */
 #define COMP_ALG_UNDEF  0

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1102?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I6a0d352a039a0936cb9bbedf6168cd6eecd053ea
Gerrit-Change-Number: 1102
Gerrit-PatchSet: 9
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: newpatchset

#7 lore raw
In reply to a message not in the archive

cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1102?usp=email )

Change subject: comp: Make sure comp flags are treated as unsigned
......................................................................

comp: Make sure comp flags are treated as unsigned

compress_options.flags is already unsigned. Make sure the individual flags are as well to avoid spurious conversion warnings.

Change-Id I6a0d352a039a0936cb9bbedf6168cd6eecd053ea

Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg32689.html

---
M src/openvpn/comp.h

1 file changed, 8 insertions(+), 8 deletions(-)
src/openvpn/comp.h +8 -8
index 265e15d..0354896 100644
@@ -32,23 +32,23 @@
 
 /* Compression flags */
 /* Removed
- #define COMP_F_ADAPTIVE             (1<<0) / * COMP_ALG_LZO only * /
- #define COMP_F_ALLOW_COMPRESS       (1<<1) / * not only incoming is compressed but also outgoing *
+ #define COMP_F_ADAPTIVE             (1u<<0) / * COMP_ALG_LZO only * /
+ #define COMP_F_ALLOW_COMPRESS       (1u<<1) / * not only incoming is compressed but also outgoing *
  /
  */
 /** initial command byte is swapped with last byte in buffer to preserve payload alignment */
-#define COMP_F_SWAP                 (1 << 2)
+#define COMP_F_SWAP                 (1u << 2)
 /** tell server that we only support compression stubs */
-#define COMP_F_ADVERTISE_STUBS_ONLY (1 << 3)
+#define COMP_F_ADVERTISE_STUBS_ONLY (1u << 3)
 /** Only accept stub compression, even with COMP_F_ADVERTISE_STUBS_ONLY
  * we still accept other compressions to be pushed */
-#define COMP_F_ALLOW_STUB_ONLY      (1 << 4)
+#define COMP_F_ALLOW_STUB_ONLY      (1u << 4)
 /** push stub-v2 or comp-lzo no when we see a client with comp-lzo in occ */
-#define COMP_F_MIGRATE              (1 << 5)
+#define COMP_F_MIGRATE              (1u << 5)
 /** Compression was explicitly set to allow asymetric compression */
-#define COMP_F_ALLOW_ASYM           (1 << 6)
+#define COMP_F_ALLOW_ASYM           (1u << 6)
 /** Do not allow compression framing (breaks DCO) */
-#define COMP_F_ALLOW_NOCOMP_ONLY    (1 << 7)
+#define COMP_F_ALLOW_NOCOMP_ONLY    (1u << 7)
 
 /* algorithms */
 #define COMP_ALG_UNDEF  0

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1102?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I6a0d352a039a0936cb9bbedf6168cd6eecd053ea
Gerrit-Change-Number: 1102
Gerrit-PatchSet: 9
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: merged