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

Fix subnet overlapping #2358

Merged
merged 1 commit into from
Jul 17, 2023
Merged

Conversation

yldoge
Copy link

@yldoge yldoge commented Jul 5, 2023

#2322
Fix subnet address space overlapping under such circumstance:
when there's no default bridge network,

  1. nerdctl network create {...} without passing --subnet (this will create a non-default network but use up the default CIDR 10.4.0.0/24);
  2. nerdctl run {...} using the default network

@@ -475,7 +475,7 @@ func (e *CNIEnv) parseSubnet(subnetStr string) (*net.IPNet, error) {
return nil, err
}
if subnetStr == "" {
_, defaultSubnet, _ := net.ParseCIDR(DefaultCIDR)
_, defaultSubnet, _ := net.ParseCIDR(StartingCIDR)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. Thank you.

@AkihiroSuda AkihiroSuda added this to the v1.5.0 milestone Jul 16, 2023
@@ -40,6 +40,8 @@ const (
DefaultNetworkName = "bridge"
DefaultCIDR = "10.4.0.0/24"
DefaultIPAMDriver = "host-local"

StartingCIDR = "10.4.1.0/24"
Copy link
Member

@AkihiroSuda AkihiroSuda Jul 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs a comment line to explain how this is different from DefaultCIDR

Copy link
Author

@yldoge yldoge Jul 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a comment for StartingCIDR, thanks.

@AkihiroSuda
Copy link
Member

Please squash commits

@AkihiroSuda
Copy link
Member

AkihiroSuda commented Jul 17, 2023

FAIL - commit subject exceeds 90 characters

https://github.com/containerd/nerdctl/actions/runs/5578004366/jobs/10191593601?pr=2358

Signed-off-by: York Yao <york.yaoluxunzhe@hotmail.com>
Copy link
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@AkihiroSuda AkihiroSuda merged commit 57a842a into containerd:main Jul 17, 2023
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants