X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fnetwork%2Fnetworkd-network.c;h=6538abe419cf923e2fb3927a34cb1b3c79a0dfb4;hb=486d1a81489da2341454ede4624342aad8334443;hp=056e063f26a79a2e9b9e272dd8a6fbc868519eb1;hpb=bd8f65387673e29f46136a4ed172097035002c23;p=elogind.git diff --git a/src/network/networkd-network.c b/src/network/networkd-network.c index 056e063f2..6538abe41 100644 --- a/src/network/networkd-network.c +++ b/src/network/networkd-network.c @@ -24,6 +24,7 @@ #include "networkd.h" #include "networkd-netdev.h" +#include "networkd-link.h" #include "network-internal.h" #include "path-util.h" #include "conf-files.h" @@ -78,13 +79,10 @@ static int network_load_one(Manager *manager, const char *filename) { if (!network->filename) return log_oom(); - network->ipv4ll_route = true; - network->dhcp = DHCP_SUPPORT_NONE; network->dhcp_ntp = true; network->dhcp_dns = true; network->dhcp_hostname = true; - network->dhcp_domainname = true; network->dhcp_routes = true; network->dhcp_sendhost = true; @@ -168,6 +166,7 @@ void network_free(Network *network) { strv_free(network->ntp); strv_free(network->dns); + strv_free(network->domains); netdev_unref(network->bridge); @@ -343,6 +342,40 @@ int config_parse_netdev(const char *unit, return 0; } +int config_parse_domains(const char *unit, + const char *filename, + unsigned line, + const char *section, + unsigned section_line, + const char *lvalue, + int ltype, + const char *rvalue, + void *data, + void *userdata) { + Network *network = userdata; + char ***domains = data; + char **domain; + int r; + + r = config_parse_strv(unit, filename, line, section, section_line, + lvalue, ltype, rvalue, domains, userdata); + if (r < 0) + return r; + + 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--; + } + + return 0; +} + int config_parse_tunnel(const char *unit, const char *filename, unsigned line,