moby / moby/libnetwork

IP allocator to take firstIP and lastIP instead of CIDR block

Open
#437 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement status/0-needs-triage
Dominant language
Go
Stars
2.2k
Forks
875
PR merge metrics
No merged PRs in 30d

Description

(Related to https://github.com/docker/docker/issues/15287)

It would be more flexible if the IP allocator could be instructed to use an arbitrary range of addresses, e.g. 10.10.0.100 - 10.10.0.199, rather than be restricted to a block on a CIDR boundary.

In fact, the allocator already works this way internally: newAllocatedMap explodes the passed CIDR range into firstIP and lastIP.

Therefore I think it would be pretty simple for newAllocatedMap to change it to take firstIP and lastIP as arguments instead; with a similar change to RegisterSubnet to become RegisterRange.

RegisterSubnet can then become a wrapper which calls RegisterRange, as a transition measure and/or as an alternate API for callers who have a CIDR block and don't want to calculate firstIP and lastIP themselves.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating newAllocatedMap and RegisterSubnet in the Go source and trace how the allocator derives firstIP and lastIP from a CIDR range. Confirm the existing allocation behavior, then define the RegisterRange path for explicit bounds while keeping RegisterSubnet as a CIDR-based wrapper. Done means arbitrary ranges work without breaking existing callers.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
networking
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.