Browse code

Add negotiated cipher to status file format 2 and 3

With NCP turned off, this will still display the cipher used.

Trac: #814

Signed-off-by: Gert van Dijk <gert@gertvandijk.net>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: <20171111161122.30087-2-gert@gertvandijk.net>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg15817.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>

Gert van Dijk authored on 2017/11/12 01:11:22
Showing 2 changed files
... ...
@@ -2485,7 +2485,7 @@ Connected Since.
2485 2485
 .B 2
2486 2486
 \-\- a more reliable format for external processing. Compared to version 1, the
2487 2487
 client list contains some additional fields: Virtual Address, Virtual IPv6
2488
-Address, Username, Client ID, Peer ID.
2488
+Address, Username, Client ID, Peer ID, Data Channel Cipher.
2489 2489
 Future versions may extend the number of fields.
2490 2490
 .br
2491 2491
 .B 3
... ...
@@ -50,6 +50,8 @@
50 50
 #include "forward-inline.h"
51 51
 #include "pf-inline.h"
52 52
 
53
+#include "crypto_backend.h"
54
+
53 55
 /*#define MULTI_DEBUG_EVENT_LOOP*/
54 56
 
55 57
 #ifdef MULTI_DEBUG_EVENT_LOOP
... ...
@@ -940,8 +942,8 @@ multi_print_status(struct multi_context *m, struct status_output *so, const int
940 940
              */
941 941
             status_printf(so, "TITLE%c%s", sep, title_string);
942 942
             status_printf(so, "TIME%c%s%c%u", sep, time_string(now, 0, false, &gc_top), sep, (unsigned int)now);
943
-            status_printf(so, "HEADER%cCLIENT_LIST%cCommon Name%cReal Address%cVirtual Address%cVirtual IPv6 Address%cBytes Received%cBytes Sent%cConnected Since%cConnected Since (time_t)%cUsername%cClient ID%cPeer ID",
944
-                          sep, sep, sep, sep, sep, sep, sep, sep, sep, sep, sep, sep);
943
+            status_printf(so, "HEADER%cCLIENT_LIST%cCommon Name%cReal Address%cVirtual Address%cVirtual IPv6 Address%cBytes Received%cBytes Sent%cConnected Since%cConnected Since (time_t)%cUsername%cClient ID%cPeer ID%cData Channel Cipher",
944
+                          sep, sep, sep, sep, sep, sep, sep, sep, sep, sep, sep, sep, sep);
945 945
             hash_iterator_init(m->hash, &hi);
946 946
             while ((he = hash_iterator_next(&hi)))
947 947
             {
... ...
@@ -956,7 +958,7 @@ multi_print_status(struct multi_context *m, struct status_output *so, const int
956 956
 #else
957 957
                                   ""
958 958
 #endif
959
-                                  "%c%" PRIu32,
959
+                                  "%c%" PRIu32 "%c%s",
960 960
                                   sep, tls_common_name(mi->context.c2.tls_multi, false),
961 961
                                   sep, mroute_addr_print(&mi->real, &gc),
962 962
                                   sep, print_in_addr_t(mi->reporting_addr, IA_EMPTY_IF_UNDEF, &gc),
... ...
@@ -971,7 +973,8 @@ multi_print_status(struct multi_context *m, struct status_output *so, const int
971 971
 #else
972 972
                                   sep,
973 973
 #endif
974
-                                  sep, mi->context.c2.tls_multi ? mi->context.c2.tls_multi->peer_id : UINT32_MAX);
974
+                                  sep, mi->context.c2.tls_multi ? mi->context.c2.tls_multi->peer_id : UINT32_MAX,
975
+                                  sep, translate_cipher_name_to_openvpn(mi->context.options.ciphername));
975 976
                 }
976 977
                 gc_free(&gc);
977 978
             }