Skip to content

What map def attributes must match to update an inner map value? #460

Answered by teknoraver
dthaler asked this question in Q&A
Discussion options

You must be logged in to vote

Hi all,

when inserting a map into a map of maps, the newly inserted map is checked for equality against the first one inserted:

bool bpf_map_meta_equal(const struct bpf_map *meta0,
                       const struct bpf_map *meta1)
{
        /* No need to compare ops because it is covered by map_type */
        return meta0->map_type == meta1->map_type &&
               meta0->key_size == meta1->key_size &&
               meta0->value_size == meta1->value_size &&
               meta0->map_flags == meta1->map_flags;
}

The call chain is:

__sys_bpf()
map_update_elem()
bpf_map_update_value()
bpf_fd_array_map_update_elem()
bpf_map_fd_get_ptr()
array_map_meta_equal()
bpf_map_meta_equal()

Replies: 2 comments 1 reply

Comment options

dthaler
Sep 7, 2021
Maintainer Author

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@dthaler
Comment options

dthaler Sep 9, 2021
Maintainer Author

Answer selected by dthaler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants