39 lines
1.6 KiB
Diff
39 lines
1.6 KiB
Diff
From: Javier Viguera <javier.viguera@digi.com>
|
|
Date: Thu, 14 Sep 2017 13:29:52 +0200
|
|
Subject: [PATCH] connectivity: configure network interface for DNS resolution
|
|
|
|
Use the same interface that it's being checked for the DNS resolution.
|
|
|
|
This makes connectivity check work in an scenario where the primary
|
|
interface has lost connectivity (for example ethernet) but you still
|
|
have connectivity through a secondary interface (e.g. wireless).
|
|
|
|
What happens in that case is that even though you have correct
|
|
connectivity in the secondary interface the check fails because it does
|
|
not use that secondary interface to resolve the name of the test URL.
|
|
The result is that the connectivity check assumes that this secondary
|
|
interface is also failing and it penalizes the metrics in the routing
|
|
table.
|
|
|
|
This commit uses libcurl's CURLOPT_DNS_INTERFACE to set the DNS
|
|
interface. Notice that this requires 'libcurl' to be compiled with
|
|
'--enable-ares'.
|
|
|
|
Signed-off-by: Javier Viguera <javier.viguera@digi.com>
|
|
---
|
|
src/nm-connectivity.c | 1 +
|
|
1 file changed, 1 insertion(+)
|
|
|
|
diff --git a/src/nm-connectivity.c b/src/nm-connectivity.c
|
|
index 6f16b28e56ca..c12f145c2ad8 100644
|
|
--- a/src/nm-connectivity.c
|
|
+++ b/src/nm-connectivity.c
|
|
@@ -365,6 +365,7 @@ nm_connectivity_check_async (NMConnectivity *self,
|
|
curl_easy_setopt (ehandle, CURLOPT_PRIVATE, cb_data);
|
|
curl_easy_setopt (ehandle, CURLOPT_HTTPHEADER, cb_data->request_headers);
|
|
curl_easy_setopt (ehandle, CURLOPT_INTERFACE, cb_data->ifspec);
|
|
+ curl_easy_setopt (ehandle, CURLOPT_DNS_INTERFACE, iface);
|
|
curl_multi_add_handle (priv->curl_mhandle, ehandle);
|
|
|
|
cb_data->timeout_id = g_timeout_add_seconds (30, timeout_cb, cb_data);
|