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

TcHook.Query() always raises the failed to query tc hook: invalid argument error. #421

Closed
mozillazg opened this issue Apr 6, 2024 · 3 comments · Fixed by #422
Closed

Comments

@mozillazg
Copy link
Contributor

TcHook.Query() always raises the failed to query tc hook: invalid argument error.

$ git diff
diff --git a/selftest/tc/main.go b/selftest/tc/main.go
index 0174eb1..263ee91 100644
--- a/selftest/tc/main.go
+++ b/selftest/tc/main.go
@@ -61,6 +61,13 @@ func main() {
                fmt.Fprintln(os.Stderr, err)
                os.Exit(-1)
        }
+       var existOpts bpf.TcOpts
+       if err := hook.Query(&existOpts); err != nil {
+               fmt.Fprintln(os.Stderr, err)
+               os.Exit(-1)
+       } else {
+               fmt.Println(existOpts)
+       }
 
        eventsChannel := make(chan []byte)
        rb, err := bpfModule.InitRingBuf("events", eventsChannel)
$ make run
...
failed to query tc hook: invalid argument
[!] ERROR: test error

test with the main branch: a55c024

chentao-kernel added a commit to chentao-kernel/libbpfgo that referenced this issue Apr 8, 2024
The bpf_tc_query interface should init the parameter first, sometimes
it may be confused for us, so add the test case to reduce the confusion.

aquasecurity#421

Signed-off-by: Tao Chen <[email protected]>
@chentao-kernel
Copy link
Contributor

@mozillazg hi, mozillazg, i add the test case, is it helpful?

chentao-kernel added a commit to chentao-kernel/libbpfgo that referenced this issue Apr 8, 2024
The bpf_tc_query interface should init the parameter first, sometimes
it may be confused for us, so add the case to reduce the confusion.

aquasecurity#421

Signed-off-by: Tao Chen <[email protected]>
@geyslan
Copy link
Member

geyslan commented Apr 8, 2024

@mozillazg
Copy link
Contributor Author

@geyslan we can reproduce it in the ci env:
mozillazg#10

chentao-kernel added a commit to chentao-kernel/libbpfgo that referenced this issue Apr 8, 2024
The bpf_tc_query interface should init the parameter first, sometimes
it may be confused for us, so add the case to reduce the confusion.

aquasecurity#421
aquasecurity#421

Signed-off-by: Tao Chen <[email protected]>
chentao-kernel added a commit to chentao-kernel/libbpfgo that referenced this issue Apr 8, 2024
The bpf_tc_query interface should init the parameter first, sometimes
it may be confused for us, so add the case to reduce the confusion.

aquasecurity#421
aquasecurity#420

Signed-off-by: Tao Chen <[email protected]>
chentao-kernel added a commit to chentao-kernel/libbpfgo that referenced this issue Apr 8, 2024
The bpf_tc_query/bpf_tc_detach interface should init the parameter first,
sometimes it may be confused for us, so add the case to reduce the confusion.

aquasecurity#421
aquasecurity#420

Signed-off-by: Tao Chen <[email protected]>
chentao-kernel added a commit to chentao-kernel/libbpfgo that referenced this issue Apr 8, 2024
The bpf_tc_query/bpf_tc_detach interface should init the parameter first,
sometimes it may be confused for us, so add the case to reduce the confusion.

aquasecurity#421
aquasecurity#420

Signed-off-by: Tao Chen <[email protected]>
chentao-kernel added a commit to chentao-kernel/libbpfgo that referenced this issue Apr 8, 2024
The bpf_tc_query/bpf_tc_detach interface should init the parameter
first, sometimes it may be confused for us, so add the case to reduce
the confusion.

aquasecurity#421
aquasecurity#420

Signed-off-by: Tao Chen <[email protected]>
chentao-kernel added a commit to chentao-kernel/libbpfgo that referenced this issue Apr 8, 2024
The bpf_tc_query/bpf_tc_detach interface should init the parameter
first, sometimes it may be confused for us, so add the case to reduce
the confusion.

aquasecurity#421
aquasecurity#420

Signed-off-by: Tao Chen <[email protected]>
chentao-kernel added a commit to chentao-kernel/libbpfgo that referenced this issue Apr 9, 2024
The bpf_tc_query/bpf_tc_detach interface should init the parameter
first, sometimes it may be confused for us, so add the case to reduce
the confusion.

aquasecurity#421
aquasecurity#420

Signed-off-by: Tao Chen <[email protected]>
geyslan pushed a commit that referenced this issue Apr 9, 2024
The bpf_tc_query/bpf_tc_detach interface should init the parameter
first, sometimes it may be confused for us, so add the case to reduce
the confusion.

#421
#420

Signed-off-by: Tao Chen <[email protected]>
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 a pull request may close this issue.

3 participants