|
|
@@ -21,6 +21,14 @@ __s32 is_kafka_request(char *buf, int buf_size) {
|
|
|
if (bpf_probe_read(&h, sizeof(h), (void *)((char *)buf)) < 0) {
|
|
|
return 0;
|
|
|
}
|
|
|
+ h.length = bpf_htonl(h.length);
|
|
|
+ h.api_key = bpf_htons(h.api_key);
|
|
|
+ h.api_version = bpf_htons(h.api_version);
|
|
|
+ h.correlation_id = bpf_htonl(h.correlation_id);
|
|
|
+
|
|
|
+ if (h.length+4 != buf_size) {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
if (h.correlation_id > 0 && (h.api_key >= 0 && h.api_key <= 67)) {
|
|
|
return h.correlation_id;
|
|
|
}
|
|
|
@@ -33,7 +41,7 @@ __u32 parse_kafka_status(__s32 request_id, char *buf, int buf_size, __u8 partial
|
|
|
if (bpf_probe_read(&h, sizeof(h), (void *)((char *)buf)) < 0) {
|
|
|
return 0;
|
|
|
}
|
|
|
- if (h.correlation_id == request_id) {
|
|
|
+ if (bpf_htonl(h.correlation_id) == request_id) {
|
|
|
return 200;
|
|
|
}
|
|
|
return 0;
|