• Thomas Haller's avatar
    bluetooth: refactor BlueZ handling and let NMBluezManager cache ObjectManager data · 4154d961
    Thomas Haller authored
    This is a complete refactoring of the bluetooth code.
    
    Now that BlueZ 4 support was dropped, the separation of NMBluezManager
    and NMBluez5Manager makes no sense. They should be merged.
    
    At that point, notice that BlueZ 5's D-Bus API is fully centered around
    D-Bus's ObjectManager interface. Using that interface, we basically only
    call GetManagedObjects() once and register to InterfacesAdded,
    InterfacesRemoved and PropertiesChanged signals. There is no need to
    fetch individual properties ever.
    
    Note how NMBluezDevice used to query the D-Bus properties itself by
    creating a GDBusProxy. This is redundant, because when using the ObjectManager
    interfaces, we have all information already.
    
    Instead, let NMBluezManager basically become the client-side cache of
    all of BlueZ's ObjectManager interface. NMBluezDevice was mostly concerned
    about caching the D-Bus interface's state, tracking suitable profiles
    (pan_connection), and moderate between bluez and NMDeviceBt.
    These tasks don't get simpler by moving them to a seprate file. Let them
    also be handled by NMBluezManager.
    
    I mean, just look how it was previously: NMBluez5Manager registers to
    ObjectManager interface and sees a device appearing. It creates a
    NMBluezDevice object and registers to its "initialized" and
    "notify:usable" signal. In the meantime, NMBluezDevice fetches the
    relevant information from D-Bus (although it was already present in the
    data provided by the ObjectManager) and eventually emits these usable
    and initialized signals.
    Then, NMBlue5Manager emits a "bdaddr-added" signal, for which NMBluezManager
    creates the NMDeviceBt instance. NMBluezManager, NMBluez5Manager and
    NMBluezDevice are strongly cooperating to the point that it is simpler
    to merge them.
    
    This is not mere refactoring. This patch aims to make everything
    asynchronously and always cancellable. Also, it aims to fix races
    and inconsistencies of the state.
    
    - Registering to a NAP server now waits for the response and delays
      activation of the NMDeviceBridge accordingly.
    
    - For NAP connections we now watch the bnep0 interface in platform, and tear
      down the device when it goes away. Bluez doesn't send us a notification
      on D-Bus in that case.
    
    - Rework establishing a DUN connection. It no longer uses blocking
      connect() and does not block until rfcomm device appears. It's
      all async now. It also watches the rfcomm file descriptor for
      POLLERR/POLLHUP to notice disconnect.
    
    - drop nm_device_factory_emit_component_added() and instead let
      NMDeviceBt directly register to the WWan factory's "added" signal.
    4154d961
