diff --git a/bpf/pkt_drops.h b/bpf/pkt_drops.h index b510e8a05..e5f147342 100644 --- a/bpf/pkt_drops.h +++ b/bpf/pkt_drops.h @@ -7,21 +7,15 @@ #include "utils.h" -static inline int trace_pkt_drop(void *ctx, struct sock *sk, +static inline int trace_pkt_drop(void *ctx, u8 state, struct sk_buff *skb, enum skb_drop_reason reason) { - if (sk == NULL) - return 0; - flow_id id; __builtin_memset(&id, 0, sizeof(id)); - u8 state = 0, protocol = 0; + u8 protocol = 0; u16 family = 0,flags = 0; - // pull in details from the packet headers and the sock struct - bpf_probe_read(&state, sizeof(u8), (u8 *)&sk->__sk_common.skc_state); - id.if_index = skb->skb_iif; // read L2 info @@ -93,7 +87,12 @@ int kfree_skb(struct trace_event_raw_kfree_skb *args) { // SKB_CONSUMED, // SKB_DROP_REASON_NOT_SPECIFIED, if (reason > SKB_DROP_REASON_NOT_SPECIFIED) { - return trace_pkt_drop(args, sk, &skb, reason); + u8 state = 0; + if (sk) { + // pull in details from the packet headers and the sock struct + bpf_probe_read(&state, sizeof(u8), (u8 *)&sk->__sk_common.skc_state); + } + return trace_pkt_drop(args, state, &skb, reason); } return 0; } diff --git a/pkg/ebpf/bpf_bpfeb.o b/pkg/ebpf/bpf_bpfeb.o index 1f7a565a0..d56c3061b 100644 Binary files a/pkg/ebpf/bpf_bpfeb.o and b/pkg/ebpf/bpf_bpfeb.o differ diff --git a/pkg/ebpf/bpf_bpfel.o b/pkg/ebpf/bpf_bpfel.o index ab7104bbb..154f12adf 100644 Binary files a/pkg/ebpf/bpf_bpfel.o and b/pkg/ebpf/bpf_bpfel.o differ