{
__u32 name_len = create_attr->name ? strlen(create_attr->name) : 0;
union bpf_attr attr;
- int ret;
memset(&attr, '\0', sizeof(attr));
attr.map_ifindex = create_attr->map_ifindex;
attr.inner_map_fd = create_attr->inner_map_fd;
- ret = sys_bpf(BPF_MAP_CREATE, &attr, sizeof(attr));
- if (ret < 0 && errno == EINVAL && create_attr->name) {
- /* Retry the same syscall, but without the name.
- * Pre v4.14 kernels don't support map names.
- */
- memset(attr.map_name, 0, sizeof(attr.map_name));
- return sys_bpf(BPF_MAP_CREATE, &attr, sizeof(attr));
- }
- return ret;
+ return sys_bpf(BPF_MAP_CREATE, &attr, sizeof(attr));
}
int bpf_create_map_node(enum bpf_map_type map_type, const char *name,
continue;
}
- create_attr.name = map->name;
+ if (obj->caps.name)
+ create_attr.name = map->name;
create_attr.map_ifindex = map->map_ifindex;
create_attr.map_type = def->type;
create_attr.map_flags = def->map_flags;