This commit is contained in:
gbucchino 2024-07-08 10:56:32 +02:00
parent 7f377620ef
commit a0336477dd
3 changed files with 5 additions and 2 deletions

3
.gitignore vendored Normal file

@ -0,0 +1,3 @@
load_bpf
tp_tcp.o
.**.swp

@ -6,6 +6,7 @@
#include <arpa/inet.h>
#include "common.h"
#include <unistd.h>
#include <errno.h>
static void clean_obj(struct bpf_object *obj){
printf("Cleaning\n");
@ -37,6 +38,7 @@ int main(void){
err = bpf_object__load(obj);
if (err){
printf("%s\n", strerror(errno));
printf("Failed to load object\n");
clean_obj(obj);
return -1;

@ -115,13 +115,11 @@ int tcp_retransmit(struct ctx_send_reset *ctx){
f_family = bpf_map_lookup_elem(&filter_family, &keys);
if (!f_family)
return 0;
}
index = bpf_map_lookup_elem(&tcp_stats_index, &keys);
if (!index)
return 0;
// Get the family of the socket
bpf_probe_read_kernel(&family, sizeof(family), &sk->__sk_common.skc_family);
if (family != *f_family)