From fdb4d3138a8af63a662f429fa8330c0717e79a6f Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 4 Dec 2018 13:48:28 +0100 Subject: resolved: read DNS default route option from networkd --- src/resolve/resolved-link.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) 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) { -- cgit v1.2.3-65-gdbad