core: don't restrict DNS interface when performing connectivity check

Currently, when performing DNS resolution with systemd-resolved,
NetworkManager tells systemd-resolved to consider only DNS configuration
for the network interface that the connectivity check request will be
routed through. But this is not correct because DNS and routing are
configured entirely separately. For example, say we have a VPN that
receives all DNS but only a subset of routing. NetworkManager will
configure systemd-resolved with no DNS servers on any interface except
for the VPN interface, but will still route traffic through other
interfaces. This is entirely legitimate and works fine in practice,
except for the connectivity check.

To fix this, we just drop the restriction and allow systemd-resolved to
consider its full configuration, which is what gets used normally
anyway. This allows our connectivity check to match the real
configuration instead of failing spuriously.

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1107

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1415
This commit is contained in:
Michael Catanzaro 2022-10-05 16:03:23 -05:00 committed by Thomas Haller
parent c715105372
commit e6dac4f0b6
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -82,7 +82,6 @@ struct _NMConnectivityCheckHandle {
gsize response_good_cnt;
guint curl_timer;
int ch_ifindex;
} concheck;
#endif
@ -1049,8 +1048,6 @@ nm_connectivity_check_start(NMConnectivity *self,
NMConnectivityState state;
const char *reason;
cb_data->concheck.ch_ifindex = ifindex;
if (platform) {
state = check_platform_config(self, platform, ifindex, addr_family, &reason);
nm_assert((state == NM_CONNECTIVITY_UNKNOWN) == !reason);
@ -1106,7 +1103,7 @@ nm_connectivity_check_start(NMConnectivity *self,
"org.freedesktop.resolve1.Manager",
"ResolveHostname",
g_variant_new("(isit)",
(gint32) cb_data->concheck.ch_ifindex,
0,
cb_data->concheck.con_config->host,
(gint32) cb_data->addr_family,
SD_RESOLVED_DNS),