From 378006f0f2ed6fd60642e71b1c8ae4649575ed99 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 28 Jan 2015 16:12:05 +0100 Subject: [PATCH] Restrict the length of container names --- nixos/modules/virtualisation/nixos-container.pl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nixos/modules/virtualisation/nixos-container.pl b/nixos/modules/virtualisation/nixos-container.pl index 9ae5331786c..94edfb37948 100644 --- a/nixos/modules/virtualisation/nixos-container.pl +++ b/nixos/modules/virtualisation/nixos-container.pl @@ -104,6 +104,10 @@ if ($action eq "create") { die "$0: container ‘$containerName’ already exists\n" if -e $confFile; + # Due to interface name length restrictions, container names must + # be restricted too. + die "$0: container name ‘$containerName’ is too long\n" if length $containerName > 11; + # Get an unused IP address. my %usedIPs; foreach my $confFile2 (glob "/etc/containers/*.conf") {