From: Gianmarco De Gregori <[email protected]> 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]> Acked-by: Frank Lichtenheld <[email protected]> Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1680 --- 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/+/1680 This mail reflects revision 1 of this Change. Acked-by according to Gerrit (reflected above): Frank Lichtenheld <[email protected]> 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)"); _______________________________________________ Openvpn-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openvpn-devel
