- "version" command from client to management can now set
the version of management interface supported by the client
by specifying an optional integer parameter.
If no parameter is specified the version of OpenVPN
and its management interface is returned (current behaviour).
The client version defaults to 1 which is the current version of
the Management Interface.
Signed-off-by: Selva Nair <selva.nair@gmail.com>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <1516909261-31623-1-git-send-email-selva.nair@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg16363.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
... | ... |
@@ -432,8 +432,12 @@ Command examples: |
432 | 432 |
COMMAND -- version |
433 | 433 |
------------------ |
434 | 434 |
|
435 |
-Show the current OpenVPN and Management Interface versions. |
|
435 |
+Set the version (integer) of Management Interface supported by the |
|
436 |
+client or show the current OpenVPN and Management Interface versions. |
|
436 | 437 |
|
438 |
+Command examples: |
|
439 |
+ version 2 -- Change management version of client to 2 (default = 1) |
|
440 |
+ version -- Show the version of OpenVPN and its Management Interface |
|
437 | 441 |
|
438 | 442 |
COMMAND -- auth-retry |
439 | 443 |
--------------------- |
... | ... |
@@ -123,7 +123,7 @@ man_help(void) |
123 | 123 |
msg(M_CLIENT, "test n : Produce n lines of output for testing/debugging."); |
124 | 124 |
msg(M_CLIENT, "username type u : Enter username u for a queried OpenVPN username."); |
125 | 125 |
msg(M_CLIENT, "verb [n] : Set log verbosity level to n, or show if n is absent."); |
126 |
- msg(M_CLIENT, "version : Show current version number."); |
|
126 |
+ msg(M_CLIENT, "version [n] : Set client's version to n or show current version of daemon."); |
|
127 | 127 |
msg(M_CLIENT, "END"); |
128 | 128 |
} |
129 | 129 |
|
... | ... |
@@ -1241,6 +1241,15 @@ man_network_change(struct management *man, bool samenetwork) |
1241 | 1241 |
#endif |
1242 | 1242 |
|
1243 | 1243 |
static void |
1244 |
+set_client_version(struct management *man, const char *version) |
|
1245 |
+{ |
|
1246 |
+ if (version) |
|
1247 |
+ { |
|
1248 |
+ man->connection.client_version = atoi(version); |
|
1249 |
+ } |
|
1250 |
+} |
|
1251 |
+ |
|
1252 |
+static void |
|
1244 | 1253 |
man_dispatch_command(struct management *man, struct status_output *so, const char **p, const int nparms) |
1245 | 1254 |
{ |
1246 | 1255 |
struct gc_arena gc = gc_new(); |
... | ... |
@@ -1255,6 +1264,10 @@ man_dispatch_command(struct management *man, struct status_output *so, const cha |
1255 | 1255 |
{ |
1256 | 1256 |
man_help(); |
1257 | 1257 |
} |
1258 |
+ else if (streq(p[0], "version") && p[1]) |
|
1259 |
+ { |
|
1260 |
+ set_client_version(man, p[1]); |
|
1261 |
+ } |
|
1258 | 1262 |
else if (streq(p[0], "version")) |
1259 | 1263 |
{ |
1260 | 1264 |
msg(M_CLIENT, "OpenVPN Version: %s", title_string); |
... | ... |
@@ -2508,6 +2521,8 @@ man_connection_init(struct management *man) |
2508 | 2508 |
man->connection.es = event_set_init(&maxevents, EVENT_METHOD_FAST); |
2509 | 2509 |
} |
2510 | 2510 |
|
2511 |
+ man->connection.client_version = 1; /* default version */ |
|
2512 |
+ |
|
2511 | 2513 |
/* |
2512 | 2514 |
* Listen/connect socket |
2513 | 2515 |
*/ |