Commit 894e3e05 authored by Yonghong Song's avatar Yonghong Song

add error checking/reporting in case that maps/prog is not supported

Signed-off-by: default avatarYonghong Song <yhs@plumgrid.com>
parent ab21dcd0
......@@ -386,6 +386,10 @@ bool BTypeVisitor::VisitVarDecl(VarDecl *Decl) {
if (KERNEL_VERSION(major,minor,0) >= KERNEL_VERSION(4,2,0))
map_type = BPF_MAP_TYPE_PROG_ARRAY;
}
if (map_type == BPF_MAP_TYPE_UNSPEC) {
llvm::errs() << "error: maps/prog is not supported\n";
return false;
}
}
table.fd = bpf_create_map(map_type, table.key_size, table.leaf_size, table.max_entries);
if (table.fd < 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment