Implement parsing and sending INFO and INFO_PRE control messages
PATCH 1/1 Implement parsing and sending INFO and INFO_PRE control messages
OpenVPN 3 implements these messages to send information during the authentication to the UI, implement these message also in OpenVPN 2.x
--- src/openvpn/forward.c | 8 ++++++++ src/openvpn/push.c | 29 +++++++++++++++++++++++++++++ src/openvpn/push.h | 2 ++ 3 files changed, 39 insertions(+)
src/openvpn/forward.c +8 -0
@@ -169,6 +169,14 @@ check_incoming_control_channel_dowork(struct context *c) {server_pushed_signal (c, &buf, false,4 ); } + else if (buf_string_match_head_str(&buf, "INFO_PRE")) + { +server_pushed_info (c, &buf,8 ); + } + else if (buf_string_match_head_str(&buf, "INFO")) + { +server_pushed_info (c, &buf,4 ); + } else {msg (D_PUSH_ERRORS ,"WARNING: Received unknown control message: %s" ,BSTR (&buf));
src/openvpn/push.c +28 -0
@@ -175,6 +175,34 @@ server_pushed_signal(struct context *c, const struct buffer *buffer, const bool } } +void server_pushed_info (struct context *c,const struct buffer *buffer,const int adv) +{ +struct gc_arena gc; +const char *m ="" ; +struct buffer buf = *buffer; + +if (buf_advance (&buf, adv) &&buf_read_u8 (&buf) ==',' &&BLEN (&buf)) + { + m =BSTR (&buf); + } + +#ifdef ENABLE_MANAGEMENT +if (management) + { + gc =gc_new (); + +/* We use >INFOMSG here instead of plain >INFO since INFO is used to */ +/* for management greeting and we don't want to confuse the client */ +struct buffer out =alloc_buf_gc (256 , &gc); +buf_printf (&out,">%s:%s" ,"INFOMSG" , m); +management_notify_generic (management,BSTR (&out)); + +gc_free (&gc); + } +#endif +msg (D_PUSH ,"Info command was pushed by server ('%s')" , m); +} +#if P2MP_SERVER /** * Add an option to the given push list by providing a format string.
src/openvpn/push.h +2 -0
@@ -50,6 +50,8 @@ void receive_auth_failed(struct context *c, const struct buffer *buffer);void server_pushed_signal (struct context *c,const struct buffer *buffer,const bool restart,const int adv); +void server_pushed_info (struct context *c,const struct buffer *buffer,const int adv); +void incoming_push_message (struct context *c,const struct buffer *buffer);#if P2MP_SERVER
Signature · 1 line
2.17.1
Hi,
Quoted 2 lines · Arne Schwabe
OpenVPN 3 implements these messages to send information during the authentication to the UI, implement these message also in OpenVPN 2.x
Feature-Questionmark :-)
Is there any documentation about this? What sort of messages are sent, by which product? What do you do with it?
Can we maybe have some documentation in management-notes.txt?
gert
Signature · 6 lines
"If was one thing all people took for granted, was conviction that if you
feed honest figures into a computer, honest figures come out. Never doubted
it myself till I met a computer with a sense of humor."
Robert A. Heinlein, The Moon is a Harsh Mistress
Gert Doering - Munich, Germany [email protected]...Hi,
Quoted 6 lines · Gert Doering
Hi,
Quoted 2 lines · Arne Schwabe
OpenVPN 3 implements these messages to send information during the authentication to the UI, implement these message also in OpenVPN 2.x
Quoted 6 lines
Feature-Questionmark :-)
Is there any documentation about this? What sort of messages are sent, by which product? What do you do with it?
Can we maybe have some documentation in management-notes.txt?
And even at a higher level: what is the actual use case for this? Porting more features "just because they are supported in openvpn3" does not really sound like a reason to maintain more code on the community side, imho.
Cheers,
Signature · 1 line
Antonio Quartulli