* [PATCH net] bpf: add get_next_key callback to LPM map
@ 2017-03-05 17:41 Alexei Starovoitov
2017-03-05 18:44 ` David Miller
2017-03-06 9:30 ` Daniel Borkmann
0 siblings, 2 replies; 5+ messages in thread
From: Alexei Starovoitov @ 2017-03-05 17:41 UTC (permalink / raw)
To: David S . Miller; +Cc: Daniel Borkmann, Daniel Mack, Dmitry Vyukov, netdev
map_get_next_key callback is mandatory. Supply dummy handler.
Fixes: b95a5c4db09b ("bpf: add a longest prefix match trie map implementation")
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
---
kernel/bpf/lpm_trie.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/kernel/bpf/lpm_trie.c b/kernel/bpf/lpm_trie.c
index 8bfe0afaee10..b37bd9ab7f57 100644
--- a/kernel/bpf/lpm_trie.c
+++ b/kernel/bpf/lpm_trie.c
@@ -500,9 +500,15 @@ static void trie_free(struct bpf_map *map)
raw_spin_unlock(&trie->lock);
}
+static int trie_get_next_key(struct bpf_map *map, void *key, void *next_key)
+{
+ return -ENOTSUPP;
+}
+
static const struct bpf_map_ops trie_ops = {
.map_alloc = trie_alloc,
.map_free = trie_free,
+ .map_get_next_key = trie_get_next_key,
.map_lookup_elem = trie_lookup_elem,
.map_update_elem = trie_update_elem,
.map_delete_elem = trie_delete_elem,
--
2.8.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net] bpf: add get_next_key callback to LPM map
2017-03-05 17:41 [PATCH net] bpf: add get_next_key callback to LPM map Alexei Starovoitov
@ 2017-03-05 18:44 ` David Miller
2017-03-05 18:58 ` Alexei Starovoitov
2017-03-06 9:30 ` Daniel Borkmann
1 sibling, 1 reply; 5+ messages in thread
From: David Miller @ 2017-03-05 18:44 UTC (permalink / raw)
To: ast; +Cc: daniel, daniel, dvyukov, netdev
From: Alexei Starovoitov <ast@fb.com>
Date: Sun, 5 Mar 2017 09:41:08 -0800
> map_get_next_key callback is mandatory. Supply dummy handler.
>
> Fixes: b95a5c4db09b ("bpf: add a longest prefix match trie map implementation")
> Reported-by: Dmitry Vyukov <dvyukov@google.com>
> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Wouldn't it be more appropriate to provide a proper DFS ordered
traversal rather than return an error code?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net] bpf: add get_next_key callback to LPM map
2017-03-05 18:44 ` David Miller
@ 2017-03-05 18:58 ` Alexei Starovoitov
2017-03-06 1:55 ` David Miller
0 siblings, 1 reply; 5+ messages in thread
From: Alexei Starovoitov @ 2017-03-05 18:58 UTC (permalink / raw)
To: David Miller; +Cc: daniel, daniel, dvyukov, netdev
On 3/5/17 10:44 AM, David Miller wrote:
> From: Alexei Starovoitov <ast@fb.com>
> Date: Sun, 5 Mar 2017 09:41:08 -0800
>
>> map_get_next_key callback is mandatory. Supply dummy handler.
>>
>> Fixes: b95a5c4db09b ("bpf: add a longest prefix match trie map implementation")
>> Reported-by: Dmitry Vyukov <dvyukov@google.com>
>> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
>
> Wouldn't it be more appropriate to provide a proper DFS ordered
> traversal rather than return an error code?
yes. of course. This is quick fix for 'net'.
That's why the error code is ENOTSUPP with meaning that
it's not supported right now and will be supported in the future.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net] bpf: add get_next_key callback to LPM map
2017-03-05 18:58 ` Alexei Starovoitov
@ 2017-03-06 1:55 ` David Miller
0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2017-03-06 1:55 UTC (permalink / raw)
To: ast; +Cc: daniel, daniel, dvyukov, netdev
From: Alexei Starovoitov <ast@fb.com>
Date: Sun, 5 Mar 2017 10:58:00 -0800
> On 3/5/17 10:44 AM, David Miller wrote:
>> From: Alexei Starovoitov <ast@fb.com>
>> Date: Sun, 5 Mar 2017 09:41:08 -0800
>>
>>> map_get_next_key callback is mandatory. Supply dummy handler.
>>>
>>> Fixes: b95a5c4db09b ("bpf: add a longest prefix match trie map
>>> implementation")
>>> Reported-by: Dmitry Vyukov <dvyukov@google.com>
>>> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
>>
>> Wouldn't it be more appropriate to provide a proper DFS ordered
>> traversal rather than return an error code?
>
> yes. of course. This is quick fix for 'net'.
> That's why the error code is ENOTSUPP with meaning that
> it's not supported right now and will be supported in the future.
Ok, fair enough, applied.
Thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net] bpf: add get_next_key callback to LPM map
2017-03-05 17:41 [PATCH net] bpf: add get_next_key callback to LPM map Alexei Starovoitov
2017-03-05 18:44 ` David Miller
@ 2017-03-06 9:30 ` Daniel Borkmann
1 sibling, 0 replies; 5+ messages in thread
From: Daniel Borkmann @ 2017-03-06 9:30 UTC (permalink / raw)
To: Alexei Starovoitov, David S . Miller; +Cc: Daniel Mack, Dmitry Vyukov, netdev
On 03/05/2017 06:41 PM, Alexei Starovoitov wrote:
> map_get_next_key callback is mandatory. Supply dummy handler.
>
> Fixes: b95a5c4db09b ("bpf: add a longest prefix match trie map implementation")
> Reported-by: Dmitry Vyukov <dvyukov@google.com>
> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-03-06 9:30 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-05 17:41 [PATCH net] bpf: add get_next_key callback to LPM map Alexei Starovoitov
2017-03-05 18:44 ` David Miller
2017-03-05 18:58 ` Alexei Starovoitov
2017-03-06 1:55 ` David Miller
2017-03-06 9:30 ` Daniel Borkmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).