Add ebpf check for failed kernel functions
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -90,6 +90,11 @@ int BPF_PROG(udp_v4_connect, struct sock *sk) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ip4_datagram_connect return error
|
||||||
|
if (sk->__sk_common.skc_dport == 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Allocate space for the event.
|
// Allocate space for the event.
|
||||||
struct Event *udp_info;
|
struct Event *udp_info;
|
||||||
udp_info = bpf_ringbuf_reserve(&events, sizeof(struct Event), 0);
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ip6_datagram_connect return error
|
||||||
|
if (sk->__sk_common.skc_dport == 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Make sure its udp6 socket
|
// Make sure its udp6 socket
|
||||||
struct udp6_sock *us = bpf_skc_to_udp6_sock(sk);
|
struct udp6_sock *us = bpf_skc_to_udp6_sock(sk);
|
||||||
if (!us) {
|
if (!us) {
|
||||||
|
|||||||
Reference in New Issue
Block a user