diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-08-15 16:21:19 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-08-15 16:21:19 +0200 |
commit | 40274ed6232389442f24205bc15779b9a4fe2942 (patch) | |
tree | b5b927c724520f503688c40f2c8c1119267ee9ab /src/network/networkd-network.c | |
parent | a0627f82e23491a08106b7329dbbe006c9b579aa (diff) |
networkd: print nice warnings if people configure invalid domain names
Diffstat (limited to 'src/network/networkd-network.c')
-rw-r--r-- | src/network/networkd-network.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c index 6538abe419..803fcdd609 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; } |