fix(cni): forward DEL to host-device delegated plugin#244
Merged
Conversation
cmdAdd invokes host-device via delegation but cmdDel never forwarded the DEL command back, violating CNI spec §4 (Plugin Delegation). This could cause state leaks if host-device tracks references or devices. Error is intentionally ignored per spec — DEL must be idempotent and succeed even if resources are already gone. Only applies to veth mode; tap mode has no host-device delegation. fixes #238
scotwells
approved these changes
Jul 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
cmdDelnever forwards the DEL command to thehost-devicedelegated plugin, even though ADD invokes it. The CNI spec §4 (Plugin Delegation) requires:Currently
internal/cni/ops_del.godeallocates IPAM and returns without callinghostDevice("DEL", ...).Impact
If
host-devicemaintains any state (reference counting, device tracking, future extensions), it will leak on pod deletion. Even if the current host-device binary is a no-op on DEL, this is a latent spec violation that any contributor extending host-device would inherit.Fix
Add
hostDevice("DEL", args, pluginConf)tocmdDelininternal/cni/ops_del.go, after IPAM deallocation and before the final result print. The error is intentionally ignored per CNI spec — DEL must be idempotent and return success even if resources are already gone.Only applies to veth mode; tap mode has no host-device delegation.
Verification
task cipasses: lint (0 issues), build, unit tests, e2e testshostDevice("ADD", ...)inbuildVethResult()now has a symmetric DELCloses #238
Generated with Qwen Code (1-shotted by Qwen-Coder)