]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
show the right string for key-direction
authorArne Schwabe <arne@rfc2549.org>
Wed, 31 Jan 2018 09:53:00 +0000 (10:53 +0100)
committerGert Doering <gert@greenie.muc.de>
Tue, 20 Feb 2018 09:55:46 +0000 (10:55 +0100)
V2: print also a nice string if direction is not set
V3: really include V2 changes
Acked-by: Steffan Karger <steffan.karger@fox-it.com>
Message-Id: <1517392380-21597-1-git-send-email-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg16415.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
(cherry picked from commit 7f7f00da88eeea847da57f4f34c66c1f4a935a73)

src/openvpn/crypto.c
src/openvpn/crypto.h
src/openvpn/options.c

index 9d2faf75322fb9b62596721402d55f7ec180e456..dba3aa584ae513b7d73e6bc5ed4b0ecb4ae734fb 100644 (file)
@@ -1570,11 +1570,18 @@ ascii2keydirection(int msglevel, const char *str)
 }
 
 const char *
-keydirection2ascii(int kd, bool remote)
+keydirection2ascii(int kd, bool remote, bool humanreadable)
 {
     if (kd == KEY_DIRECTION_BIDIRECTIONAL)
     {
-        return NULL;
+        if (humanreadable)
+        {
+            return "not set";
+        }
+        else
+        {
+            return NULL;
+        }
     }
     else if (kd == KEY_DIRECTION_NORMAL)
     {
index 539039c051033263d2ef973f30a5cffccb341441..e42f697f6c3bd1b7dc1a933ad8b4545e9f17572b 100644 (file)
@@ -478,7 +478,7 @@ void must_have_n_keys(const char *filename, const char *option, const struct key
 
 int ascii2keydirection(int msglevel, const char *str);
 
-const char *keydirection2ascii(int kd, bool remote);
+const char *keydirection2ascii(int kd, bool remote, bool humanreadable);
 
 /* print keys */
 void key2_print(const struct key2 *k,
index 3041b1bde5f003ffb118abc788ad9ea21d26fcac..c9f1773af97d1cef63450933523cee6bb0800f9f 100644 (file)
@@ -1716,7 +1716,7 @@ show_settings(const struct options *o)
 
 #ifdef ENABLE_CRYPTO
     SHOW_STR(shared_secret_file);
-    SHOW_INT(key_direction);
+    SHOW_PARM(key_direction, keydirection2ascii(o->key_direction, false, true), "%s");
     SHOW_STR(ciphername);
     SHOW_BOOL(ncp_enabled);
     SHOW_STR(ncp_ciphers);
@@ -3624,7 +3624,7 @@ options_string(const struct options *o,
      * Key direction
      */
     {
-        const char *kd = keydirection2ascii(o->key_direction, remote);
+        const char *kd = keydirection2ascii(o->key_direction, remote, false);
         if (kd)
         {
             buf_printf(&out, ",keydir %s", kd);