Using the netfilter hook API

I'm new to Linux kernel programming and I'm trying to setup a netfilter hook with the nf_register_net_hook API.

I saw the old nf_register_hook API got removed , and now a new struct net* parameter is needed.

However, the only use case I found where you can get a valid struct net (aka network namespace) is via the struct net *sock_net(const struct sock *sk) function, which takes a socket in parameter. However, I don't have any struck sock handy while setting up the hook, I'm a bit confused on how to correctly setup a hook with the new API ?