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

tcptracer-bpf.c: remove dead entries from the tuplepid_ipv{4,6} #23

Merged
merged 3 commits into from
Mar 8, 2017

Conversation

iaguis
Copy link
Contributor

@iaguis iaguis commented Feb 23, 2017

This patch avoids that tuplepid_ipv{4,6} fill up with dead entries
because a connection was refused.

Fixes #21

Depends on #25

@iaguis iaguis force-pushed the iaguis/fix-set-state branch 3 times, most recently from 998563b to 7ca3e09 Compare February 23, 2017 15:26
@alban
Copy link
Contributor

alban commented Feb 23, 2017

I tested this branch with half-duplex connections because the tcp connections goes to different states in the kernel in those cases (calling tcp_set_state differently).

Calling shutdown(..., SHUT_WR) server-side:

echo foo | busybox nc -l -p 1234
busybox nc 127.0.0.1 1234

Calling shutdown(..., SHUT_WR) client-side:

busybox nc -l -p 1234
echo bar | busybox nc 127.0.0.1 1234

Note: I am using the busybox netcat. The GNU netcat or BSD netcat have a different implementation, they might not use shutdown(2) in the same way. It's best to check with "strace" that shutdown(2) is called according to the test scenario.

And it worked fine for me.

@@ -538,6 +538,9 @@ int kprobe__tcp_set_state(struct pt_regs *ctx)
if (!read_ipv4_tuple(&t, status, skp)) {
return 0;
}
if (state == TCP_CLOSE) {
bpf_map_delete_elem(&tuplepid_ipv4, &t);

This comment was marked as abuse.

This comment was marked as abuse.

@iaguis iaguis force-pushed the iaguis/fix-set-state branch 2 times, most recently from a2673fb to 5078a60 Compare February 27, 2017 11:04
@iaguis iaguis changed the title tcptracer-bpf.c: remove dead entries form the tuplepid_ipv{4,6} tcptracer-bpf.c: remove dead entries from the tuplepid_ipv{4,6} Feb 28, 2017
@iaguis iaguis force-pushed the iaguis/fix-set-state branch 7 times, most recently from 7832fa1 to 0f7607a Compare March 1, 2017 11:12
Alessandro Puccetti and others added 3 commits March 8, 2017 11:42
This patch avoids that `tuplepid_ipv{4,6}` fill up with dead entries
because a connection was refused.

Fixes weaveworks#21
This test makes sure that `tuplepid_ipv{4,6}` do not fill up with dead
connections.
@iaguis iaguis force-pushed the iaguis/fix-set-state branch from 0f7607a to a3e68dd Compare March 8, 2017 10:43
Copy link
Contributor

@schu schu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@iaguis iaguis force-pushed the iaguis/fix-set-state branch from 513e367 to a3e68dd Compare March 8, 2017 11:25
@iaguis iaguis merged commit 2a95dd0 into weaveworks:master Mar 8, 2017
@schu schu deleted the iaguis/fix-set-state branch March 28, 2017 07:28
sunhay added a commit to DataDog/tcptracer-bpf that referenced this pull request Feb 21, 2019
…racer

Remove network-tracer agent as it's been merged into another repo
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants