Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

find optimal prefix to allocate to avoid fragmentation #14

Merged
merged 5 commits into from
Jun 7, 2024

Conversation

ecbaldwin
Copy link
Contributor

Given two sets, the first one representing the full IP space which can be used, and a second representing what has already been used or allocated, this algorthim can find a best fit prefix that you can add to reserved set which will minimize the fragmentation of the resulting reserved set.

This can be used to allocate IP address subnets in the best way possible to avoid situations where a subnet cannot be allocated because the space was not allocated carefully enough.

It cannot prevent all fragmentation. Since it has no knowledge of how prefixes may be deallocated in the future, it cannot make decisions to allocate so that deallocations will open up the most contiguous space possible.

ipv4/setnode.go Outdated Show resolved Hide resolved
ipv4/set_test.go Outdated Show resolved Hide resolved
ipv4/set.go Show resolved Hide resolved
ipv4/set.go Show resolved Hide resolved
@ecbaldwin ecbaldwin force-pushed the avoid-fragmentation branch 3 times, most recently from 0795118 to 410b20d Compare June 6, 2024 04:08
Given two sets, the first one representing the full IP space which can
be used, and a second representing what has already been used or
allocated, this algorthim can find a best fit prefix that you can add to
reserved set which will minimize the fragmentation of the resulting
reserved set.

This can be used to allocate IP address subnets in the best way possible
to avoid situations where a subnet cannot be allocated because the space
was not allocated carefully enough.

It cannot prevent all fragmentation. Since it has no knowledge of how
prefixes may be deallocated in the future, it cannot make decisions to
allocate so that deallocations will open up the most contiguous space
possible.
It doesn't necessarily need to complete the entire difference operation.
It can look for the best prefix while it is performing the diff.
@ecbaldwin ecbaldwin force-pushed the avoid-fragmentation branch 2 times, most recently from cd9dec0 to 938bba7 Compare June 7, 2024 04:46
@ecbaldwin ecbaldwin merged commit 8133c26 into master Jun 7, 2024
1 check passed
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.

1 participant