summaryrefslogtreecommitdiff
path: root/src/basic
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-01-25 19:46:00 +0100
committerLennart Poettering <lennart@poettering.net>2016-01-26 14:42:03 +0100
commit3df9bec57c3e2d96f7e2a25961585cfa609b61eb (patch)
tree41dc9aafc458479cc827fe32a75eacbd9afdb3b0 /src/basic
parent1d35b2d6e25ba100c903f02c92c67389e67bb913 (diff)
networkd: rework Domains= setting
Previously, .network files only knew a vaguely defined "Domains=" concept, for which the documentation declared it was the "DNS domain" for the network connection, without specifying what that means. With this the Domains setting is reworked, so that there are now "routing" domains and "search" domains. The former are to be used by resolved to route DNS request to specific network interfaces, the latter is to be used for searching single-label hostnames with (in addition to being used for routing). Both settings are configured in the "Domains=" setting. Normal domain names listed in it are now considered search domains (for compatibility with existing setups), while those prefixed with "~" are considered routing domains only. To route all lookups to a specific interface the routing domain "." may be used, referring to the root domain. An alternative syntax for this is the "*", as was already implemented before using the "wildcard" domain concept. This commit adds proper parsers for this new logic, and exposes this via the sd-network API. This information is not used by resolved yet, this will be added in a later commit.
Diffstat (limited to 'src/basic')
-rw-r--r--src/basic/strv.c31
-rw-r--r--src/basic/strv.h2
2 files changed, 33 insertions, 0 deletions
diff --git a/src/basic/strv.c b/src/basic/strv.c
index 0a3d15706f..dc5bafcf24 100644
--- a/src/basic/strv.c
+++ b/src/basic/strv.c
@@ -871,3 +871,34 @@ rollback:
nl[k] = NULL;
return -ENOMEM;
}
+
+int fputstrv(FILE *f, char **l, const char *separator, bool *space) {
+ bool b = false;
+ char **s;
+ int r;
+
+ /* Like fputs(), but for strv, and with a less stupid argument order */
+
+ if (!f)
+ f = stdout;
+ if (!separator)
+ separator = " ";
+ if (!space)
+ space = &b;
+
+ STRV_FOREACH(s, l) {
+ if (*space) {
+ r = fputs(separator, f);
+ if (r < 0)
+ return r;
+ }
+
+ r = fputs(*s, f);
+ if (r < 0)
+ return r;
+
+ *space = true;
+ }
+
+ return 0;
+}
diff --git a/src/basic/strv.h b/src/basic/strv.h
index bb61db2638..560f90115c 100644
--- a/src/basic/strv.h
+++ b/src/basic/strv.h
@@ -169,3 +169,5 @@ char ***strv_free_free(char ***l);
char **strv_skip(char **l, size_t n);
int strv_extend_n(char ***l, const char *value, size_t n);
+
+int fputstrv(FILE *f, char **l, const char *separator, bool *space);