Martin and Andrii,
This function can be made as a new kfunc in bpf_testmod.c. The sock_create_kern() could be moved to here also. Take a look at the register_btf_kfunc_id_set() usage in bpf_testmod.c and how those registered kfunc(s) can be called by the bpf prog in progs/*.
Thanks for the feedback. I will explore this approach and see if I can get rid of the additional test module.
-Jordan