aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-12-04 13:48:28 +0100
committerLennart Poettering <lennart@poettering.net>2018-12-21 12:10:07 +0100
commitfdb4d3138a8af63a662f429fa8330c0717e79a6f (patch)
tree28fb8078b55d004c876f3a470a57f7dc38c1657b
parentsd-network: add new API sd_network_link_get_dns_default_route() (diff)
downloadsystemd-fdb4d3138a8af63a662f429fa8330c0717e79a6f.tar.gz
systemd-fdb4d3138a8af63a662f429fa8330c0717e79a6f.tar.bz2
systemd-fdb4d3138a8af63a662f429fa8330c0717e79a6f.zip
resolved: read DNS default route option from networkd
-rw-r--r--src/resolve/resolved-link.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/resolve/resolved-link.c b/src/resolve/resolved-link.c
index 351d51a30..44f70acea 100644
--- a/src/resolve/resolved-link.c
+++ b/src/resolve/resolved-link.c
@@ -301,6 +301,27 @@ clear:
return r;
}
+static int link_update_default_route(Link *l) {
+ int r;
+
+ assert(l);
+
+ r = sd_network_link_get_dns_default_route(l->ifindex);
+ if (r == -ENODATA) {
+ r = 0;
+ goto clear;
+ }
+ if (r < 0)
+ goto clear;
+
+ l->default_route = r > 0;
+ return 0;
+
+clear:
+ l->default_route = -1;
+ return r;
+}
+
static int link_update_llmnr_support(Link *l) {
_cleanup_free_ char *b = NULL;
int r;
@@ -617,6 +638,10 @@ static void link_read_settings(Link *l) {
r = link_update_search_domains(l);
if (r < 0)
log_warning_errno(r, "Failed to read search domains for interface %s, ignoring: %m", l->name);
+
+ r = link_update_default_route(l);
+ if (r < 0)
+ log_warning_errno(r, "Failed to read default route setting for interface %s, proceeding anyway: %m", l->name);
}
int link_update(Link *l) {