1. 26 Sep, 2019 4 commits
  2. 25 Sep, 2019 16 commits
    • Thomas Haller's avatar
      supplicant: fix rework condition in nm_supplicant_config_add_bgscan() · a4b7b053
      Thomas Haller authored
      Ups, sorry.
      
      Fixes: 6fc37cb7 ('supplicant: rework condition in nm_supplicant_config_add_bgscan()')
      a4b7b053
    • Thomas Haller's avatar
      supplicant: rework condition in nm_supplicant_config_add_bgscan() · 6fc37cb7
      Thomas Haller authored
      Avoid the duplicate condition.
      
      Also, fix indentation/whitespace.
      
      No change in behavior.
      6fc37cb7
    • Lubomir Rintel's avatar
    • Kristian Klausen's avatar
      wifi: roam aggressively if we on a multi-AP network · 0f320333
      Kristian Klausen authored
      A multi-AP network isn't always WPA Enterprise or Dynamic WEP.
      I have seen multi-AP WPA-PSK networks, so lets try to detect them
      and use a shorter bgscan interval. We can detect them by checking
      if seen-bssids > 1.
      
      !279
      #248
      0f320333
    • Thomas Haller's avatar
      18f890d4
    • Thomas Haller's avatar
      gitlab-ci: add building on Fedora 31 · b40a3aa7
      Thomas Haller authored
      And don't build Fedora 28 by default. It's aleady end of life.
      But for now keep it, so it can be triggered manually.
      b40a3aa7
    • Thomas Haller's avatar
      build/meson: use python3 interpreter for "generate-setting-docs.py" · 7c7ad978
      Thomas Haller authored
      Fedora 32 drops "python" from the path. Hence "/usr/bin/env python" won't
      work anymore. Of course, who needs a way to invoke the interpreter that works
      accross different distributions! WTF.
      
      In this case, easy to work around. We run it from meson, so we have access to
      the Python 3 binary. Just call python explicitly, like we do with autotools.
      7c7ad978
    • Thomas Haller's avatar
      contrib/rpm: drop BuildRequires to deprecated "wireless-tools-devel" · 9fc44905
      Thomas Haller authored
      "wireless-tools-devel" is long depreacted and not used by
      NetworkManager, not even for WEXT.
      
      Drop it from the build dependencies.
      9fc44905
    • Thomas Haller's avatar
    • Thomas Haller's avatar
      tests: don't install unnecessary package in gitlab-ci tests · 1a2a5b37
      Thomas Haller authored
      REQUIRED_PACKAGES has two uses:
      
       - to setup a system for developing NetworkManager. This installs
         convenience packages like "cscope".
      
       - to install the packages required for unit testing in gitlab-ci.
      
      For gitlab-ci we should only install the packages that we actually
      need.
      1a2a5b37
    • Thomas Haller's avatar
      tests: fix failure installing non-existing packages in REQUIRED_PACKAGES · 18556755
      Thomas Haller authored
      Previously, dnf/yum used to ignore packages that didn't exist.
      In Fedora 32, dnf starts to fail the entire command:
      
        No match for argument: python-gobject-base
        Error: Unable to find a match: python-gobject-base
      
      Since this script is supposed to work with different RHEL/Fedora
      versions, it's expected that not all packages are available everywhere.
      
      Fix that, by installing packages that we know that they might be missing
      one by one (and ignore the error).
      18556755
    • Thomas Haller's avatar
      tests: fix "clients/tests/test-client.py" concatenating binary for Python 3 · 97646d81
      Thomas Haller authored
      Python 3 doesn't like this:
      
          ======================================================================
          ERROR: test_001 (__main__.TestNmcli)
          ----------------------------------------------------------------------
          Traceback (most recent call last):
            File "./clients/tests/test-client.py", line 785, in f
              self._nm_test_post()
            File "./clients/tests/test-client.py", line 767, in _nm_test_post
              content_new = ''.join([r['content'] for r in results])
          TypeError: sequence item 0: expected str instance, bytes found
      97646d81
    • Thomas Haller's avatar
      tests: don't compare string literal with "is" in "clients/tests/test-client.py" · 989b26a8
      Thomas Haller authored
      Recent Python versions warn about this:
      
        ./clients/tests/test-client.py:569: SyntaxWarning: "is" with a literal. Did you mean "=="?
          elif lang is de:
        ./clients/tests/test-client.py:572: SyntaxWarning: "is" with a literal. Did you mean "=="?
          elif lang is pl:
      
      And rightly so: https://bugs.python.org/issue34850
      989b26a8
    • Thomas Haller's avatar
      tests: avoid deprecated GLib.IOChannel.add_watch() in "test-networkmanager-service.py" · ceae05cc
      Thomas Haller authored
      test_001 (__main__.TestNmcli) ... /tmp/NetworkManager/tools/test-networkmanager-service.py:2346: PyGIDeprecationWarning: add_watch is deprecated; use GLib.io_add_watch() instead
        id1 = GLib.IOChannel(0).add_watch(GLib.IOCondition.HUP,
      ceae05cc
    • Thomas Haller's avatar
      systemd: merge branch systemd into master · 85bdf421
      Thomas Haller authored
      85bdf421
    • Thomas Haller's avatar
      systemd: update code from upstream (2019-09-24) · 503b5f44
      Thomas Haller authored
      This is a direct dump from systemd git.
      
      ======
      
      SYSTEMD_DIR=../systemd
      COMMIT=a007d6fc2a2b9c19bafd6465fb4f00910b824c36
      
      (
        cd "$SYSTEMD_DIR"
        git checkout "$COMMIT"
        git reset --hard
        git clean -fdx
      )
      
      git ls-files -z :/src/systemd/src/ \
                      :/shared/systemd/src/ \
                      :/shared/nm-utils/unaligned.h | \
        xargs -0 rm -f
      
      nm_copy_sd_shared() {
          mkdir -p "./shared/systemd/$(dirname "$1")"
          cp "$SYSTEMD_DIR/$1" "./shared/systemd/$1"
      }
      
      nm_copy_sd_core() {
          mkdir -p "./src/systemd/$(dirname "$1")"
          cp "$SYSTEMD_DIR/$1" "./src/systemd/$1"
      }
      
      nm_copy_sd_nmutils() {
          mkdir -p "./shared/nm-utils/"
          cp "$SYSTEMD_DIR/$1" "./shared/nm-utils/${1##*/}"
      }
      
      nm_copy_sd_core "src/libsystemd-network/arp-util.c"
      nm_copy_sd_core "src/libsystemd-network/arp-util.h"
      nm_copy_sd_core "src/libsystemd-network/dhcp-identifier.c"
      nm_copy_sd_core "src/libsystemd-network/dhcp-identifier.h"
      nm_copy_sd_core "src/libsystemd-network/dhcp-internal.h"
      nm_copy_sd_core "src/libsystemd-network/dhcp-lease-internal.h"
      nm_copy_sd_core "src/libsystemd-network/dhcp-network.c"
      nm_copy_sd_core "src/libsystemd-network/dhcp-option.c"
      nm_copy_sd_core "src/libsystemd-network/dhcp-packet.c"
      nm_copy_sd_core "src/libsystemd-network/dhcp-protocol.h"
      nm_copy_sd_core "src/libsystemd-network/dhcp6-internal.h"
      nm_copy_sd_core "src/libsystemd-network/dhcp6-lease-internal.h"
      nm_copy_sd_core "src/libsystemd-network/dhcp6-network.c"
      nm_copy_sd_core "src/libsystemd-network/dhcp6-option.c"
      nm_copy_sd_core "src/libsystemd-network/dhcp6-protocol.h"
      nm_copy_sd_core "src/libsystemd-network/lldp-internal.h"
      nm_copy_sd_core "src/libsystemd-network/lldp-neighbor.c"
      nm_copy_sd_core "src/libsystemd-network/lldp-neighbor.h"
      nm_copy_sd_core "src/libsystemd-network/lldp-network.c"
      nm_copy_sd_core "src/libsystemd-network/lldp-network.h"
      nm_copy_sd_core "src/libsystemd-network/network-internal.c"
      nm_copy_sd_core "src/libsystemd-network/network-internal.h"
      nm_copy_sd_core "src/libsystemd-network/sd-dhcp-client.c"
      nm_copy_sd_core "src/libsystemd-network/sd-dhcp-lease.c"
      nm_copy_sd_core "src/libsystemd-network/sd-dhcp6-client.c"
      nm_copy_sd_core "src/libsystemd-network/sd-dhcp6-lease.c"
      nm_copy_sd_core "src/libsystemd-network/sd-ipv4acd.c"
      nm_copy_sd_core "src/libsystemd-network/sd-ipv4ll.c"
      nm_copy_sd_core "src/libsystemd-network/sd-lldp.c"
      nm_copy_sd_core "src/libsystemd/sd-event/event-source.h"
      nm_copy_sd_core "src/libsystemd/sd-event/event-util.c"
      nm_copy_sd_core "src/libsystemd/sd-event/event-util.h"
      nm_copy_sd_core "src/libsystemd/sd-event/sd-event.c"
      nm_copy_sd_core "src/libsystemd/sd-id128/id128-util.c"
      nm_copy_sd_core "src/libsystemd/sd-id128/id128-util.h"
      nm_copy_sd_core "src/libsystemd/sd-id128/sd-id128.c"
      nm_copy_sd_core "src/systemd/_sd-common.h"
      nm_copy_sd_core "src/systemd/sd-dhcp-client.h"
      nm_copy_sd_core "src/systemd/sd-dhcp-lease.h"
      nm_copy_sd_core "src/systemd/sd-dhcp6-client.h"
      nm_copy_sd_core "src/systemd/sd-dhcp6-lease.h"
      nm_copy_sd_core "src/systemd/sd-event.h"
      nm_copy_sd_core "src/systemd/sd-id128.h"
      nm_copy_sd_core "src/systemd/sd-ipv4acd.h"
      nm_copy_sd_core "src/systemd/sd-ipv4ll.h"
      nm_copy_sd_core "src/systemd/sd-lldp.h"
      nm_copy_sd_core "src/systemd/sd-ndisc.h"
      nm_copy_sd_nmutils "src/basic/unaligned.h"
      nm_copy_sd_shared "src/basic/alloc-util.c"
      nm_copy_sd_shared "src/basic/alloc-util.h"
      nm_copy_sd_shared "src/basic/async.h"
      nm_copy_sd_shared "src/basic/env-file.c"
      nm_copy_sd_shared "src/basic/env-file.h"
      nm_copy_sd_shared "src/basic/env-util.c"
      nm_copy_sd_shared "src/basic/env-util.h"
      nm_copy_sd_shared "src/basic/errno-util.h"
      nm_copy_sd_shared "src/basic/escape.c"
      nm_copy_sd_shared "src/basic/escape.h"
      nm_copy_sd_shared "src/basic/ether-addr-util.c"
      nm_copy_sd_shared "src/basic/ether-addr-util.h"
      nm_copy_sd_shared "src/basic/extract-word.c"
      nm_copy_sd_shared "src/basic/extract-word.h"
      nm_copy_sd_shared "src/basic/fd-util.c"
      nm_copy_sd_shared "src/basic/fd-util.h"
      nm_copy_sd_shared "src/basic/fileio.c"
      nm_copy_sd_shared "src/basic/fileio.h"
      nm_copy_sd_shared "src/basic/format-util.c"
      nm_copy_sd_shared "src/basic/format-util.h"
      nm_copy_sd_shared "src/basic/fs-util.c"
      nm_copy_sd_shared "src/basic/fs-util.h"
      nm_copy_sd_shared "src/basic/hash-funcs.c"
      nm_copy_sd_shared "src/basic/hash-funcs.h"
      nm_copy_sd_shared "src/basic/hashmap.c"
      nm_copy_sd_shared "src/basic/hashmap.h"
      nm_copy_sd_shared "src/basic/hexdecoct.c"
      nm_copy_sd_shared "src/basic/hexdecoct.h"
      nm_copy_sd_shared "src/basic/hostname-util.c"
      nm_copy_sd_shared "src/basic/hostname-util.h"
      nm_copy_sd_shared "src/basic/in-addr-util.c"
      nm_copy_sd_shared "src/basic/in-addr-util.h"
      nm_copy_sd_shared "src/basic/io-util.c"
      nm_copy_sd_shared "src/basic/io-util.h"
      nm_copy_sd_shared "src/basic/list.h"
      nm_copy_sd_shared "src/basic/log.h"
      nm_copy_sd_shared "src/basic/macro.h"
      nm_copy_sd_shared "src/basic/memory-util.c"
      nm_copy_sd_shared "src/basic/memory-util.h"
      nm_copy_sd_shared "src/basic/mempool.c"
      nm_copy_sd_shared "src/basic/mempool.h"
      nm_copy_sd_shared "src/basic/missing_fcntl.h"
      nm_copy_sd_shared "src/basic/missing_socket.h"
      nm_copy_sd_shared "src/basic/missing_stat.h"
      nm_copy_sd_shared "src/basic/missing_type.h"
      nm_copy_sd_shared "src/basic/parse-util.c"
      nm_copy_sd_shared "src/basic/parse-util.h"
      nm_copy_sd_shared "src/basic/path-util.c"
      nm_copy_sd_shared "src/basic/path-util.h"
      nm_copy_sd_shared "src/basic/prioq.c"
      nm_copy_sd_shared "src/basic/prioq.h"
      nm_copy_sd_shared "src/basic/process-util.c"
      nm_copy_sd_shared "src/basic/process-util.h"
      nm_copy_sd_shared "src/basic/random-util.c"
      nm_copy_sd_shared "src/basic/random-util.h"
      nm_copy_sd_shared "src/basic/set.h"
      nm_copy_sd_shared "src/basic/signal-util.h"
      nm_copy_sd_shared "src/basic/siphash24.h"
      nm_copy_sd_shared "src/basic/socket-util.c"
      nm_copy_sd_shared "src/basic/socket-util.h"
      nm_copy_sd_shared "src/basic/sort-util.h"
      nm_copy_sd_shared "src/basic/sparse-endian.h"
      nm_copy_sd_shared "src/basic/stat-util.c"
      nm_copy_sd_shared "src/basic/stat-util.h"
      nm_copy_sd_shared "src/basic/stdio-util.h"
      nm_copy_sd_shared "src/basic/string-table.c"
      nm_copy_sd_shared "src/basic/string-table.h"
      nm_copy_sd_shared "src/basic/string-util.c"
      nm_copy_sd_shared "src/basic/string-util.h"
      nm_copy_sd_shared "src/basic/strv.c"
      nm_copy_sd_shared "src/basic/strv.h"
      nm_copy_sd_shared "src/basic/strxcpyx.c"
      nm_copy_sd_shared "src/basic/strxcpyx.h"
      nm_copy_sd_shared "src/basic/time-util.c"
      nm_copy_sd_shared "src/basic/time-util.h"
      nm_copy_sd_shared "src/basic/tmpfile-util.c"
      nm_copy_sd_shared "src/basic/tmpfile-util.h"
      nm_copy_sd_shared "src/basic/umask-util.h"
      nm_copy_sd_shared "src/basic/utf8.c"
      nm_copy_sd_shared "src/basic/utf8.h"
      nm_copy_sd_shared "src/basic/util.c"
      nm_copy_sd_shared "src/basic/util.h"
      nm_copy_sd_shared "src/shared/dns-domain.c"
      nm_copy_sd_shared "src/shared/dns-domain.h"
      503b5f44
  3. 24 Sep, 2019 2 commits
    • Beniamino Galvani's avatar
      settings: fix updating agent-owned VPN secrets · 43b7e669
      Beniamino Galvani authored
      property_to_dbus() returns NULL when called with
      NM_CONNECTION_SERIALIZE_WITH_SECRETS_AGENT_OWNED and the property is
      not an agent-owned secrets. The function doesn't handle VPN secrets
      correctly, since they are all stored as a hash in the vpn.secrets
      property and the flag for each of them is a matching '*-flags' key in
      the vpn.data property. VPN secrets must be handled differently; do it
      in the VPN setting to_dbus_fcn() function.
      
      Fixes: 71928a3e ('settings: avoid cloning the connection to maintain agent-owned secrets')
      
      #230
      !280
      43b7e669
    • Beniamino Galvani's avatar
      build: avoid target redefinition · a79572c2
      Beniamino Galvani authored
       Makefile.am:3462: warning: $(src_devices_bluetooth_libnm_device_plugin_bluetooth_la_OBJECTS) was already defined in condition TRUE, which includes condition WITH_MODEM_MANAGER_1 ...
       Makefile.am:960: ... '$(src_devices_bluetooth_libnm_device_plugin_bluetooth_la_OBJECTS)' previously defined here
      
      Fixes: 878d4963 ('bluetooth/tests: add "nm-bt-test helper" program for manual testing of bluetooth code')
      a79572c2
  4. 23 Sep, 2019 10 commits
    • Thomas Haller's avatar
      dhcp/nettools: round time difference when calculating the lease lifetime · 87680c41
      Thomas Haller authored
      nettools does not expose the original lease lifetime. It's a missing
      API. Instead, it only exposes the timestamp when the lease will expire.
      
      As a workaround, we calulate the timestamp by subtracting the current
      timestamp from the expiration timestamp, assuming that the lease was
      received just now. However, it was not received *exactly* now, but a
      few milliseconds before. Hence, the calculated timestamp is not exact
      here and likely a few milliseconds less then the actual (full integer)
      value.
      
      Account for that by rounding the value to the second.
      87680c41
    • Thomas Haller's avatar
      shared/trivial: rename _nm_g_slice_free_fcn1() macro to nm_g_slice_free_fcn1() · 32148417
      Thomas Haller authored
      The leading underscore has the notion that this would be a private function.
      It really isn't, and it would be fine for the user to call it directly.
      
      Just like we have g_slice_free() and g_slice_free1().
      32148417
    • Thomas Haller's avatar
      contrib/rpm: "Suggest" wpa_supplicant for NetworkManager-wifi package · 4b1cb404
      Thomas Haller authored
      "NetworkManager-wifi" package requires either wpa_supplicant or iwd.
      When installing the package without explicitly installing supplicant
      or iwd (and not having it installed yet), then we want to drag in
      wpa_supplicant by default. That is accomplished by suggesting wpa_supplicant
      package.
      
      Otherwise, the user installing NetworkManager-wifi might get iwd,
      which is only functioning if the user explicitly enables the backend
      in "NetworkManager.conf".
      
      https://bugzilla.redhat.com/show_bug.cgi?id=1743585
      4b1cb404
    • Thomas Haller's avatar
      wifi/p2p: fix crash due to invalid signal handler supplicant_group_iface_group_finished_cb() · 9aa6c676
      Thomas Haller authored
      Fixes: 00e64d13 ('core/devices: Add P2P Wifi device and peer tracking')
      
      #249
      
      !284
      9aa6c676
    • Thomas Haller's avatar
    • Thomas Haller's avatar
      settings: drop redundant check from have_connection_for_device() · 2a506d8a
      Thomas Haller authored
      have_connection_for_device() really should just call nm_device_check_connection_compatible().
      Note that nm_device_check_connection_compatible() of course checks the
      connection type already, so this is redundant.
      2a506d8a
    • Thomas Haller's avatar
      settings: shortcut check for whether to create auto-default wired connection · 3e39d2a5
      Thomas Haller authored
      This check is only useful for devices that implement new_default_connection.
      We can shortcut the possibly expensive checks like have_connection_for_device(),
      which need to iterate all profiles.
      3e39d2a5
    • Thomas Haller's avatar
      core: fix wrongly generating "Wired connection 1" (auto-default) for ethernet with MAC · 5aa50d7c
      Thomas Haller authored
      If a profile has only "ethernet.mac-address" set, but
      "connection.interface-name" not, then the previous check
      
          iface = nm_setting_connection_get_interface_name (s_con);
          if (!nm_streq0 (iface, nm_device_get_iface (device)))
               continue;
      
      would wrongly consider the profile not matching for the device.
      As a result, we would wrongly create a auto-default connection.
      
      Fix that. We already call nm_device_check_connection_compatible()
      above. That is fully suitable to compare the interface name and
      the MAC address. We don't need to duplicate this check (wrongly).
      
      See also commit 77d01c90 ('settings: ignore incompatible connections
      when looking for existing ones') for how this code changed.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=1727909
      5aa50d7c
    • Thomas Haller's avatar
      bluez: merge branch 'th/bluez-rework-2' · e79f1b62
      Thomas Haller authored
      !251
      e79f1b62
    • 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
  5. 22 Sep, 2019 8 commits
    • Thomas Haller's avatar
      bluetooth/tests: add "nm-bt-test helper" program for manual testing of bluetooth code · 878d4963
      Thomas Haller authored
      Just add a stub implementation and let it build. More will be added
      later.
      878d4963
    • Thomas Haller's avatar
    • Thomas Haller's avatar
      wwan: simplify API of nm_modem_act_stage2_config() to never fail · d6df0339
      Thomas Haller authored
      The previous function arguments of nm_modem_act_stage2_config() act as if the
      function could fail or even postpone the action. It never did.
      
      We cannot treat this generic. A caller needs to know whether nm_modem_act_stage2_config()
      can postpone the action, and when it does, which signal is emitted upon completion. That
      is, the caller needs to know how to proceed after postponing.
      
      In other words, since this function currently cannot fail or postpone
      the stage, so must all callers already rely on that. At this point it makes
      no sense to pretend that the function could be any different, if all callers
      assume it is not. Simplify the API.
      d6df0339
    • Thomas Haller's avatar
      wwan: add nm_modem_manager_get_modems() to iterate over modems · f796be3d
      Thomas Haller authored
      Currently, we cannot ask which modems exist. NMDeviceBt may claim it
      via nm_device_factory_emit_component_added(), and NMWWanFactory may
      take it by listening to NM_MODEM_MANAGER_MODEM_ADDED. But that's it.
      
      We will drop nm_device_factory_emit_component_added() because it's only
      used for passing modems to NMDeviceBt. Instead, NMDeviceBt can directly
      subscribe to NM_MODEM_MANAGER_MODEM_ADDED. It already has a reference
      to NMModemManager.
      
      Anyway, the NM_MODEM_MANAGER_MODEM_ADDED signal is no enough, because
      sometimes when the mode appears, NMDeviceBt might not yet know whether
      it should take it (because the DUN connect call is not yet complete).
      Currently that never happens because dun_connect() blocks waiting for
      the device. That must be fixed, by not waiting. But this opens up a
      race, and NMDeviceBt might after NM_MODEM_MANAGER_MODEM_ADDED need to
      search for the suitable modem: by iterating the list of all modems.
      f796be3d
    • Thomas Haller's avatar
      wwan: mark modems that are taken by a NMDevice as "claimed" · 6d644c66
      Thomas Haller authored
      NMModem-s are either used by NMDeviceModem or by NMDeviceBt.
      The mechanism how that is coordinated it odd:
      
        - the factory emits component-added, and then NMDeviceBt
          might take the device (and claim it). In that case, component-added
          would return TRUE to indicate that the modem should not be also
          used by NMDeviceModem.
      
        - next, if the modem has a driver that looks like bluetooth, NMDeviceModem
          ignores it too.
      
        - finally, NMDeviceModem claims the modem (which is now considered to
          be non-bluetooth).
      
      I think the first problem is that the device factory tries to have this
      generic mechanism of "component-added". It's literally only used to
      cover this special case. Note that NMDeviceBt is aware of modems. So,
      abstracting this just adds lots of code that could be solved better
      by handling the case (of giving the modem to either NMDeviceBt or
      NMDeviceModem) specifically.
      
      NMWWanFactory itself registers to the NM_MODEM_MANAGER_MODEM_ADDED
      signal and emits nm_device_factory_emit_component_added().
      We could just have NMWWanFactory and NMDeviceBt both register to
      that signal. Signals even support priorities, so we could have
      NMDeviceBt be called first to claim the device.
      
      Anyway, as the modem can only have one owner, the modem should have
      a flag that indicates whether it's claimed or not. That will allow
      multiple components all look at the same modem and moderate who is
      going to take ownership.
      6d644c66
    • Thomas Haller's avatar
      core: extend nm_shutdown_wait_obj_*() to support notification via a GCancellable · eae69e33
      Thomas Haller authored
      Now nm_shutdown_wait_obj_*() supports two styles:
      
       - NM_SHUTDOWN_WAIT_TYPE_OBJECT: this just registers a weak pointer
         on a source GObject. As long as the object is not destroyed
         (and the object is not unregistered), the shutdown gets blocked.
      
       - now new is NM_SHUTDOWN_WAIT_TYPE_CANCELLABLE: this source object
         is a GCancellable, and during shutdown, the system will cancel
         the instances to notify about the shutdown. That aside, the GCancellable
         is tracked exactly like a regular NM_SHUTDOWN_WAIT_TYPE_OBJECT (meaning:
         a weak pointer is registered and shutdown gets delayed as long as the instance
         lives).
      
      As the rest of the shutdown, it's not yet implemented on the shutdown-side.
      What is now possible is to register such cancellables, so that users can make
      use of this API before we fix shutdown. We cannot fix it all at the same time,
      so first users must be ready for this approach.
      eae69e33
    • Thomas Haller's avatar
      core: add and use NM_MANAGER_GET macro · 5131cc42
      Thomas Haller authored
      For our singleton getters we usually have such a macro. See NM_PLATFORM_GET
      and NM_SETTINGS_GET.
      
      Add such a macro for NMManager and use it.
      5131cc42
    • Thomas Haller's avatar