From 2d4555ec97d2cb0829106cbff82753bd168e5a20 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 12 May 2017 09:37:42 +0200 Subject: [PATCH 1/3] connectivity: avoid compiler warning for argument of curl_easy_getinfo() libcurl employs some typechecking via "curl/typecheck-gcc.h". When compling with --enable-lto, compilation fails otherwise with: make[2]: Entering directory '/data/src/NetworkManager' CC src/src_libNetworkManager_la-nm-connectivity.lo CCLD src/libNetworkManager.la CCLD src/libNetworkManagerTest.la CCLD src/dhcp/tests/test-dhcp-dhclient src/nm-connectivity.c: In function 'curl_check_connectivity': src/nm-connectivity.c:147:10: error: call to '_curl_easy_getinfo_err_string' declared with attribute warning: curl_easy_getinfo expects a pointer to char * for this info [-Werror] eret = curl_easy_getinfo (msg->easy_handle, CURLINFO_PRIVATE, &cb_data); ^ lto1: all warnings being treated as errors lto-wrapper: fatal error: /usr/bin/gcc returned 1 exit status compilation terminated. /usr/bin/ld: error: lto-wrapper failed (cherry picked from commit 7f8815a9c35c3b588b174c5e0c2568d3068726f6) (cherry picked from commit 7f139c8ea87d0ceaa1f1d3601c846ace9054ffe5) --- src/nm-connectivity.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nm-connectivity.c b/src/nm-connectivity.c index 75bb7b6..0708d96 100644 --- a/src/nm-connectivity.c +++ b/src/nm-connectivity.c @@ -144,7 +144,7 @@ curl_check_connectivity (CURLM *mhandle, CURLMcode ret) continue; /* Here we have completed a session. Check easy session result. */ - eret = curl_easy_getinfo (msg->easy_handle, CURLINFO_PRIVATE, &cb_data); + eret = curl_easy_getinfo (msg->easy_handle, CURLINFO_PRIVATE, (char **) &cb_data); if (eret != CURLE_OK) { _LOG2E ("curl cannot extract cb_data for easy handle %p, skipping msg", msg->easy_handle); continue; -- 2.9.4 From e94a36ce1c880c5a4f52ae59d18bb2b6d2bee704 Mon Sep 17 00:00:00 2001 From: Francesco Giudici Date: Wed, 3 May 2017 17:01:41 +0200 Subject: [PATCH 2/3] connectivity: fix typo in error message (cherry picked from commit 7a2c31a54a7ee82b930b0d9ef21ea11f565c2859) (cherry picked from commit 16187171709347611caf9b8e8c75988c15b66b12) --- src/nm-connectivity.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nm-connectivity.c b/src/nm-connectivity.c index 0708d96..b96737c 100644 --- a/src/nm-connectivity.c +++ b/src/nm-connectivity.c @@ -498,7 +498,7 @@ nm_connectivity_init (NMConnectivity *self) priv->curl_mhandle = curl_multi_init (); if (priv->curl_mhandle == NULL) { - _LOGE ("cnable to init cURL, connectivity check will not work"); + _LOGE ("unable to init cURL, connectivity check will not work"); return; } -- 2.9.4 From fe45631585e93e15c552194cf4ffd82cbe513ee1 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 2 Jun 2017 19:11:11 +0200 Subject: [PATCH 3/3] connectivity: fix scheduling periodic connectivity checks commit a955639 (connectivity: don't do periodic checks on interval=0) broke scheduling connectivity checks. That is because the timer is on only scheduled if nm_connectivity_check_enabled(), which in turn only returns TRUE if curl_mhandle is set. However, nm_connectivity_init() would only initialize curl_mhandle after update_config(), missing to schedule the periodic task. https://mail.gnome.org/archives/networkmanager-list/2017-May/msg00076.html Fixes: a95563996f07641e9877eb1760cac24415b65070 (cherry picked from commit f1eb1619f173a092c49dfcd1d53ec356827b6e0a) (cherry picked from commit e984d9eb36f7838df58c0606bd00efc10730d329) --- src/nm-connectivity.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/src/nm-connectivity.c b/src/nm-connectivity.c index b96737c..6f16b28 100644 --- a/src/nm-connectivity.c +++ b/src/nm-connectivity.c @@ -486,27 +486,28 @@ nm_connectivity_init (NMConnectivity *self) NMConnectivityPrivate *priv = NM_CONNECTIVITY_GET_PRIVATE (self); CURLcode retv; - priv->config = g_object_ref (nm_config_get ()); - update_config (self, nm_config_get_data (priv->config)); - g_signal_connect (G_OBJECT (priv->config), - NM_CONFIG_SIGNAL_CONFIG_CHANGED, - G_CALLBACK (config_changed_cb), - self); - retv = curl_global_init (CURL_GLOBAL_ALL); if (retv == CURLE_OK) priv->curl_mhandle = curl_multi_init (); - if (priv->curl_mhandle == NULL) { + if (!priv->curl_mhandle) _LOGE ("unable to init cURL, connectivity check will not work"); - return; + else { + curl_multi_setopt (priv->curl_mhandle, CURLMOPT_SOCKETFUNCTION, multi_socket_cb); + curl_multi_setopt (priv->curl_mhandle, CURLMOPT_SOCKETDATA, self); + curl_multi_setopt (priv->curl_mhandle, CURLMOPT_TIMERFUNCTION, multi_timer_cb); + curl_multi_setopt (priv->curl_mhandle, CURLMOPT_TIMERDATA, self); + curl_multi_setopt (priv->curl_mhandle, CURLOPT_VERBOSE, 1); } - curl_multi_setopt (priv->curl_mhandle, CURLMOPT_SOCKETFUNCTION, multi_socket_cb); - curl_multi_setopt (priv->curl_mhandle, CURLMOPT_SOCKETDATA, self); - curl_multi_setopt (priv->curl_mhandle, CURLMOPT_TIMERFUNCTION, multi_timer_cb); - curl_multi_setopt (priv->curl_mhandle, CURLMOPT_TIMERDATA, self); - curl_multi_setopt (priv->curl_mhandle, CURLOPT_VERBOSE, 1); + priv->config = g_object_ref (nm_config_get ()); + + update_config (self, nm_config_get_data (priv->config)); + g_signal_connect (G_OBJECT (priv->config), + NM_CONFIG_SIGNAL_CONFIG_CHANGED, + G_CALLBACK (config_changed_cb), + self); + } static void -- 2.9.4