[systemd-commits] src/network

Lennart Poettering lennart at kemper.freedesktop.org
Fri Aug 15 07:21:42 PDT 2014


 src/network/networkd-network.c |   21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

New commits:
commit 40274ed6232389442f24205bc15779b9a4fe2942
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Aug 15 16:21:19 2014 +0200

    networkd: print nice warnings if people configure invalid domain names

diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c
index 6538abe..803fcdd 100644
--- a/src/network/networkd-network.c
+++ b/src/network/networkd-network.c
@@ -365,13 +365,20 @@ int config_parse_domains(const char *unit,
         strv_uniq(*domains);
         network->wildcard_domain = !!strv_find(*domains, "*");
 
-        STRV_FOREACH(domain, *domains)
-                if (is_localhost(*domain) || !hostname_is_valid(*domain) || streq(*domain, "*")) {
-                        strv_remove(*domains, *domain);
-
-                        /* We removed one entry, make sure we don't skip the next one */
-                        domain--;
-                }
+        STRV_FOREACH(domain, *domains) {
+                if (is_localhost(*domain))
+                        log_syntax(unit, LOG_ERR, filename, line, EINVAL, "'localhost' domain names may not be configured, ignoring assignment: %s", *domain);
+                else if (!hostname_is_valid(*domain)) {
+                        if (!streq(*domain, "*"))
+                                log_syntax(unit, LOG_ERR, filename, line, EINVAL, "domain name is not valid, ignoring assignment: %s", *domain);
+                } else
+                        continue;
+
+                strv_remove(*domains, *domain);
+
+                /* We removed one entry, make sure we don't skip the next one */
+                domain--;
+        }
 
         return 0;
 }



More information about the systemd-commits mailing list