I want to use the aforementioned function because I want to use the struct request_sock_queue and struct listen_sock . Is there a way to use them (perhaps a different function)?
First I tried to make a BPF program which uses 'tcp_synack_timer'(net/ipv4/tcp_timer.h) goes to another function-> 'int_csk_reqsk_queue_prune'(net/ipv4/inet_connection_sock.c), neither of these worked (I also searched these functions in /sys/kernel/debug/tracing/available_filtered_functions) to get the 'struct listen_sock' and from there I finally get 'qlen' (struct listen_sock which is in 'include/net/request_sock.h'.
!/usr/local/bin/bpftrace
kprobe:tcp_synack_timer
{
printf("-------------------\n");
printf("\n");
printf("tcp_synack_timer: %s pid: %d\n", comm, pid);
printf("\n");
printf("--------------------\n");
}
and the another function that I tried:
!/usr/local/bin/bpftrace
#include <net/sock.h>
#include <net/inet_connection_sock.h>
#include <net/request_sock.h>
kprobe:inet_csk_reqsk_queue_prune
{
$sk = (struct sock *)arg0;
$inet = (struct inet_connection_sock *)$sk;
$rsq = (struct request_sock_queue *)$inet;
$ls = (struct listen_sock *)$rsq;
printf("-------------------\n");
printf("\n");
printf("net_csk_reqsk_queue_prune: %s pid: %d\n", comm, pid);
printf("\n");
printf("listen_sock: %d\n", $ls->qlen);
printf("--------------------\n");
}