if (len <= offsetof(struct BPF_MAP_CREATE_struct, map_ifindex))
break;
PRINT_FIELD_IFINDEX(", ", attr, map_ifindex);
+
+ /*
+ * The following three fields were introduced by Linux commits
+ * v4.18-rc1~114^2~417^2~1^2~3 and v4.18-rc1~114^2~148^2~7^2~2.
+ */
+ if (len <= offsetof(struct BPF_MAP_CREATE_struct, btf_fd))
+ break;
+ PRINT_FIELD_FD(", ", attr, btf_fd, tcp);
+ PRINT_FIELD_U(", ", attr, btf_key_type_id);
+ PRINT_FIELD_U(", ", attr, btf_value_type_id);
}
END_BPF_CMD_DECODER(RVAL_DECODED | RVAL_FD)
uint32_t numa_node;
char map_name[BPF_OBJ_NAME_LEN];
uint32_t map_ifindex;
+ uint32_t btf_fd;
+ uint32_t btf_key_type_id;
+ uint32_t btf_value_type_id;
};
# define BPF_MAP_CREATE_struct_size \
sizeof(struct BPF_MAP_CREATE_struct)
-# define expected_BPF_MAP_CREATE_struct_size 48
+# define expected_BPF_MAP_CREATE_struct_size 60
struct BPF_MAP_LOOKUP_ELEM_struct {
uint32_t map_fd;
printf(", map_name=\"test_map\"");
if (size > offsetof(struct BPF_MAP_CREATE_struct, map_ifindex))
printf(", map_ifindex=0");
+ if (size > offsetof(struct BPF_MAP_CREATE_struct, btf_fd)) {
+ printf(", btf_fd=0</dev/null>"
+ ", btf_key_type_id=0, btf_value_type_id=0");
+ }
printf("}, %zu) = ", size);
if (rc >= 0)
printf("%ld<anon_inode:bpf-map>\n", rc);
", map_ifindex=" IFINDEX_LO_STR,
.init_fn = init_BPF_MAP_CREATE_attr7,
},
+ { /* 8 */
+ .data = { .BPF_MAP_CREATE_data = {
+ .btf_fd = 0xbadc0ded,
+ .btf_key_type_id = 0xfacefeed,
+ .btf_value_type_id = 0xcafef00d
+ } },
+ .size = offsetofend(struct BPF_MAP_CREATE_struct,
+ btf_value_type_id),
+ .str = "map_type=BPF_MAP_TYPE_UNSPEC"
+ ", key_size=0"
+ ", value_size=0"
+ ", max_entries=0"
+ ", map_flags=0"
+ ", inner_map_fd=0"
+ ", map_name=\"\""
+ ", map_ifindex=0"
+ ", btf_fd=-1159983635"
+ ", btf_key_type_id=4207869677"
+ ", btf_value_type_id=3405705229"
+ },
};
static const struct bpf_attr_check BPF_MAP_LOOKUP_ELEM_checks[] = {