On Wed, Dec 29, 2021 at 12:56 AM <menglong8.dong@xxxxxxxxx> wrote: > > From: Menglong Dong <imagedong@xxxxxxxxxxx> > > This hook of cgroup is called while TCP/UDP local port bind conflict > check. This is different from the 'commit aac3fc320d94 ("bpf: Post-hooks > for sys_bind")', as it is also called in autobind case. > > For TCP, this hook is called during sys_bind() and autobind. And it > is also called during tcp_v4_connect() before hash the sock to ehash, > during which src ip, src port, dst ip, and dst port is already > allocated, means that we have a chance to determine whether this > connect should continue. > > This can be useful when we want some applications not to use some > port (include auto bind port). For autobind, the kernel has the chance > to choose another port. The use case is too vague to consider adding a new hook. Also there are no selftests.