File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -1846,10 +1846,27 @@ const struct bpf_verifier_ops cg_sysctl_verifier_ops = {
18461846const struct bpf_prog_ops cg_sysctl_prog_ops = {
18471847};
18481848
1849+ BPF_CALL_1 (bpf_get_netns_cookie_sockopt , struct bpf_sockopt_kern * , ctx )
1850+ {
1851+ struct sock * sk = ctx ? ctx -> sk : NULL ;
1852+ const struct net * net = sk ? sock_net (sk ) : & init_net ;
1853+
1854+ return net -> net_cookie ;
1855+ }
1856+
1857+ static const struct bpf_func_proto bpf_get_netns_cookie_sockopt_proto = {
1858+ .func = bpf_get_netns_cookie_sockopt ,
1859+ .gpl_only = false,
1860+ .ret_type = RET_INTEGER ,
1861+ .arg1_type = ARG_PTR_TO_CTX_OR_NULL ,
1862+ };
1863+
18491864static const struct bpf_func_proto *
18501865cg_sockopt_func_proto (enum bpf_func_id func_id , const struct bpf_prog * prog )
18511866{
18521867 switch (func_id ) {
1868+ case BPF_FUNC_get_netns_cookie :
1869+ return & bpf_get_netns_cookie_sockopt_proto ;
18531870#ifdef CONFIG_NET
18541871 case BPF_FUNC_sk_storage_get :
18551872 return & bpf_sk_storage_get_proto ;
You can’t perform that action at this time.
0 commit comments