@@ -28,17 +28,17 @@ int BPF_PROG(socketpair_e, struct pt_regs *regs, long id) {
2828 /*=============================== COLLECT PARAMETERS ===========================*/
2929
3030 /* Parameter 1: domain (type: PT_ENUMFLAGS32) */
31- /* why to send 32 bits if we need only 8 bits? */
31+ /* Why to send 32 bits if we need only 8 bits? */
3232 uint8_t domain = (uint8_t )args [0 ];
3333 ringbuf__store_u32 (& ringbuf , (uint32_t )socket_family_to_scap (domain ));
3434
3535 /* Parameter 2: type (type: PT_UINT32) */
36- /* this should be an int, not a uint32 */
36+ /* This should be an int, not an uint32. */
3737 uint32_t type = (uint32_t )args [1 ];
3838 ringbuf__store_u32 (& ringbuf , type );
3939
4040 /* Parameter 3: proto (type: PT_UINT32) */
41- /* this should be an int, not a uint32 */
41+ /* This should be an int, not an uint32. */
4242 uint32_t proto = (uint32_t )args [2 ];
4343 ringbuf__store_u32 (& ringbuf , proto );
4444
@@ -67,19 +67,18 @@ int BPF_PROG(socketpair_x, struct pt_regs *regs, long ret) {
6767 /* Parameter 1: res (type: PT_ERRNO) */
6868 ringbuf__store_s64 (& ringbuf , ret );
6969
70+ /* Collect parameters at the beginning to manage socketcalls. */
71+ unsigned long args [4 ] = {0 };
72+ extract__network_args (args , 4 , regs );
73+
7074 int32_t fds [2 ] = {-1 , -1 };
71- unsigned long source = 0 ;
72- unsigned long peer = 0 ;
73- unsigned long fds_pointer = 0 ;
75+ uint64_t source = 0 ;
76+ uint64_t peer = 0 ;
7477
7578 /* In case of success we have 0. */
7679 if (ret == 0 ) {
77- /* Collect parameters at the beginning to manage socketcalls */
78- unsigned long args [4 ] = {0 };
79- extract__network_args (args , 4 , regs );
80-
8180 /* Get new sockets. */
82- fds_pointer = args [3 ];
81+ void * fds_pointer = ( void * ) args [3 ];
8382 bpf_probe_read_user ((void * )fds , 2 * sizeof (int32_t ), (void * )fds_pointer );
8483
8584 /* Get source and peer. */
@@ -104,6 +103,21 @@ int BPF_PROG(socketpair_x, struct pt_regs *regs, long ret) {
104103 /* Parameter 5: peer (type: PT_UINT64) */
105104 ringbuf__store_u64 (& ringbuf , peer );
106105
106+ /* Parameter 6: domain (type: PT_ENUMFLAGS32) */
107+ /* Why to send 32 bits if we need only 8 bits? */
108+ uint8_t domain = (uint8_t )args [0 ];
109+ ringbuf__store_u32 (& ringbuf , (uint32_t )socket_family_to_scap (domain ));
110+
111+ /* Parameter 7: type (type: PT_UINT32) */
112+ /* This should be an int, not an uint32. */
113+ uint32_t type = (uint32_t )args [1 ];
114+ ringbuf__store_u32 (& ringbuf , type );
115+
116+ /* Parameter 8: proto (type: PT_UINT32) */
117+ /* This should be an int, not an uint32. */
118+ uint32_t proto = (uint32_t )args [2 ];
119+ ringbuf__store_u32 (& ringbuf , proto );
120+
107121 /*=============================== COLLECT PARAMETERS ===========================*/
108122
109123 ringbuf__submit_event (& ringbuf );
0 commit comments