-
Notifications
You must be signed in to change notification settings - Fork 96
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
Add strict mode API #160
Add strict mode API #160
Conversation
222261b
to
96eb304
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just the one comment, this is a very welcome addition, thank you very much!
96eb304
to
f0722d3
Compare
Addressed review feedback + added some more strict mode values |
See https://github.com/libbpf/libbpf/wiki/Libbpf-1.0-migration-guide for context. Related to aquasecurity#159
f0722d3
to
9dab898
Compare
Addressed feedback |
} | ||
|
||
func SetStrictMode(mode LibbpfStrictMode) { | ||
C.libbpf_set_strict_mode(uint32(mode)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
C.libbpf_set_strict_mode(uint32(mode)) | |
C.libbpf_set_strict_mode(C.uint(mode)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Last thing, then good to merge 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding this errors with:
../libbpfgo/libbpfgo.go:365:27: cannot use _Ctype_uint(mode) (value of type _Ctype_uint) as type uint32 in argument to (_Cfunc_libbpf_set_strict_mode)
Seems like uint32
is the right type 😄. Passing a "Go" type seems recurrent for enums. I tried searching for this behaviour, but my Google-fu failed me
https://github.com/aquasecurity/libbpfgo/blob/main/libbpfgo.go#L1158-L1160
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's so strange, I can in fact reproduce that.
I did some googling and apparently enums are simplified to uint32's in CGO wrappers. This issue isn't the same as ours specifically, but it does mention this. Learn something new everyday :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TIL too!! :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
L G T M !
See https://github.com/libbpf/libbpf/wiki/Libbpf-1.0-migration-guide for context.
Related to #159
cc/ @Sylfrena @kakkoyun @v-thakkar