Name
Last commit
Last update
..
tests Loading commit data...
meson.build Loading commit data...
nm-connection-private.h Loading commit data...
nm-connection.c Loading commit data...
nm-connection.h Loading commit data...
nm-core-enum-types.c.template Loading commit data...
nm-core-enum-types.h.template Loading commit data...
nm-core-internal.h Loading commit data...
nm-core-types-internal.h Loading commit data...
nm-core-types.h Loading commit data...
nm-crypto-gnutls.c Loading commit data...
nm-crypto-impl.h Loading commit data...
nm-crypto-nss.c Loading commit data...
nm-crypto.c Loading commit data...
nm-crypto.h Loading commit data...
nm-dbus-interface.h Loading commit data...
nm-dbus-utils.c Loading commit data...
nm-errors.c Loading commit data...
nm-errors.h Loading commit data...
nm-json.c Loading commit data...
nm-json.h Loading commit data...
nm-keyfile-internal.h Loading commit data...
nm-keyfile-utils.c Loading commit data...
nm-keyfile-utils.h Loading commit data...
nm-keyfile.c Loading commit data...
nm-property-compare.c Loading commit data...
nm-property-compare.h Loading commit data...
nm-setting-6lowpan.c Loading commit data...
nm-setting-6lowpan.h Loading commit data...
nm-setting-8021x.c Loading commit data...
nm-setting-8021x.h Loading commit data...
nm-setting-adsl.c Loading commit data...
nm-setting-adsl.h Loading commit data...
nm-setting-bluetooth.c Loading commit data...
nm-setting-bluetooth.h Loading commit data...
nm-setting-bond.c Loading commit data...
nm-setting-bond.h Loading commit data...
nm-setting-bridge-port.c Loading commit data...
nm-setting-bridge-port.h Loading commit data...
nm-setting-bridge.c Loading commit data...
nm-setting-bridge.h Loading commit data...
nm-setting-cdma.c Loading commit data...
nm-setting-cdma.h Loading commit data...
nm-setting-connection.c Loading commit data...
nm-setting-connection.h Loading commit data...
nm-setting-dcb.c Loading commit data...
nm-setting-dcb.h Loading commit data...
nm-setting-dummy.c Loading commit data...
nm-setting-dummy.h Loading commit data...
nm-setting-ethtool.c Loading commit data...
nm-setting-ethtool.h Loading commit data...
nm-setting-generic.c Loading commit data...
nm-setting-generic.h Loading commit data...
nm-setting-gsm.c Loading commit data...
nm-setting-gsm.h Loading commit data...
nm-setting-infiniband.c Loading commit data...
nm-setting-infiniband.h Loading commit data...
nm-setting-ip-config.c Loading commit data...
nm-setting-ip-config.h Loading commit data...
nm-setting-ip-tunnel.c Loading commit data...
nm-setting-ip-tunnel.h Loading commit data...
nm-setting-ip4-config.c Loading commit data...
nm-setting-ip4-config.h Loading commit data...
nm-setting-ip6-config.c Loading commit data...
nm-setting-ip6-config.h Loading commit data...
nm-setting-macsec.c Loading commit data...
nm-setting-macsec.h Loading commit data...
nm-setting-macvlan.c Loading commit data...
nm-setting-macvlan.h Loading commit data...
nm-setting-match.c Loading commit data...
nm-setting-match.h Loading commit data...
nm-setting-olpc-mesh.c Loading commit data...
nm-setting-olpc-mesh.h Loading commit data...
nm-setting-ovs-bridge.c Loading commit data...
nm-setting-ovs-bridge.h Loading commit data...
nm-setting-ovs-dpdk.c Loading commit data...
nm-setting-ovs-dpdk.h Loading commit data...
nm-setting-ovs-interface.c Loading commit data...
nm-setting-ovs-interface.h Loading commit data...
nm-setting-ovs-patch.c Loading commit data...
nm-setting-ovs-patch.h Loading commit data...
nm-setting-ovs-port.c Loading commit data...
nm-setting-ovs-port.h Loading commit data...
nm-setting-ppp.c Loading commit data...
nm-setting-ppp.h Loading commit data...
nm-setting-pppoe.c Loading commit data...
nm-setting-pppoe.h Loading commit data...
nm-setting-private.h Loading commit data...
nm-setting-proxy.c Loading commit data...
nm-setting-proxy.h Loading commit data...
nm-setting-serial.c Loading commit data...
nm-setting-serial.h Loading commit data...
nm-setting-sriov.c Loading commit data...
nm-setting-sriov.h Loading commit data...
nm-setting-tc-config.c Loading commit data...
nm-setting-tc-config.h Loading commit data...
nm-setting-team-port.c Loading commit data...
nm-setting-team-port.h Loading commit data...
nm-setting-team.c Loading commit data...
nm-setting-team.h Loading commit data...
nm-setting-tun.c Loading commit data...
nm-setting-tun.h Loading commit data...
nm-setting-user.c Loading commit data...
nm-setting-user.h Loading commit data...
nm-setting-vlan.c Loading commit data...
nm-setting-vlan.h Loading commit data...
nm-setting-vpn.c Loading commit data...
nm-setting-vpn.h Loading commit data...
nm-setting-vxlan.c Loading commit data...
nm-setting-vxlan.h Loading commit data...
nm-setting-wifi-p2p.c Loading commit data...
nm-setting-wifi-p2p.h Loading commit data...
nm-setting-wimax.c Loading commit data...
nm-setting-wimax.h Loading commit data...
nm-setting-wired.c Loading commit data...
nm-setting-wired.h Loading commit data...
nm-setting-wireguard.c Loading commit data...
nm-setting-wireguard.h Loading commit data...
nm-setting-wireless-security.c Loading commit data...
nm-setting-wireless-security.h Loading commit data...
nm-setting-wireless.c Loading commit data...
nm-setting-wireless.h Loading commit data...
nm-setting-wpan.c Loading commit data...
nm-setting-wpan.h Loading commit data...
nm-setting.c Loading commit data...
nm-setting.h Loading commit data...
nm-simple-connection.c Loading commit data...
nm-simple-connection.h Loading commit data...
nm-team-utils.c Loading commit data...
nm-team-utils.h Loading commit data...
nm-utils-private.h Loading commit data...
nm-utils.c Loading commit data...
nm-utils.h Loading commit data...
nm-version.h Loading commit data...
nm-vpn-dbus-interface.h Loading commit data...
nm-vpn-editor-plugin.c Loading commit data...
nm-vpn-editor-plugin.h Loading commit data...
nm-vpn-plugin-info.c Loading commit data...
nm-vpn-plugin-info.h Loading commit data...