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

nixos-container: Make show-ip work together with ipv4 + netmask #31753

Merged
merged 2 commits into from Nov 17, 2017
Merged

nixos-container: Make show-ip work together with ipv4 + netmask #31753

merged 2 commits into from Nov 17, 2017

Conversation

mbld
Copy link

@mbld mbld commented Nov 16, 2017

Motivation for this change

The containers local address can be given as ipv4 only or with a subnetmask in
CIDR notation in the container configuration, see [1]. This works fine but the
'nixos-container show-ip' only supports plain ipv4 addresses without the netmask
suffix.

[1]

If a hostBridge is used, this should be given with netmask to access

Things done
  • Changed the regex to also match in case of a CIDR netmask suffix.
  • Modified an exiting test to also cover this case.
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

Martin Bornhold added 2 commits November 16, 2017 20:25
The containers local address can be given as ipv4 only or with a subnetmask in
CIDR notation in the container configuration, see [1]. This works fine but the
'nixos-container show-ip' only supports plain ipv4 addresses without the netmask
suffix.

Changed the regex to also match in case of a CIDR netmask suffix.

[1] https://github.com/NixOS/nixpkgs/blob/9939032e35bb144bc8f6b57ed6325089910f738c/nixos/modules/virtualisation/containers.nix#L382
Modified the existing test to check that the 'nixos-container show-ip' command
can handle ipv4 addresses with submask in CIDR notation.
@orivej
Copy link
Contributor

orivej commented Nov 17, 2017

Thank you! I'm not familiar with nixos-container, but thanks to the test I was able to verify your patch.

@orivej orivej merged commit 963204e into NixOS:master Nov 17, 2017
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.

None yet

3 participants