Skip to content

Commit b9a9d1f

Browse files
authored
[eBPF] Optimize fastcgi protocol inference (#4465)
The purpose is to push all data to the upper layer if the sofa protocol is mistakenly inferred as the fastcgi protocol.
1 parent c8f1188 commit b9a9d1f

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1519,6 +1519,15 @@ infer_fastcgi_message(const char *buf, size_t count,
15191519
return MSG_PRESTORE;
15201520
}
15211521

1522+
if (is_socket_info_valid(conn_info->socket_info_ptr)) {
1523+
if (conn_info->socket_info_ptr->l7_proto != PROTO_FASTCGI)
1524+
return MSG_UNKNOWN;
1525+
if (header->type == FCGI_BEGIN_REQUEST || header->type == FCGI_PARAMS)
1526+
return MSG_REQUEST;
1527+
else
1528+
return MSG_RESPONSE;
1529+
}
1530+
15221531
if (fastcgi_header_common_check(header) && count > 8 &&
15231532
__bpf_ntohs(header->content_length) != 0) {
15241533
if (header->type == FCGI_BEGIN_REQUEST) {

0 commit comments

Comments
 (0)