[libvirt PATCH] conf: network: remove hostname validation

Ján Tomko jtomko at redhat.com
Thu Jan 27 21:33:24 UTC 2022


We used to validate that the first character of the hostname is a
letter. Later, RFC1123 relaxed the requirements to allow a number
as well.

Drop the validation completely, since we do not care about the
following characters, and neither does dnsmasq (even if it's a comma,
which is a delimiter in the hosts file).

Reverts: 673b74be5fda928da5e9f3c2cfbf6c1cb1eda0c6
Signed-off-by: Ján Tomko <jtomko at redhat.com>
---
 src/conf/network_conf.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index c769bbaeb5..8f50e22be5 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -548,12 +548,6 @@ virNetworkDHCPHostDefParseXML(const char *networkName,
     }
 
     name = virXMLPropString(node, "name");
-    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);
-        return -1;
-    }
 
     ip = virXMLPropString(node, "ip");
     if (ip && (virSocketAddrParse(&inaddr, ip, AF_UNSPEC) < 0)) {
-- 
2.31.1




More information about the libvir-list mailing list