From: Arne Schwabe Date: Tue, 8 Nov 2022 15:14:07 +0000 (+0100) Subject: Add packet type in accept/reject messages for HMAC packet X-Git-Tag: v2.6_beta1~28 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4466c5dcb7a77d4a214e60afc6c7b41688d0ec04;p=thirdparty%2Fopenvpn.git Add packet type in accept/reject messages for HMAC packet This allows a bit easier debugging when trying to figure what kind of packet triggered a reject/accpet. Signed-off-by: Arne Schwabe Acked-by: Gert Doering 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 --- diff --git a/src/openvpn/mudp.c b/src/openvpn/mudp.c index 4ab18b72c..7c6fc816e 100644 --- a/src/openvpn/mudp.c +++ b/src/openvpn/mudp.c @@ -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);