Skip to content
This repository was archived by the owner on Oct 24, 2023. It is now read-only.

Adapt to latest version of BCC #21

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions ebpf-http-statistics.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,15 @@ int kprobe__skb_copy_datagram_iter(struct pt_regs *ctx, const struct sk_buff *sk
* parsers infeasible.
*/
u8 data[8] = {};
void* dst = skb->data + offset;
if (available_data > HTTP_REQUEST_MIN_LEN) {
/* We have confirmed having access to 7 bytes, but need 8 bytes to check the
* space after OPTIONS. bpf_probe_read() requires its second argument to be
* an immediate, so we obtain the data in this unsexy way.
*/
bpf_probe_read(&data, 8, skb->data + offset);
bpf_probe_read(&data, 8, dst);
} else {
bpf_probe_read(&data, 7, skb->data + offset);
bpf_probe_read(&data, 7, dst);
}

switch (data[0]) {
Expand Down