[PATCH] conf: network: Allow hostnames to start with a number

Peter Krempa pkrempa at redhat.com
Tue Jan 25 14:49:15 UTC 2022

From: Nicolas Lécureuil <neoclust at mageia.org>

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.


Signed-off-by: Nicolas Lécureuil <nicolas.lecureuil at siveo.net>
Reviewed-by: Peter Krempa <pkrempa at redhat.com>

Pushed after review of a trivial merge request.

 src/conf/network_conf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index 10d3330fdf..c769bbaeb5 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -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]))) {
                        _("Cannot use host name '%s' in network '%s'"),
                        name, networkName);

More information about the libvir-list mailing list