Skip to content

Conversation

@masibw
Copy link

@masibw masibw commented Jun 22, 2021

Hi team, this PR solve #297.

We have to use the table's file descriptor when using BPF_HASH_OF_MAPS or BPF_ARRAY_OF_MAPS. But now gobpf doesn't have the method. And also we have to pass the unsafe.Pointer of the file descriptor. So, I made the SetMap method.

This is a example.

	parentTable := bpf.NewTable(m.TableId("parent_list"), m)
    	innerTable := bpf.NewTable(m.TableId("inner_list"), m)
        fd := innerTable.Fd()
         if err := parentTable.SetMap(unsafe.Pointer(parentKey), fd); err != nil {
	 	fmt.Fprintf(os.Stderr, "Failed to add data to parent_list: %s\n", err)
	 	os.Exit(1)
	 }

Please review this, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant