Update project

This commit is contained in:
geoffrey 2024-07-03 21:40:01 +02:00
parent d4fbe5fdac
commit 27fbf2b6e0
4 changed files with 6 additions and 8 deletions

BIN
load_bpf

Binary file not shown.

@ -65,7 +65,6 @@ int main(void){
//printf("%lld\n", stats);
struct in_addr *src = (struct in_addr*)&s_reset.saddr;
struct in_addr *dest = (struct in_addr*)&s_reset.daddr;
//struct in_addr src = s_reset.saddr;
printf("Sport: %d; dport: %d %s %s\n", s_reset.sport, s_reset.dport, inet_ntoa(*src), inet_ntoa(*dest));
}

@ -59,16 +59,15 @@ int tcp_retransmit(struct ctx_reset *ctx){
long long *stats;
struct reset *s_reset;
int keys = 0;
__u16 sport = 0;
__u16 dport = 0;
s_reset = bpf_map_lookup_elem(&tcp_reset_stats, &keys);
if (!s_reset)
return 0;
if (!ctx)
return 0;
//*stats += 1;
sport = ctx->sport;
dport = ctx->dport;
s_reset->saddr[0] = ctx->saddr[0];
s_reset->saddr[1] = ctx->saddr[1];
s_reset->saddr[2] = ctx->saddr[2];
@ -77,10 +76,10 @@ int tcp_retransmit(struct ctx_reset *ctx){
s_reset->daddr[1] = ctx->daddr[1];
s_reset->daddr[2] = ctx->daddr[2];
s_reset->daddr[3] = ctx->daddr[3];*/
s_reset->sport = sport;
s_reset->dport = dport;
s_reset->sport = ctx->sport;
s_reset->dport = ctx->dport;
//bpf_printk("BPF detected TCP received reset %d - %d %d\n", *stats, dport, sport);
bpf_printk("BPF detected TCP received reset %d %d\n", dport, sport);
bpf_printk("BPF detected TCP received reset %d %d\n", s_reset->sport, s_reset->dport);
return 0;
}

BIN
tp_tcp.o

Binary file not shown.