Skip to content

fix(network): stop injecting ipRange into the CNI config#5078

Draft
mayur-tolexo wants to merge 1 commit into
containerd:mainfrom
mayur-tolexo:fix/network-iprange-cni
Draft

fix(network): stop injecting ipRange into the CNI config#5078
mayur-tolexo wants to merge 1 commit into
containerd:mainfrom
mayur-tolexo:fix/network-iprange-cni

Conversation

@mayur-tolexo

Copy link
Copy Markdown
Contributor

Fixes #5068.

network create --ip-range was writing an ipRange property into the host-local IPAM ranges on disk, but host-local has no such field — it only reads subnet/rangeStart/rangeEnd/gateway and silently ignores anything else. So the property never affected allocation; it was only being read back by network inspect (via case-insensitive JSON) to report Docker's IPRange.

This drops the field from the CNI config and instead recomputes the range CIDR from rangeStart/rangeEnd at inspect time. FirstIPInSubnet only bumps the network's last byte and LastIPInSubnet gives the broadcast, so the bounds invert cleanly back to the original CIDR. network inspect still reports the same IPRange as before and as Docker — the existing inspect e2e that asserts it is unchanged, plus a unit test covers the reconstruction across v4/v6 prefixes.

Same class of issue as --aux-address in #5041; there the reserved pairs aren't derivable so they move to a nerdctl label, whereas ipRange is fully derivable and needs no storage.

Keeping this a draft until #5041 settles, since both touch the same IPAM code and I'll rebase whichever lands second.

host-local's IPAM range has no ipRange field, so `network create --ip-range`
was writing a property the plugin ignores into the on-disk conflist. Drop it
and instead recompute the range CIDR from rangeStart/rangeEnd when reporting
IPRange in `network inspect`, which is the only place the value was read back.

Fixes containerd#5068

Signed-off-by: Mayur Das <mayur.das@neevcloud.com>
@mayur-tolexo
mayur-tolexo force-pushed the fix/network-iprange-cni branch from c7aebfd to 7191d26 Compare July 17, 2026 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

nerdctl network create --ip-range injects a non-existent property ipRange to CNI IPAM config

1 participant