Repository navigation
fix(cni): Reject a whitespace-only eBPF interface override - #1265
Conversation
ResolveInterfaces trimmed GALACTIC_CNI_EBPF_INTERFACES before deciding whether it was set, so a value made only of whitespace was treated as unset and fell through to auto-detection, while a value made only of commas was rejected. The override is now considered set whenever the raw value is non-empty, and a set value that yields no interface names is an error either way. An unset or empty variable still auto-detects. The override unit test stubbed bond expansion but not the route and link lookups auto-detection uses, so the whitespace case read the host's routing table and passed or failed depending on whether the machine had a usable IPv6 route. The override cases now stub both lookups and fail if any case reaches auto-detection. Fixes #1226
|
Two independent reviews ran on head 7c2e6ab, and both returned merge with nothing above a nit. The correctness review read the diff against the approved plan in #1226, checked that the new stubs are restored and reset per case, reran the resolver tests and ran the linter on the package. The conventions review checked the title, body, commit message and open pull requests touching the same files. Two nits stay open. One doc comment line runs longer than its neighbours, and draft #598 edits the same doc page, so whichever lands second may need a rebase. Required checks are green on this head. Auto-merge is on and waits for a code owner approval. |
ecv
left a comment
There was a problem hiding this comment.
Approve.
GALACTIC_CNI_EBPF_INTERFACES set to whitespace only is now an error, like a value of only commas, instead of silently falling through to auto-detection. The decision uses the raw value, so unset or empty still auto-detects, and the test now fails if any override case reaches the routing table.
Summary
An interface override made only of spaces was quietly treated as unset, so the CNI fell back to detecting uplinks from the routing table instead of reporting the bad value. It is now rejected the same way an override made only of commas already was, while an unset or empty override still means auto-detect.
The unit test for this case also read the real routing table, so it failed on machines with an IPv6 route and passed on CI runners. The override tests no longer touch the host and fail if any case falls through to detection.
Test plan
Fixes #1226