mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-08-26 02:05:02 +00:00
nixos/containers: fix IPv4-mapped addresses
lib.network.ipv6.fromString tries to parse the address and fails with IPv4-mapped addresses, but we actually just want to extract the prefix, so do this using string operations, as for IPv4. Fixes issue #530543.
This commit is contained in:
@@ -524,8 +524,8 @@ let
|
||||
tmpfs = null;
|
||||
};
|
||||
|
||||
# Parses an IPv4 address with an optional prefix
|
||||
ipv4FromString =
|
||||
# Parses an IP address with an optional prefix
|
||||
ipFromString =
|
||||
str:
|
||||
let
|
||||
segments = lib.splitString "/" str;
|
||||
@@ -610,10 +610,10 @@ in
|
||||
networking.interfaces = lib.mkIf config.privateNetwork (
|
||||
lib.mkMerge [
|
||||
(lib.mkIf (config.localAddress != null) {
|
||||
eth0.ipv4.addresses = [ (ipv4FromString config.localAddress) ];
|
||||
eth0.ipv4.addresses = [ (ipFromString config.localAddress) ];
|
||||
})
|
||||
(lib.mkIf (config.localAddress6 != null) {
|
||||
eth0.ipv6.addresses = [ (lib.network.ipv6.fromString config.localAddress6) ];
|
||||
eth0.ipv6.addresses = [ (ipFromString config.localAddress6) ];
|
||||
})
|
||||
]
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user