]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
conf: network: Allow hostnames to start with a number
authorNicolas Lécureuil <neoclust@mageia.org>
Fri, 14 Jan 2022 11:02:08 +0000 (12:02 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 25 Jan 2022 14:47:05 +0000 (15:47 +0100)
RFC952 mandated that hostnames would start with an alpha character.
This requirement was later relaxed by RFC1123 which allowed hostnames to
start with a number as well.

https://datatracker.ietf.org/doc/html/rfc952
https://datatracker.ietf.org/doc/html/rfc1123#page-13

Signed-off-by: Nicolas Lécureuil <nicolas.lecureuil@siveo.net>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
src/conf/network_conf.c

index 10d3330fdf50f18d01d8bbbffeefa6b8040ac39f..c769bbaeb5dc950d2409abd37b1168290128e428 100644 (file)
@@ -548,7 +548,7 @@ virNetworkDHCPHostDefParseXML(const char *networkName,
     }
 
     name = virXMLPropString(node, "name");
-    if (name && (!g_ascii_isalpha(name[0]))) {
+    if (name && !(g_ascii_isalpha(name[0]) || g_ascii_isdigit(name[0]))) {
         virReportError(VIR_ERR_XML_ERROR,
                        _("Cannot use host name '%s' in network '%s'"),
                        name, networkName);