Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supports map of maps #298

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

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