Network access to localhost disabled for Qt when network interfaces are down

asked 2017-12-12 09:36:14 +0200

rinigus gravatar image

updated 2017-12-12 23:12:11 +0200

This is related to https://bugreports.qt.io/browse/QTBUG-59219 and fixed in https://codereview.qt-project.org/#/c/202192/

I am a hitting a bug in Qt that leads to disabling network access even for apps that wish to communicate to localhost. As shown in the references above, its a known problem that has been fixed recently. I would like to ask to backport this fix and make it possible to use libraries that use Qt for HTTP or other localhost requests.

Error message that we get from Qt is "Network access is disabled" when we try communicate without external network.

Use case

I am using localhost network communication to provide native offline maps service through OSM Scout Server. This offline maps solution works perfectly when the clients accessing it are using non-Qt access mechanisms, such as used in Poor Maps and modRana.

This weekend I released a new version that supports Mapbox GL vector tiles together with the client program to access the tiles using Mapbox GL Native library. As a result, we get native offline maps with fast OpenGL accelerated rendering supporting rotation, tilting, to name the few features. However, this library, as a good Qt citizen, uses Qt Network Access Manager that has a bug we are hitting. So, I started getting feedback from users (https://openrepos.net/comment/22975#comment-22975 , http://talk.maemo.org/showpost.php?p=1539297&postcount=382 ). In short, communication between map client and OSM Scout Server works iff you have network enabled (WiFi or Cellular). For that matter, WiFi could be enabled and not even connecting to the outside world to make it all work.

Fix

I am not aware of any workaround for it except rewriting network access in Mapbox GL Native library. If there are any temporary workarounds on how to fool Qt to stop complaining about "Network access", please let me know.

For users of OSM Scout Server, I would suggest to have a network access enabled (will eat your battery) and vote this up to get attention.

Edit There is a new version of Mapbox GL plugin that uses libcurl for network communication. This should fix the issues for OSM Scout Server users. Plugin is available at OpenRepos

edit retag flag offensive close delete

Comments

2

I agree and have the same network issue trying to reach a HTTP server on the host computer when connected via USB. No Internet access means no access to the computer through the 192.168.x.y neither...

Damien Caliste ( 2017-12-12 10:08:11 +0200 )edit
2

I don't think it will fix issues with 192.168.x.y . Looks like the fix compares only with the localhost at line 1336 of https://codereview.qt-project.org/#/c/202192/5//ALL

rinigus ( 2017-12-12 10:12:45 +0200 )edit

Too bad, I didn't look at the commit :( Anyway, I fully support your request!

Damien Caliste ( 2017-12-12 12:20:00 +0200 )edit
2

Thanks! Your case is suggesting that somewhere in SFOS there is a switch which notifies/sets Qt network module regarding connectivity. You may get your bug fixed through that (if it exists)

rinigus ( 2017-12-12 12:56:17 +0200 )edit