File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -1846,11 +1846,30 @@ const struct bpf_verifier_ops cg_sysctl_verifier_ops = {
1846
1846
const struct bpf_prog_ops cg_sysctl_prog_ops = {
1847
1847
};
1848
1848
1849
+ #ifdef CONFIG_NET
1850
+ BPF_CALL_1 (bpf_get_netns_cookie_sockopt , struct bpf_sockopt_kern * , ctx )
1851
+ {
1852
+ struct sock * sk = ctx ? ctx -> sk : NULL ;
1853
+ const struct net * net = sk ? sock_net (sk ) : & init_net ;
1854
+
1855
+ return net -> net_cookie ;
1856
+ }
1857
+
1858
+ static const struct bpf_func_proto bpf_get_netns_cookie_sockopt_proto = {
1859
+ .func = bpf_get_netns_cookie_sockopt ,
1860
+ .gpl_only = false,
1861
+ .ret_type = RET_INTEGER ,
1862
+ .arg1_type = ARG_PTR_TO_CTX_OR_NULL ,
1863
+ };
1864
+ #endif
1865
+
1849
1866
static const struct bpf_func_proto *
1850
1867
cg_sockopt_func_proto (enum bpf_func_id func_id , const struct bpf_prog * prog )
1851
1868
{
1852
1869
switch (func_id ) {
1853
1870
#ifdef CONFIG_NET
1871
+ case BPF_FUNC_get_netns_cookie :
1872
+ return & bpf_get_netns_cookie_sockopt_proto ;
1854
1873
case BPF_FUNC_sk_storage_get :
1855
1874
return & bpf_sk_storage_get_proto ;
1856
1875
case BPF_FUNC_sk_storage_delete :
You can’t perform that action at this time.
0 commit comments