NetworkManager/src/dns
Thomas Haller 44ebb99cfa
dns: detect support of systemd-resolved's SetLinkDefaultRoute() and avoid it
We now always use SetLinkDefaultRoute(), but that API was only added in
systemd v240 ([1]).

We could just always call the non-existing method, and ignore the
error. However, that feels ugly. Would systemd-resolved log warnings
about that? Should we suppress all messages about that failure (not
good for debugging).

Instead, make an effort to detect support of the function, and avoid
calling it. That is significantly more complicated than just always
calling the method and not care.

Note that even if systemd-resolved does not support SetLinkDefaultRoute(),
we cannot do anything smart about that. We would simply rely on
systemd-resolved (hopefully) doing the right thing automatically.
That's better and simpler than explicitly adding a "~." domain in
the fallback case.

Also, detecting support is straight forward in the common case, where
there is either success or a clear "org.freedesktop.DBus.Error.UnknownMethod"
error. In cases where there is any other failure, we don't really know.
In that case, we keep trying to use the API under the assumption that
it should work.

[1] https://github.com/systemd/systemd/commit/7 ## 7673795dcf5797491e7f785cbf5077d29a15db4
2020-11-27 10:46:42 +01:00
..
nm-dns-dnsmasq.c dns/trivial: rename NMDnsIPConfigData to NMDnsConfigIPData 2020-11-24 08:53:01 +01:00
nm-dns-dnsmasq.h all: unify comment style for SPDX-License-Identifier tag 2020-09-29 16:50:53 +02:00
nm-dns-manager.c dns/trivial: rename NMDnsIPConfigData to NMDnsConfigIPData 2020-11-24 08:53:01 +01:00
nm-dns-manager.h dns/trivial: rename NMDnsIPConfigData to NMDnsConfigIPData 2020-11-24 08:53:01 +01:00
nm-dns-plugin.c all: unify comment style for SPDX-License-Identifier tag 2020-09-29 16:50:53 +02:00
nm-dns-plugin.h dns/trivial: rename NMDnsIPConfigData to NMDnsConfigIPData 2020-11-24 08:53:01 +01:00
nm-dns-systemd-resolved.c dns: detect support of systemd-resolved's SetLinkDefaultRoute() and avoid it 2020-11-27 10:46:42 +01:00
nm-dns-systemd-resolved.h all: unify comment style for SPDX-License-Identifier tag 2020-09-29 16:50:53 +02:00
nm-dns-unbound.c all: unify comment style for SPDX-License-Identifier tag 2020-09-29 16:50:53 +02:00
nm-dns-unbound.h all: unify comment style for SPDX-License-Identifier tag 2020-09-29 16:50:53 +02:00