Skip to contentSkip to conversation

Change in openvpn[master]: wfp_block: Avoid sign-compare warning with Fwpm* return types

Openvpn-devel In review flichtenheld (Code Review) 2 participants 6 messages Jan 30 – Mar 30 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1769789455000.I2f6502da1832edcb273a0dfa9b3ef940bec2d711@...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/+/1506?usp=email

to review the following change.

Change subject: wfp_block: Avoid sign-compare warning with Fwpm* return types
......................................................................

wfp_block: Avoid sign-compare warning with Fwpm* return types

FWP_E_ALREADY_EXISTS is explictly casted to HRESULT which is LONG. But Fwpm* return DWORD. So if you compare an expected result with the actual result you get an sign-compare warning...

Change-Id I2f6502da1832edcb273a0dfa9b3ef940bec2d711

---
M src/openvpn/wfp_block.c

1 file changed, 1 insertion(+), 10 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/06/1506/1

src/openvpn/wfp_block.c +1 -10
index 74d19ce..4d38fdb 100644
@@ -131,11 +131,6 @@
     return err;
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wsign-compare"
-#endif
-
 /*
  * Block outgoing local traffic, possibly DNS only, except for
  * (i) adapter with the specified index (and loopback, if all is blocked)
@@ -198,7 +193,7 @@
        * do not treat "already exists" as an error */
         err = add_sublayer(OPENVPN_WFP_BLOCK_SUBLAYER);
 
-        if (err == FWP_E_ALREADY_EXISTS || err == ERROR_SUCCESS)
+        if (err == (DWORD)FWP_E_ALREADY_EXISTS || err == ERROR_SUCCESS)
         {
             msg_handler(0, "WFP Block: Added a persistent sublayer with pre-defined UUID");
         }
@@ -345,10 +340,6 @@
     return err;
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
-
 DWORD
 delete_wfp_block_filters(HANDLE engine_handle)
 {

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

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

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

Attention is currently required from: flichtenheld, plaisthos.

cron2 has posted comments on this change by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1506?usp=email )

Change subject: wfp_block: Avoid sign-compare warning with Fwpm* return types
......................................................................

Patch Set 10: Code-Review+2

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

Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2f6502da1832edcb273a0dfa9b3ef940bec2d711
Gerrit-Change-Number: 1506
Gerrit-PatchSet: 10
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Mon, 30 Mar 2026 11:38:11 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes

#3 lore raw

PATCH v10 1/1 wfp_block: Avoid sign-compare warning with Fwpm* return types

In reply to a message not in the archive

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

FWP_E_ALREADY_EXISTS is explictly casted to HRESULT which is LONG. But Fwpm* return DWORD. So if you compare an expected result with the actual result you get an sign-compare warning...

Change-Id I2f6502da1832edcb273a0dfa9b3ef940bec2d711

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1506
---

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/+/1506
This mail reflects revision 10 of this Change.

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

src/openvpn/wfp_block.c +1 -10
index 74d19ce..4d38fdb 100644
@@ -131,11 +131,6 @@
     return err;
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wsign-compare"
-#endif
-
 /*
  * Block outgoing local traffic, possibly DNS only, except for
  * (i) adapter with the specified index (and loopback, if all is blocked)
@@ -198,7 +193,7 @@
        * do not treat "already exists" as an error */
         err = add_sublayer(OPENVPN_WFP_BLOCK_SUBLAYER);
 
-        if (err == FWP_E_ALREADY_EXISTS || err == ERROR_SUCCESS)
+        if (err == (DWORD)FWP_E_ALREADY_EXISTS || err == ERROR_SUCCESS)
         {
             msg_handler(0, "WFP Block: Added a persistent sublayer with pre-defined UUID");
         }
