Message ID | 5f76da0bea3453db04bb07399b4b1c9ce4859e31.1688631200.git.geliang.tang@suse.com (mailing list archive) |
---|---|
State | RFC |
Delegated to: | BPF |
Headers | show |
Series | BPF 'force to MPTCP' | expand |
diff --git a/net/socket.c b/net/socket.c index 2b0e54b2405c..27b423e1800f 100644 --- a/net/socket.c +++ b/net/socket.c @@ -1469,6 +1469,12 @@ int __sock_create(struct net *net, int family, int type, int protocol, struct socket *sock; const struct net_proto_family *pf; + if (!kern) { + err = BPF_CGROUP_RUN_PROG_SOCKINIT(&family, &type, &protocol); + if (err) + return err; + } + /* * Check protocol is in range */
The arguments of socket() need to be changed sometimes like the MPTCP case in the next commits. It's too late to add the BPF hooks in BPF_CGROUP_RUN_PROG_INET_SOCK() in inet_create(). So this patch invokes BPF_CGROUP_RUN_PROG_SOCKINIT() in __socket_create() to change the arguments. Signed-off-by: Geliang Tang <geliang.tang@suse.com> --- net/socket.c | 6 ++++++ 1 file changed, 6 insertions(+)