[PATCH v7] Add mock support for management messages

Gert Doering <[email protected]>
Newsgroups gmane.network.openvpn.devel
Message-ID <[email protected]>
From: Arne Schwabe <[email protected]>

Change-Id: I432df6c69249b49e9b9a3a904803904d134387a0
Signed-off-by: Arne Schwabe <[email protected]>
Acked-by: Frank Lichtenheld <[email protected]>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1857
---

This change was reviewed on Gerrit and approved by at least one
developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1857
This mail reflects revision 7 of this Change.

Acked-by according to Gerrit (reflected above):
Frank Lichtenheld <[email protected]>

        
diff --git a/tests/unit_tests/openvpn/mock_msg.c b/tests/unit_tests/openvpn/mock_msg.c
index 8176d2a..3e73d19 100644
--- a/tests/unit_tests/openvpn/mock_msg.c
+++ b/tests/unit_tests/openvpn/mock_msg.c
@@ -43,6 +43,7 @@
 
 
 char mock_msg_buf[MOCK_MSG_BUF];
+char mock_managment_buf[MOCK_MSG_BUF];
 
 
 void
@@ -76,6 +77,14 @@
     {
         printf("FATAL ERROR:");
     }
+
+    if (flags & M_MSG_VIRT_OUT)
+    {
+        CLEAR(mock_managment_buf);
+        vsnprintf(mock_managment_buf, sizeof(mock_managment_buf), format, arglist);
+        return;
+    }
+
     CLEAR(mock_msg_buf);
     vsnprintf(mock_msg_buf, sizeof(mock_msg_buf), format, arglist);
 
diff --git a/tests/unit_tests/openvpn/mock_msg.h b/tests/unit_tests/openvpn/mock_msg.h
index da96b212..41ce48f 100644
--- a/tests/unit_tests/openvpn/mock_msg.h
+++ b/tests/unit_tests/openvpn/mock_msg.h
@@ -36,6 +36,8 @@
 
 extern bool fatal_error_triggered;
 extern char mock_msg_buf[MOCK_MSG_BUF];
+extern char mock_managment_buf[MOCK_MSG_BUF];
+
 
 msglvl_t mock_get_debug_level(void);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.