mirror of
https://github.com/safing/portmaster
synced 2025-09-02 10:39:22 +00:00
Add ebpf check for failed kernel functions
This commit is contained in:
parent
cecce3ffcb
commit
2b65e8efe1
3 changed files with 10 additions and 0 deletions
Binary file not shown.
Binary file not shown.
|
@ -90,6 +90,11 @@ int BPF_PROG(udp_v4_connect, struct sock *sk) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
// ip4_datagram_connect return error
|
||||
if (sk->__sk_common.skc_dport == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Allocate space for the event.
|
||||
struct Event *udp_info;
|
||||
udp_info = bpf_ringbuf_reserve(&events, sizeof(struct Event), 0);
|
||||
|
@ -128,6 +133,11 @@ int BPF_PROG(udp_v6_connect, struct sock *sk) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
// ip6_datagram_connect return error
|
||||
if (sk->__sk_common.skc_dport == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Make sure its udp6 socket
|
||||
struct udp6_sock *us = bpf_skc_to_udp6_sock(sk);
|
||||
if (!us) {
|
||||
|
|
Loading…
Add table
Reference in a new issue