[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20191022113730.29303-2-jakub@cloudflare.com>
Date: Tue, 22 Oct 2019 13:37:26 +0200
From: Jakub Sitnicki <jakub@...udflare.com>
To: bpf@...r.kernel.org
Cc: John Fastabend <john.fastabend@...il.com>,
Martin KaFai Lau <kafai@...com>, netdev@...r.kernel.org,
kernel-team@...udflare.com
Subject: [RFC bpf-next 1/5] bpf, sockmap: Let BPF helpers use lookup operation on SOCKMAP
Don't require the BPF helpers that need to access SOCKMAP maps to live in
the sock_map module. Expose SOCKMAP lookup to all kernel-land.
Signed-off-by: Jakub Sitnicki <jakub@...udflare.com>
---
net/core/sock_map.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/core/sock_map.c b/net/core/sock_map.c
index eb114ee419b6..facacc296e6c 100644
--- a/net/core/sock_map.c
+++ b/net/core/sock_map.c
@@ -271,7 +271,9 @@ static struct sock *__sock_map_lookup_elem(struct bpf_map *map, u32 key)
static void *sock_map_lookup(struct bpf_map *map, void *key)
{
- return ERR_PTR(-EOPNOTSUPP);
+ u32 index = *(u32 *)key;
+
+ return __sock_map_lookup_elem(map, index);
}
static int __sock_map_delete(struct bpf_stab *stab, struct sock *sk_test,
--
2.20.1
Powered by blists - more mailing lists