Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-114666

NetworkManager Bearer plugin assumes no internet, does not update ActiveConnections from dbus

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 5.15
    • None
    • Linux/X11

    Description

      Linux NetworkManager Bearer plugin fails to update ActiveConnections from NetworkManager via dbus. Once the active connection list was loaded, it is used regardless of the actual data exposed via dbus.

      When network reconfiguration happens, bearer plugin removes NM_ACTIVE_CONNECTION_STATE_ACTIVATED state from the connection and fails to reload the connection list and set this state on any other connections, making the application to act like the network is not available.

      How to reproduce:

      1. Using NetworkManager, configure the network connection and OpenVPN VPN connection
      2. Configure network interface (ethernet/wifi) with "Automatically connect to VPN" via OpenVPN connection
      3. Connect to the network interface, the VPN should be connected automatically
      4. Start Qt5 application, tested on crow-translate
      5. Select any word, press CTRL+ALT+E to translate it with crow-translate. You should see the translation.
      6. Disconnect from the network interface. VPN should be disconnected automatically.
      7. Wait 5-7 seconds (this is important), connect to the network interface + VPN again.
      8. Press CTRL+ALT+E again. No translation is shown, QNetworkReply::NetworkSessionFailedError "The specified configuration cannot be used." is received.

      Is is important to start the application only after you have been connected to the network. If you started the application offline, and only then connected to the network, there's no issue (bearer plugin won't be able to enumerate any active connection upon starting the app, and would not interfere with the connections).

      Simpliest workaround: start the affected applications without the network, connect to the network later.

      Simple code workaround:

       

      --- qnetworkmanagerengine.cpp   2023-06-18 22:21:54.226936853 +0300
      
      +++ qnetworkmanagerengine.cpp   2023-06-18 22:22:09.410622118 +0300
      
      @@ -126,25 +126,25 @@
      
       void QNetworkManagerEngine::setupConfigurations()
      
       {
      
           QMutexLocker locker(&mutex);
      
           // Get active connections.
      
           const auto acPaths = managerInterface->activeConnections();
      
           for (const QDBusObjectPath &acPath : acPaths) {
      
        
               if (activeConnectionsList.contains(acPath.path()))
      
                   continue;
      
        
               QNetworkManagerConnectionActive *activeConnection =
      
                       new QNetworkManagerConnectionActive(acPath.path(),this);
      
      -        activeConnectionsList.insert(acPath.path(), activeConnection);
      
      +        //activeConnectionsList.insert(acPath.path(), activeConnection);
      
               connect(activeConnection, SIGNAL(propertiesChanged(QMap<QString,QVariant>)),
      
                       this, SLOT(activeConnectionPropertiesChanged(QMap<QString,QVariant>)));
      
        
               QStringList devices = activeConnection->devices();
      
               if (!devices.isEmpty()) {
      
                   QNetworkManagerInterfaceDevice device(devices.at(0),this);
      
                   connectionInterfaces.insert(activeConnection->connection().path(),device.networkInterface());
      
               }
      
           }
      
        
           // Get connections.
      
           const auto settingsPaths = systemSettings->listConnections();
       

       

      Affected applications:

      https://github.com/crow-translate/crow-translate/issues/383
      https://github.com/QuiteRSS/quiterss/issues/1517
      https://github.com/nextcloud/desktop/issues/4331

      Attachments

        1. 0001-QTBUG-114666-properties-changed-now-using-freedeskto.patch
          16 kB
          Karsten Sperling Opdal
        2. QTBUG-114666_1.zip
          1.0 kB
          ValdikSS -
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            manordheim Mårten Nordheim
            valdikss ValdikSS -
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes