You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wanna use ARRAY_OF_MAPS and HASH_OF_MAPS. I think I have to provide a file descriptor of the maps. But I think there is no way to get the table file descriptor.
Maybe ID is not file descriptor. We need int(C.bpf_table_fd_id(mod, table.id)), , is It?
Also, if the key of the parent table's key is a string and the value is a file descriptor, I don't think it is possible to set this value even if the Get File Descriptor function exists.
typeParentKeystruct{
IDstring
}
m:=bpf.NewModule(string(bpfText), []string{})
parentTable:=bpf.NewTable(m.TableId("parentMap"), m)
innerTable:=bpf.NewTable(m.TableId("innerMap"), m)
key, _:=innerTable.KeyStrToBytes("1")
leaf, _:=innerTable.LeafStrToBytes("11")
iferr:=table.Set(key, leaf); err!=nil {
fmt.Fprintf(os.Stderr, "Failed to add data to rules: %s\n", err)
os.Exit(1)
}
parentKey:=&ParentKey{
ID: "test_id",
}
fd:=innerTable.Fd() // I need this function// I think `cgo argument has Go pointer to Go pointer` error will be occured, also parentTable.Set is not satisfied this usecase. iferr:=parentTable.SetP(parentKey, fd); err!=nil {
fmt.Fprintf(os.Stderr, "Failed to add data to policyList: %s\n", err)
os.Exit(1)
}
The assumption is that if I want to use a string in a Map, I need to wrap it in a structure, right?
Maybe We need SetMap(key unsafe.Pointer, fd int) error
The text was updated successfully, but these errors were encountered:
Hi all, thanks for the good library.
I wanna use
ARRAY_OF_MAPS
andHASH_OF_MAPS
. I think I have to provide a file descriptor of the maps. But I think there is no way to get the table file descriptor.Maybe ID is not file descriptor. We need
int(C.bpf_table_fd_id(mod, table.id)),
, is It?Also, if the key of the parent table's key is a string and the value is a file descriptor, I don't think it is possible to set this value even if the Get File Descriptor function exists.
test.c
main.go
The assumption is that if I want to use a string in a Map, I need to wrap it in a structure, right?
Maybe We need
SetMap(key unsafe.Pointer, fd int) error
The text was updated successfully, but these errors were encountered: