Skip to content

Commit 1f408ad

Browse files
committed
fix(eBPF): enforce reassembly path when MySQL reassembly is enabled
When MySQL reassembly is enabled, force all related traffic into the reassembly pipeline. Otherwise, single-packet protocol inference may misidentify consecutive same-direction packets as complete MySQL requests or responses. This could lead to MSG_UNKNOWN not being returned, preventing the reassembly logic from being triggered and causing incorrect parsing behavior. Ensure same-direction continuous data is not prematurely treated as independent complete MySQL messages when reassembly is enabled.
1 parent d94c9b7 commit 1f408ad

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

agent/src/ebpf/kernel/include/protocol_inference.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -773,6 +773,30 @@ static __inline enum message_type infer_mysql_message(const char *buf,
773773

774774
bool is_mysqld = is_current_comm("mysqld");
775775
if (is_socket_info_valid(conn_info->socket_info_ptr)) {
776+
/*
777+
* When MySQL reassembly is enabled, all related traffic must be forced into
778+
* the reassembly processing pipeline.
779+
*
780+
* Otherwise, under a single-packet-based protocol detection model, the
781+
* detection capability is limited, and consecutive same-direction packets may
782+
* be incorrectly identified as complete MySQL requests or responses.
783+
*
784+
* In such cases, these packets will continue to be parsed as valid MySQL
785+
* traffic, and MSG_UNKNOWN will not be returned, thus preventing entry into
786+
* the reassembly process.
787+
*
788+
* This leads to behavior inconsistent with expectations, since correct
789+
* reassembly logic relies on returning MSG_UNKNOWN for incomplete packets in
790+
* order to trigger reassembly.
791+
*
792+
* The goal of this design is to ensure that, when reassembly is enabled,
793+
* consecutive same-direction data is not reported as independent complete
794+
* MySQL messages (requests or responses).
795+
*/
796+
if (conn_info->enable_reasm) {
797+
return MSG_UNKNOWN;
798+
}
799+
776800
/*
777801
* Ensure the authentication response packet is captured
778802
* and distinguish it based on the 5th byte (Payload start):

0 commit comments

Comments
 (0)