]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Add packet type in accept/reject messages for HMAC packet
authorArne Schwabe <arne@rfc2549.org>
Tue, 8 Nov 2022 15:14:07 +0000 (16:14 +0100)
committerGert Doering <gert@greenie.muc.de>
Tue, 8 Nov 2022 16:29:55 +0000 (17:29 +0100)
This allows a bit easier debugging when trying to figure what kind
of packet triggered a reject/accpet.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20221108151407.1132097-1-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg25489.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
src/openvpn/mudp.c

index 4ab18b72c0c889c0c86552478c882ee6a899c310..7c6fc816ef536da9b077ac2da4262dcdfaf52621 100644 (file)
@@ -148,14 +148,18 @@ do_pre_decrypt_check(struct multi_context *m,
         bool ret = check_session_id_hmac(state, from, hmac, handwindow);
 
         const char *peer = print_link_socket_actual(&m->top.c2.from, &gc);
+        uint8_t pkt_firstbyte = *BPTR( &m->top.c2.buf);
+        int op = pkt_firstbyte >> P_OPCODE_SHIFT;
+
         if (!ret)
         {
-            msg(D_MULTI_MEDIUM, "Packet with invalid or missing SID from %s", peer);
+            msg(D_MULTI_MEDIUM, "Packet (%s) with invalid or missing SID from %s",
+                packet_opcode_name(op), peer);
         }
         else
         {
-            msg(D_MULTI_DEBUG, "Valid packet with HMAC challenge from peer (%s), "
-                "accepting new connection.", peer);
+            msg(D_MULTI_DEBUG, "Valid packet (%s) with HMAC challenge from peer (%s), "
+                "accepting new connection.", packet_opcode_name(op), peer);
         }
         gc_free(&gc);