if #systemd socket activation is not needed, then it uses #seccomp only. When a bind system call is detected, the process is stopped and if the bind address matches a force-bind rule, then the process memory is altered to replace the address given to bind() with a replacement address.
It uses SECCOMP_RET_USER_NOTIF which is only available on recent kernels.
If systemd socket activation is needed, then it uses SECCOMP_IOCTL_NOTIF_ADDFD which is even newer.
if -p flag is specified, then it uses seccomp in combinaison with ptrace and when a bind() system call is detected, then the process is stopped and ptrace is used to alter the process. The system call registers are dumped and if the address bound matches a pattern:
either ptrace is used to replace the address with a replacement address, just like with seccomp, and the bind system call continues
if systemd socket activation is needed for that pattern, then the system call is replaced by the dup2() system call and the return value is altered to return 0 in case of success.
https://github.com/mildred/force-bind-seccomp