From dfa93fe2f1191691872e01fd7659aaae6731c3a2 Mon Sep 17 00:00:00 2001 From: Alfonso Acosta Date: Tue, 12 Apr 2016 10:59:08 +0000 Subject: [PATCH] Review feedback --- examples/plugins/ebpf/Makefile | 2 +- examples/plugins/ebpf/http-requests.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/plugins/ebpf/Makefile b/examples/plugins/ebpf/Makefile index b06a10220..fb3913305 100644 --- a/examples/plugins/ebpf/Makefile +++ b/examples/plugins/ebpf/Makefile @@ -1,7 +1,7 @@ .PHONY: run clean IMAGE=weavescope-http-requests-plugin -UPTODATE=.$(EXE).uptodate +UPTODATE=.uptodate run: $(UPTODATE) docker run --rm -it \ diff --git a/examples/plugins/ebpf/http-requests.c b/examples/plugins/ebpf/http-requests.c index 00bc73b56..b3a5b7eb3 100644 --- a/examples/plugins/ebpf/http-requests.c +++ b/examples/plugins/ebpf/http-requests.c @@ -18,7 +18,7 @@ BPF_HASH(received_http_requests, struct received_http_requests_key_t, u64); int kprobe__skb_copy_datagram_iter(struct pt_regs *ctx, const struct sk_buff *skb, int offset, void *unused_iovec, int len) { - /* Inspect the beginning of docket buffers copied to user-space to determine if they + /* Inspect the beginning of socket buffers copied to user-space to determine if they correspond to http requests. Caveats: @@ -49,7 +49,7 @@ int kprobe__skb_copy_datagram_iter(struct pt_regs *ctx, const struct sk_buff *sk bpf_probe_read(&data, sizeof(data), skb->data + offset); /* TODO: support other methods and optimize lookups */ - if ((data[0] == 'G') && (data[1] == 'E') && (data[2] == 'T')) { + if ((data[0] == 'G') && (data[1] == 'E') && (data[2] == 'T') && (data[3] == ' ')) { /* Record request */ struct received_http_requests_key_t key = {}; key.pid = bpf_get_current_pid_tgid() >> 32;