@@ -345,10 +340,6 @@
     return err;
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
-
 DWORD
 delete_wfp_block_filters(HANDLE engine_handle)
 {
#4 lore raw

[Openvpn-devel] [PATCH applied] Re: wfp_block: Avoid sign-compare warning with Fwpm* return types

A bit of an annoyance, but still an easy one, and one set of #pragmas gone...

Compile-tested on Ubuntu 24.04 / MinGW.

Your patch has been applied to the master branch.

commit 88325a9a75cc27af225a5ed215ad76fd76e8c9b0

Author: Frank Lichtenheld
Date:   Mon Mar 30 13:38:19 2026 +0200
     wfp_block: Avoid sign-compare warning with Fwpm* return types

     Signed-off-by: Frank Lichtenheld <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1506
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg36337.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

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

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

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

Change subject: wfp_block: Avoid sign-compare warning with Fwpm* return types
......................................................................

wfp_block: Avoid sign-compare warning with Fwpm* return types

FWP_E_ALREADY_EXISTS is explictly casted to HRESULT which is LONG. But Fwpm* return DWORD. So if you compare an expected result with the actual result you get an sign-compare warning...

Change-Id I2f6502da1832edcb273a0dfa9b3ef940bec2d711

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1506
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg36337.html

---
M src/openvpn/wfp_block.c

1 file changed, 1 insertion(+), 10 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/06/1506/11

src/openvpn/wfp_block.c +1 -10
index 74d19ce..4d38fdb 100644
@@ -131,11 +131,6 @@
     return err;
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wsign-compare"
-#endif
-
 /*
  * Block outgoing local traffic, possibly DNS only, except for
  * (i) adapter with the specified index (and loopback, if all is blocked)
@@ -198,7 +193,7 @@
        * do not treat "already exists" as an error */
         err = add_sublayer(OPENVPN_WFP_BLOCK_SUBLAYER);
 
-        if (err == FWP_E_ALREADY_EXISTS || err == ERROR_SUCCESS)
+        if (err == (DWORD)FWP_E_ALREADY_EXISTS || err == ERROR_SUCCESS)
         {
             msg_handler(0, "WFP Block: Added a persistent sublayer with pre-defined UUID");
         }
@@ -345,10 +340,6 @@
     return err;
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
-
 DWORD
 delete_wfp_block_filters(HANDLE engine_handle)
 {

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

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2f6502da1832edcb273a0dfa9b3ef940bec2d711
Gerrit-Change-Number: 1506
Gerrit-PatchSet: 11
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>

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

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

Change subject: wfp_block: Avoid sign-compare warning with Fwpm* return types
......................................................................

wfp_block: Avoid sign-compare warning with Fwpm* return types

FWP_E_ALREADY_EXISTS is explictly casted to HRESULT which is LONG. But Fwpm* return DWORD. So if you compare an expected result with the actual result you get an sign-compare warning...

Change-Id I2f6502da1832edcb273a0dfa9b3ef940bec2d711

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1506
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg36337.html

---
M src/openvpn/wfp_block.c

1 file changed, 1 insertion(+), 10 deletions(-)
src/openvpn/wfp_block.c +1 -10
index 74d19ce..4d38fdb 100644
@@ -131,11 +131,6 @@
     return err;
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wsign-compare"
-#endif
-
 /*
  * Block outgoing local traffic, possibly DNS only, except for
  * (i) adapter with the specified index (and loopback, if all is blocked)
@@ -198,7 +193,7 @@
        * do not treat "already exists" as an error */
         err = add_sublayer(OPENVPN_WFP_BLOCK_SUBLAYER);
 
-        if (err == FWP_E_ALREADY_EXISTS || err == ERROR_SUCCESS)
+        if (err == (DWORD)FWP_E_ALREADY_EXISTS || err == ERROR_SUCCESS)
         {
             msg_handler(0, "WFP Block: Added a persistent sublayer with pre-defined UUID");
         }
@@ -345,10 +340,6 @@
     return err;
 }
 
-#if defined(__GNUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
-
 DWORD
 delete_wfp_block_filters(HANDLE engine_handle)
 {

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

Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I2f6502da1832edcb273a0dfa9b3ef940bec2d711
Gerrit-Change-Number: 1506
Gerrit-PatchSet: 11
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>