[XS] Change in openvpn[master]: Fix: port-share and multi-socket interaction

"its_Giaan (Code Review)" <[email protected]>
Newsgroups gmane.network.openvpn.devel
Message-ID <[email protected]>
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/+/1680?usp=email

to review the following change.


Change subject: Fix: port-share and multi-socket interaction
......................................................................

Fix: port-share and multi-socket interaction

When port-share is used, enforce the presence
of a TCP listener by checking the local_list
entries insted of rely on the global
connection_entry proto field.

Github: #1027

Change-Id: Id4e21efebbe64b963cf7847ad77bc41339af7a37
Signed-off-by: Gianmarco De Gregori <[email protected]>
---
M src/openvpn/options.c
1 file changed, 6 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/80/1680/1

diff --git a/src/openvpn/options.c b/src/openvpn/options.c
index 0c2866c..0ecb59c 100644
--- a/src/openvpn/options.c
+++ b/src/openvpn/options.c
@@ -2490,8 +2490,13 @@
             msg(M_USAGE, USAGE_VALID_SERVER_PROTOS);
         }
 #if PORT_SHARE
+        bool has_tcp = false;
+        for (int i = 0; i < ce->local_list->len && !has_tcp; i++)
+        {
+            has_tcp = (ce->local_list->array[i]->proto == PROTO_TCP_SERVER);
+        }
         if ((options->port_share_host || options->port_share_port)
-            && (ce->proto != PROTO_TCP_SERVER))
+            && !has_tcp)
         {
             msg(M_USAGE, "--port-share only works in TCP server mode "
                          "(--proto values of tcp-server, tcp4-server, or tcp6-server)");

-- 
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1680?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: Id4e21efebbe64b963cf7847ad77bc41339af7a37
Gerrit-Change-Number: 1680
Gerrit-PatchSet: 1
Gerrit-Owner: its_Giaan <[email protected]>
Gerrit-Reviewer: plaisthos <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]>

_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.