In bugtool, the path to the BPF filesystem is hardcoded to /sys/fs/bpf:
https://github.com/cilium/cilium/blob/f55458f9bfd412b7334b535c43bab593910c6b31/bugtool/cmd/configuration.go#L67-L70
In some environments, however, the BPF filesystem is mounted elsewhere. Our bugtool should retrieve the correct path automatically. Without this we may be missing some map contents (e.g., CT maps) in some environments.
Note: the agent retrieve the alternate location with the --bpf-root option and holds it in the option.Config.BPFRoot variable.
Note: the agent retrieve the alternate location with the --bpf-root option and holds it in the option.Config.BPFRoot variable.
I think bugtool should not rely on the agent being up and running. Otherwise, it won't be possible to retrieve its output when cilium-agent is failing to run (e.g. due to OOM).
I think
bugtoolshould not rely on the agent being up and running. Otherwise, it won't be possible to retrieve its output whencilium-agentis failing to run (e.g. due to OOM).
I agree. We should try to get cilium-agent's bpffs path and fallback to our current default otherwise.
There might be a simpler solution, we could search for bpffs mountpoints with mount | grep bpf and list all of them (+ fallback on /sys/fs/bpf/ if nothing found, although I'm not sure if there's a case when it wouldn't show up in mount). This way we don't have to ask to the agent.
Most helpful comment
There might be a simpler solution, we could search for bpffs mountpoints with
mount | grep bpfand list all of them (+ fallback on/sys/fs/bpf/if nothing found, although I'm not sure if there's a case when it wouldn't show up inmount). This way we don't have to ask to the agent.