[Openvpn-devel,v1] Fix "binary or" vs "boolean or" related to server_bridge_proxy_dhcp

Message ID 20240502095322.9433-1-gert@greenie.muc.de
State Accepted
Headers show
Series [Openvpn-devel,v1] Fix "binary or" vs "boolean or" related to server_bridge_proxy_dhcp | expand

Commit Message

Gert Doering May 2, 2024, 9:53 a.m. UTC
From: Frank Lichtenheld <frank@lichtenheld.com>

Both values are boolean so there is no reason to use "|"
and it just confuses the reader whether there is something
more going on here.

Change-Id: Ie61fa6a78875ecbaa9d3d8e7a50603d77c9ce09e
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
Acked-by: Gert Doering <gert@greenie.muc.de>

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

Acked-by according to Gerrit (reflected above):
Gert Doering <gert@greenie.muc.de>


Gert Doering May 2, 2024, 3:15 p.m. UTC | #1
Code looks good, old code happened to work but was "logically wrong",
so this is a reasonable fix.  As it's not really a *bug* I've kept it
to master.

Tested on the server test rig, for good measure, though that one
doesn't actually have a --server-bridge config - the TAP server test
uses VLANs and scripts to do IP-and-VLAN assignments... meh.

Your patch has been applied to the master branch.

commit 9d92221eb4e773cae913752af6d70082ae305fe8
Author: Frank Lichtenheld
Date:   Thu May 2 11:53:22 2024 +0200

     Fix 'binary or' vs 'boolean or' related to server_bridge_proxy_dhcp

     Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
     Acked-by: Gert Doering <gert@greenie.muc.de>
     Message-Id: <20240502095322.9433-1-gert@greenie.muc.de>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg28601.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>

kind regards,

Gert Doering


diff --git a/src/openvpn/helper.c b/src/openvpn/helper.c
index 1bab84c..24dee97 100644
--- a/src/openvpn/helper.c
+++ b/src/openvpn/helper.c
@@ -427,7 +427,7 @@ 
      * if !nogw:
      *   push "route-gateway dhcp"
-    else if (o->server_bridge_defined | o->server_bridge_proxy_dhcp)
+    else if (o->server_bridge_defined || o->server_bridge_proxy_dhcp)
         if (o->client)
diff --git a/src/openvpn/init.c b/src/openvpn/init.c
index 02205e7..e67f10e 100644
--- a/src/openvpn/init.c
+++ b/src/openvpn/init.c
@@ -3565,7 +3565,7 @@ 
         msg(M_WARN, "WARNING: using --pull/--client and --ifconfig together is probably not what you want");
-    if (o->server_bridge_defined | o->server_bridge_proxy_dhcp)
+    if (o->server_bridge_defined || o->server_bridge_proxy_dhcp)
         msg(M_WARN, "NOTE: when bridging your LAN adapter with the TAP adapter, note that the new bridge adapter will often take on its own IP address that is different from what the LAN adapter was previously set to");