-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Export Map{Key,Value} fields to prevent map {get,list}
handler panics.
#36219
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
Conversation
/test |
6b574c9
to
22fcb3d
Compare
map {get,list}
handler panics.
/test |
The `cilium-dbg map {get,list}` open-api handler will generically try to unpack bpf map data into their respective key/value pairs. However, if the Map{Key,Value} structs have unexported fields this will panic causing the following errors: level=warning msg="Cilium API handler panicked" client=@ method=GET panic_message="reflect: reflect.Value.SetUint using value obtained using unexported field" subsys=api url=/v1/map This can be reproduced by enabling a feature that uses such a map, such as `socketLB.enabled=true`, followed by doing a map list: ``` root@kind-worker:/home/cilium# cilium map list Error: Get "http://localhost/v1/map": EOF ``` This commit exports any unexported fields in types used as key/values in pkg/maps to avoid such errors. Fixes: #33766 Signed-off-by: Tom Hadlaw <tom.hadlaw@isovalent.com>
22fcb3d
to
0412cb6
Compare
/test |
The linked issue says this also affects v1.16, setting |
👋 @tommyp1ckles Backporter here. Double checking whether this PR should be backported to v1.16 or the label should be dropped. |
@tommyp1ckles ping |
pkg/maps/*: export Map{Key,Value} fields to fix cilium-dbg panics.
The
cilium-dbg map {get,list}
open-api handler will generically try tounpack bpf map data into their respective key/value pairs.
However, if the Map{Key,Value} structs have unexported fields this will
panic causing the following errors:
level=warning msg="Cilium API handler panicked" client=@ method=GET panic_message="reflect: reflect.Value.SetUint using value obtained using unexported field" subsys=api url=/v1/map
This can be reproduced by enabling a feature that uses such a map, such
as
socketLB.enabled=true
, followed by doing a map list:This commit exports any unexported fields in types used as key/values in
pkg/maps to avoid such errors.
Fixes: #33766