From 1e963827d9086526443c98c65a9a10544d75f8ab Mon Sep 17 00:00:00 2001 From: Pengfei Ni Date: Sat, 28 Dec 2024 08:57:19 +0800 Subject: [PATCH] Update http_trace.bpf.c --- bpf-apps/http_trace.bpf.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/bpf-apps/http_trace.bpf.c b/bpf-apps/http_trace.bpf.c index 9291b91..860a236 100644 --- a/bpf-apps/http_trace.bpf.c +++ b/bpf-apps/http_trace.bpf.c @@ -95,9 +95,7 @@ int http_trace(struct __sk_buff *skb) event->sport = bpf_ntohs(tcph.source); event->dport = bpf_ntohs(tcph.dest); event->payload_length = payload_length; - __u32 read_length = - payload_length > MAX_LENGTH ? MAX_LENGTH : payload_length; - bpf_skb_load_bytes(skb, payload_offset, event->payload, read_length); + bpf_skb_load_bytes(skb, payload_offset, event->payload, sizeof(event->payload)); bpf_skb_load_bytes(skb, ETH_HLEN + offsetof(struct iphdr, saddr), &event->saddr, 4); bpf_skb_load_bytes(skb, ETH_HLEN + offsetof(struct iphdr, daddr),