mirror of
https://github.com/OpenVPN/openvpn.git
synced 2026-05-28 04:03:29 -04:00
Indicate that a client is in pull mode in IV_PROTO
This allows us to skip waiting for the first PUSH_REQUEST message from
the client to send the response.
This changes the interpretation of IV_PROTO from a scalar to a bitfield
Since we only have IV_PROTO=2 defined so far and will support DATA_V2
this should not make any problem. This avoid adding another IV_xxx variable
that takes valuable space in the protocol frame.
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Patch V2: Use bitmask for IV_PROTO_DATA_V2 and add more documentation.
Patch V3: Rewrite IV_PROTO paragraph in man page, incoperate spelling fixes
by Richard Bonhomme <tincanteksup@gmail.com>
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20200721163811.22745-1-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg20525.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
This commit is contained in:
parent
4b59e2644a
commit
c290df558f
4 changed files with 46 additions and 5 deletions
|
|
@ -464,8 +464,14 @@ fast hardware. SSL/TLS authentication must be used in this mode.
|
||||||
:code:`IV_LZ4=1`
|
:code:`IV_LZ4=1`
|
||||||
If the client supports LZ4 compressions.
|
If the client supports LZ4 compressions.
|
||||||
|
|
||||||
:code:`IV_PROTO=2`
|
:code:`IV_PROTO`
|
||||||
If the client supports peer-id floating mechanism
|
Details about protocol extensions that the peer supports. The
|
||||||
|
variable is a bitfield and the bits are defined as follows
|
||||||
|
(starting a bit 0 for the first (unused) bit:
|
||||||
|
|
||||||
|
- bit 1: The peer supports peer-id floating mechanism
|
||||||
|
- bit 2: The client expects a push-reply and the server may
|
||||||
|
send this reply without waiting for a push-request first.
|
||||||
|
|
||||||
:code:`IV_NCP=2`
|
:code:`IV_NCP=2`
|
||||||
Negotiable ciphers, client supports ``--cipher`` pushed by
|
Negotiable ciphers, client supports ``--cipher`` pushed by
|
||||||
|
|
|
||||||
|
|
@ -1792,10 +1792,18 @@ multi_client_set_protocol_options(struct context *c)
|
||||||
{
|
{
|
||||||
int proto = 0;
|
int proto = 0;
|
||||||
int r = sscanf(optstr, "IV_PROTO=%d", &proto);
|
int r = sscanf(optstr, "IV_PROTO=%d", &proto);
|
||||||
if ((r == 1) && (proto >= 2))
|
if (r == 1)
|
||||||
{
|
{
|
||||||
tls_multi->use_peer_id = true;
|
if (proto & IV_PROTO_DATA_V2)
|
||||||
|
{
|
||||||
|
tls_multi->use_peer_id = true;
|
||||||
|
}
|
||||||
|
if (proto & IV_PROTO_REQUEST_PUSH)
|
||||||
|
{
|
||||||
|
c->c2.push_request_received = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Select cipher if client supports Negotiable Crypto Parameters */
|
/* Select cipher if client supports Negotiable Crypto Parameters */
|
||||||
|
|
|
||||||
|
|
@ -2223,7 +2223,18 @@ push_peer_info(struct buffer *buf, struct tls_session *session)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* support for P_DATA_V2 */
|
/* support for P_DATA_V2 */
|
||||||
buf_printf(&out, "IV_PROTO=2\n");
|
int iv_proto = IV_PROTO_DATA_V2;
|
||||||
|
|
||||||
|
/* support for receiving push_reply before sending
|
||||||
|
* push request, also signal that the client wants
|
||||||
|
* to get push-reply messages without without requiring a round
|
||||||
|
* trip for a push request message*/
|
||||||
|
if(session->opt->pull)
|
||||||
|
{
|
||||||
|
iv_proto |= IV_PROTO_REQUEST_PUSH;
|
||||||
|
}
|
||||||
|
|
||||||
|
buf_printf(&out, "IV_PROTO=%d\n", iv_proto);
|
||||||
|
|
||||||
/* support for Negotiable Crypto Parameters */
|
/* support for Negotiable Crypto Parameters */
|
||||||
if (session->opt->ncp_enabled
|
if (session->opt->ncp_enabled
|
||||||
|
|
|
||||||
|
|
@ -101,6 +101,22 @@
|
||||||
/* Maximum length of OCC options string passed as part of auth handshake */
|
/* Maximum length of OCC options string passed as part of auth handshake */
|
||||||
#define TLS_OPTIONS_LEN 512
|
#define TLS_OPTIONS_LEN 512
|
||||||
|
|
||||||
|
/* Definitions of the bits in the IV_PROTO bitfield
|
||||||
|
*
|
||||||
|
* In older OpenVPN versions this used in a comparison
|
||||||
|
* IV_PROTO >= 2 to determine if DATA_V2 is supported.
|
||||||
|
* Therefore any client announcing any of the flags must
|
||||||
|
* also announce IV_PROTO_DATA_V2. We also treat bit 0
|
||||||
|
* as reserved for this reason */
|
||||||
|
|
||||||
|
/** Support P_DATA_V2 */
|
||||||
|
#define IV_PROTO_DATA_V2 (1<<1)
|
||||||
|
|
||||||
|
/** Assume client will send a push request and server does not need
|
||||||
|
* to wait for a push-request to send a push-reply */
|
||||||
|
#define IV_PROTO_REQUEST_PUSH (1<<2)
|
||||||
|
|
||||||
|
|
||||||
/* Default field in X509 to be username */
|
/* Default field in X509 to be username */
|
||||||
#define X509_USERNAME_FIELD_DEFAULT "CN"
|
#define X509_USERNAME_FIELD_DEFAULT "CN"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue