@@ -489,10 +489,28 @@ static void pe_subtest(struct test_bpf_cookie *skel)
489
489
bpf_link__destroy (link );
490
490
}
491
491
492
+ static int verify_tracing_link_info (int fd , u64 cookie )
493
+ {
494
+ struct bpf_link_info info ;
495
+ int err ;
496
+ u32 len = sizeof (info );
497
+
498
+ err = bpf_link_get_info_by_fd (fd , & info , & len );
499
+ if (!ASSERT_OK (err , "get_link_info" ))
500
+ return -1 ;
501
+
502
+ if (!ASSERT_EQ (info .type , BPF_LINK_TYPE_TRACING , "link_type" ))
503
+ return -1 ;
504
+
505
+ ASSERT_EQ (info .tracing .cookie , cookie , "tracing_cookie" );
506
+
507
+ return 0 ;
508
+ }
509
+
492
510
static void tracing_subtest (struct test_bpf_cookie * skel )
493
511
{
494
512
__u64 cookie ;
495
- int prog_fd ;
513
+ int prog_fd , err ;
496
514
int fentry_fd = -1 , fexit_fd = -1 , fmod_ret_fd = -1 ;
497
515
LIBBPF_OPTS (bpf_test_run_opts , opts );
498
516
LIBBPF_OPTS (bpf_link_create_opts , link_opts );
@@ -507,6 +525,10 @@ static void tracing_subtest(struct test_bpf_cookie *skel)
507
525
if (!ASSERT_GE (fentry_fd , 0 , "fentry.link_create" ))
508
526
goto cleanup ;
509
527
528
+ err = verify_tracing_link_info (fentry_fd , cookie );
529
+ if (!ASSERT_OK (err , "verify_tracing_link_info" ))
530
+ goto cleanup ;
531
+
510
532
cookie = 0x20000000000000L ;
511
533
prog_fd = bpf_program__fd (skel -> progs .fexit_test1 );
512
534
link_opts .tracing .cookie = cookie ;
0 commit comments