Skip to content

Commit

Permalink
ebpf: improve protocol identification accuracy
Browse files Browse the repository at this point in the history
# Conflicts:
#	ebpftracer/ebpf.go
  • Loading branch information
def committed Jan 6, 2025
1 parent f49ea14 commit 4df41ad
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions ebpftracer/ebpf/l7/l7.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,12 +276,6 @@ int trace_enter_write(void *ctx, __u64 fd, __u16 is_tls, char *buf, __u64 size,
return 0;
} else if (is_cassandra_request(payload, size, &k.stream_id)) {
req->protocol = PROTOCOL_CASSANDRA;
} else if (is_kafka_request(payload, size, &req->request_id)) {
req->protocol = PROTOCOL_KAFKA;
struct l7_request *prev_req = bpf_map_lookup_elem(&active_l7_requests, &k);
if (prev_req && prev_req->protocol == PROTOCOL_KAFKA) {
req->ns = prev_req->ns;
}
} else if (looks_like_http2_frame(payload, size, METHOD_HTTP2_CLIENT_FRAMES)) {
struct l7_event *e = bpf_map_lookup_elem(&l7_event_heap, &zero);
if (!e) {
Expand All @@ -298,6 +292,12 @@ int trace_enter_write(void *ctx, __u64 fd, __u16 is_tls, char *buf, __u64 size,
req->protocol = PROTOCOL_CLICKHOUSE;
} else if (is_zk_request(payload, total_size)) {
req->protocol = PROTOCOL_ZOOKEEPER;
} else if (is_kafka_request(payload, size, &req->request_id)) {
req->protocol = PROTOCOL_KAFKA;
struct l7_request *prev_req = bpf_map_lookup_elem(&active_l7_requests, &k);
if (prev_req && prev_req->protocol == PROTOCOL_KAFKA) {
req->ns = prev_req->ns;
}
} else if (is_dubbo2_request(payload, size)) {
req->protocol = PROTOCOL_DUBBO2;
} else if (is_dns_request(payload, size, &k.stream_id)) {
Expand Down

0 comments on commit 4df41ad

Please sign in to comment.