From c9b02d628812cadf02a8f1245ebe3fa405e4a26b Mon Sep 17 00:00:00 2001 From: Javier Viguera Date: Thu, 14 Sep 2017 14:01:24 +0200 Subject: [PATCH] networkmanager: connectivity check: set 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'. https://jira.digi.com/browse/DEL-4787 Signed-off-by: Javier Viguera --- ...figure-network-interface-for-DNS-res.patch | 38 +++++++++++++++++++ .../networkmanager/networkmanager_%.bbappend | 1 + 2 files changed, 39 insertions(+) create mode 100644 meta-digi-dey/recipes-connectivity/networkmanager/networkmanager/0001-connectivity-configure-network-interface-for-DNS-res.patch diff --git a/meta-digi-dey/recipes-connectivity/networkmanager/networkmanager/0001-connectivity-configure-network-interface-for-DNS-res.patch b/meta-digi-dey/recipes-connectivity/networkmanager/networkmanager/0001-connectivity-configure-network-interface-for-DNS-res.patch new file mode 100644 index 000000000..e18331c9a --- /dev/null +++ b/meta-digi-dey/recipes-connectivity/networkmanager/networkmanager/0001-connectivity-configure-network-interface-for-DNS-res.patch @@ -0,0 +1,38 @@ +From: Javier Viguera +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 +--- + 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); diff --git a/meta-digi-dey/recipes-connectivity/networkmanager/networkmanager_%.bbappend b/meta-digi-dey/recipes-connectivity/networkmanager/networkmanager_%.bbappend index f744aa2d4..887fe5d0d 100644 --- a/meta-digi-dey/recipes-connectivity/networkmanager/networkmanager_%.bbappend +++ b/meta-digi-dey/recipes-connectivity/networkmanager/networkmanager_%.bbappend @@ -12,6 +12,7 @@ SRC_URI += " \ file://nm.eth1.static \ file://nm.wlan0.dhcp \ file://nm.wlan0.static \ + file://0001-connectivity-configure-network-interface-for-DNS-res.patch \ " # 'polkit' depends on 'consolekit', and this requires 'x11' distro feature. So