From 3d81e6260b5770f91d853a0cbb9f27084df64b26 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Sun, 11 Apr 2021 20:52:14 -0700 Subject: [PATCH] net/dns: set resolved DefaultRoute setting according to split-dns mode. Signed-off-by: David Anderson --- net/dns/resolved.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/dns/resolved.go b/net/dns/resolved.go index c65edbcb3..523cf0d70 100644 --- a/net/dns/resolved.go +++ b/net/dns/resolved.go @@ -185,6 +185,10 @@ func (m resolvedManager) SetDNS(config OSConfig) error { return fmt.Errorf("setLinkDomains: %w", err) } + if call := resolved.CallWithContext(ctx, "org.freedesktop.resolve1.Manager.SetLinkDefaultRoute", 0, iface.Index, len(config.MatchDomains) == 0); call.Err != nil { + return fmt.Errorf("setLinkDefaultRoute: %w", err) + } + // Some best-effort setting of things, but resolved should do the // right thing if these fail (e.g. a really old resolved version // or something).