1. 11 Apr, 2016 1 commit
  2. 15 Mar, 2016 1 commit
  3. 03 Mar, 2016 1 commit
    • Thomas Haller's avatar
      all: clean-up usage of GError · 01b9b410
      Thomas Haller authored
      Functions that take a GError** MUST fill it in on error. There is no
      need to check whether error is NULL if the function it was passed to
      had a failing return value.
      
      Likewise, a proper GError must have a non-NULL message, so there's no
      need to double-check that either.
      Based-on-patch-by: Dan Winship's avatarDan Winship <danw@gnome.org>
      01b9b410
  4. 19 Feb, 2016 1 commit
    • Thomas Haller's avatar
      all: cleanup includes and let "nm-default.h" include "config.h" · 8bace23b
      Thomas Haller authored
      - All internal source files (except "examples", which are not internal)
        should include "config.h" first. As also all internal source
        files should include "nm-default.h", let "config.h" be included
        by "nm-default.h" and include "nm-default.h" as first in every
        source file.
        We already wanted to include "nm-default.h" before other headers
        because it might contains some fixes (like "nm-glib.h" compatibility)
        that is required first.
      
      - After including "nm-default.h", we optinally allow for including the
        corresponding header file for the source file at hand. The idea
        is to ensure that each header file is self contained.
      
      - Don't include "config.h" or "nm-default.h" in any header file
        (except "nm-sd-adapt.h"). Public headers anyway must not include
        these headers, and internal headers are never included after
        "nm-default.h", as of the first previous point.
      
      - Include all internal headers with quotes instead of angle brackets.
        In practice it doesn't matter, because in our public headers we must
        include other headers with angle brackets. As we use our public
        headers also to compile our interal source files, effectively the
        result must be the same. Still do it for consistency.
      
      - Except for <config.h> itself. Include it with angle brackets as suggested by
        https://www.gnu.org/software/autoconf/manual/autoconf.html#Configuration-Headers
      8bace23b
  5. 28 Jan, 2016 1 commit
    • Dan Williams's avatar
      wwan: retry connect on some errors and save them for log messages · 1cf47277
      Dan Williams authored
      First, cb751012 mistakenly converted the
      act_stage_context_step() in connect_ready() to connect_context_clear()
      instead of connect_context_step().  This would cause the IP Type retry
      logic to fail and no further types to be tried.  It also throws
      away the ctx->first_error and causes all errors that MM returns on the
      connect attempt to be dropped on the floor.
      
      Second, not all errors should cause an advance to the next IP Type,
      since some errors aren't related to it.  Specifically, MM_CORE_ERROR_RETRY
      when using Simple.Connect() means that a timeout was reached
      in the internal connect logic, not a modem or network error.  In
      that case, try the connect again with the same IP Type before advancing
      to the next type.
      
      Fixes: cb751012Tested-by: Ladislav Michl's avatarLadislav Michl <ladis@linux-mips.org>
      Tested-by: Tore Anderson's avatarTore Anderson <tore@fud.no>
      1cf47277
  6. 18 Nov, 2015 2 commits
    • Dan Williams's avatar
      wwan: rework connection flow to send PIN earlier and fix autoconnect · cb751012
      Dan Williams authored
      Modems often don't expose all the required properties until they have
      been unlocked, and that includes the IP types supported by the modem.
      
      With an autoconnect WWAN connection where the SIM requires a PIN, there
      were two problems:
      
      1) the PIN is a secret and we don't have it until it's explicitly requested
      during the activation process, so we cannot gate GSM connection availability
      on whether a PIN is present since this happens long before we request secrets
      
      2) when the modem is locked it may not report the supported IP types, which
      caused an auto-activation to fail early becuase IP compatibility is checked
      before the PIN is sent to the modem
      
      Rework connection activation flow into a series of concrete steps, where the
      PIN is sent to the modem if required, and only after the modem is actually
      unlocked does the connection proceed.  This does mean that any connection
      marked 'autoconnect' can theoretically enable a PIN-locked modem even if
      the connection has no PIN defined, but there's no good way around that.
      NetworkManager would activate the connection
      cb751012
    • Dan Williams's avatar
      libnm/wwan: add GSM setting device-id, sim-id, and sim-operator-id properties · 4b412218
      Dan Williams authored
      These properties limit whether the connection applies to a certain WWAN modem
      based on the modem's device ID or SIM ID (as reported by the WWAN management
      service), or through the MCC/MNC ID of the operator that issued the SIM card.
      4b412218
  7. 02 Nov, 2015 1 commit
    • Thomas Haller's avatar
      platform: properly handle IPv4 peer-addresses · 6c8aa669
      Thomas Haller authored
      The peer-address (IFA_ADDRESS) can also be all-zero (0.0.0.0).
      That is distinct from an usual address without explicit peer-address,
      which implicitly has the same peer and local address.
      
      Previously, we treated an all-zero peer_address as having peer and
      local address equal. This is especially grave, because the peer is part
      of the primary key for an IPv4 address. So we not only get a property of
      the address wrong, but we wrongly consider two different addresses as
      one and the same.
      
      To properly handle these addresses, we always must explicitly set the peer.
      6c8aa669
  8. 25 Sep, 2015 1 commit
    • Jiří Klimeš's avatar
      modem-broadband: update modem's supported-ip-families (rh #1263959) · eecb4c46
      Jiří Klimeš authored
      If SIM in a modem is locked, ModemManager can't initialize SupportedIpFamilies
      and NetworkManager will set the property to 0. ModemManager then updates the
      property after the modem is unlocked, but NetworkManager did not watch changes
      to the property. And that resulted in a connection failure:
      (ttyUSB1): Failed to connect 'O2 Internet': Connection requested IPv4 but IPv4 is unsuported by the modem.
      (ttyUSB1): device state change: prepare -> failed (reason 'modem-init-failed') [40 120 28]
      
      https://bugzilla.redhat.com/show_bug.cgi?id=1263959
      eecb4c46
  9. 05 Aug, 2015 2 commits
  10. 21 Apr, 2015 1 commit
    • Thomas Haller's avatar
      platform: add self argument to platform functions · c6529a9d
      Thomas Haller authored
      Most nm_platform_*() functions operate on the platform
      singleton nm_platform_get(). That made sense because the
      NMPlatform instance was mainly to hook fake platform for
      testing.
      
      While the implicit argument saved some typing, I think explicit is
      better. Especially, because NMPlatform could become a more usable
      object then just a hook for testing.
      
      With this change, NMPlatform instances can be used individually, not
      only as a singleton instance.
      
      Before this change, the constructor of NMLinuxPlatform could not
      call any nm_platform_*() functions because the singleton was not
      yet initialized. We could only instantiate an incomplete instance,
      register it via nm_platform_setup(), and then complete initialization
      via singleton->setup().
      With this change, we can create and fully initialize NMPlatform instances
      before/without setting them up them as singleton.
      
      Also, currently there is no clear distinction between functions
      that operate on the NMPlatform instance, and functions that can
      be used stand-alone (e.g. nm_platform_ip4_address_to_string()).
      The latter can not be mocked for testing. With this change, the
      distinction becomes obvious. That is also useful because it becomes
      clearer which functions make use of the platform cache and which not.
      
      Inside nm-linux-platform.c, continue the pattern that the
      self instance is named @platform. That makes sense because
      its type is NMPlatform, and not NMLinuxPlatform what we
      would expect from a paramter named @self.
      
      This is a major diff that causes some pain when rebasing. Try
      to rebase to the parent commit of this commit as a first step.
      Then rebase on top of this commit using merge-strategy "ours".
      c6529a9d
  11. 02 Mar, 2015 1 commit
  12. 27 Feb, 2015 2 commits
  13. 24 Feb, 2015 2 commits
  14. 17 Feb, 2015 1 commit
    • Aleksander Morgado's avatar
      wwan: don't assume DNS info is always available · 5df024f5
      Aleksander Morgado authored
      Fixes segfault with e.g. Ericsson modems that reply just with IP+gateway,
      without DNS info.
      
       [mm-port-serial-at.c:440] debug_log(): (ttyACM8): --> 'AT*E2IPCFG?<CR>'
       [mm-port-serial-at.c:440] debug_log(): (ttyACM8): <-- '<CR><LF>*E2IPCFG: (1,"10.191.64.12")(2,"10.191.64.10")<CR><LF>'
       [mm-port-serial-at.c:440] debug_log(): (ttyACM8): <-- '<CR><LF>OK<CR><LF>'
       [mm-port-serial.c:1296] mm_port_serial_close(): (ttyACM8) device open count is 1 (close)
       [mm-port.c:95] mm_port_set_connected(): (wwan0): port now connected
       [mm-base-bearer.c:488] connect_ready(): Connected bearer '/org/freedesktop/ModemManager1/Bearer/0'
       [mm-iface-modem.c:1392] __iface_modem_update_state_internal(): Modem /org/freedesktop/ModemManager1/Modem/0: state changed (connecting -> connected)
      
       <info> Activation (ttyACM8) Stage 3 of 5 (IP Configure Start) started...
       <info> (ttyACM8): device state change: config -> ip-config (reason 'none') [50 70 0]
       <info> Activation (ttyACM8) Stage 4 of 5 (IPv6 Configure Timeout) scheduled...
       <info> Activation (ttyACM8) Stage 3 of 5 (IP Configure Start) complete.
       <info> (ttyACM8): IPv4 static configuration:
       <info>   address 10.191.64.12/28
       <info>   gateway 10.191.64.10
      Errore di segmentazione
      
      http://lists.freedesktop.org/archives/modemmanager-devel/2015-February/001758.html
      5df024f5
  15. 22 Jan, 2015 3 commits
    • Aleksander Morgado's avatar
      a6fedb1a
    • Aleksander Morgado's avatar
      wwan: wait for pppd to exit before relaying the port to ModemManager · fe090c34
      Aleksander Morgado authored
      ModemManager needs to have CLOCAL set in the TTY termios configuration, in order
      to notify the kernel that modem control lines are not in effect (e.g. so that a
      transition to LOW in the DCD input control line doesn't trigger a hangup in the
      TTY).
      
      pppd in the other hand, needs CLOCAL unset in order to have proper modem control
      lines in effect during the PPP session. So, when pppd starts it will store the
      original termios settings, and before exiting it will restore the original
      settings in the TTY. In other words, if CLOCAL was set before launching pppd,
      CLOCAL will be also set after pppd exits.
      
      Now, in order for this sequence to work correctly, NetworkManager also needs to
      make sure that ModemManager is notified about the disconnection only after pppd
      has really finished re-configuring the TTY.
      
      https://bugzilla.gnome.org/show_bug.cgi?id=734347
      
      ----------------------
      
      Once the patch is applied, we will be making sure that ModemManager is only
      notified about the disconnection AFTER pppd has fully exited:
          NetworkManager[27589]: <info>  (ttyUSB2): device state change: activated -> deactivating (reason 'user-requested') [100 110 39]
          Terminating on signal 15
          nm-pppd-plugin-Message: nm-ppp-plugin: (nm_phasechange): status 10 / phase 'terminate'
          nm-pppd-plugin-Message: nm-ppp-plugin: (nm_phasechange): status 8 / phase 'network'
          Connect time 0.3 minutes.
          Sent 56 bytes, received 0 bytes.
          nm-pppd-plugin-Message: nm-ppp-plugin: (nm_phasechange): status 5 / phase 'establish'
          nm-pppd-plugin-Message: nm-ppp-plugin: (nm_phasechange): status 11 / phase 'disconnect'
          Connection terminated.
          nm-pppd-plugin-Message: nm-ppp-plugin: (nm_phasechange): status 1 / phase 'dead'
          nm-pppd-plugin-Message: nm-ppp-plugin: (nm_exit_notify): cleaning up
          NetworkManager[27589]: <warn>  pppd pid 27617 exited with error: pppd received a signal
          NetworkManager[27589]: <info>  (ttyUSB2): modem state changed, 'connected' --> 'disconnecting' (reason: user-requested)
          NetworkManager[27589]: <info>  (ttyUSB2): modem state changed, 'disconnecting' --> 'registered' (reason: user-requested)
          NetworkManager[27589]: <info>  (ttyUSB2) modem deactivation finished
          NetworkManager[27589]: <info>  (ttyUSB2): device state change: deactivating -> disconnected (reason 'user-requested') [110 30 39]
          NetworkManager[27589]: <info>  (ttyUSB2): deactivating device (reason 'user-requested') [39]
      fe090c34
    • Aleksander Morgado's avatar
      ec61601a
  16. 13 Nov, 2014 1 commit
    • Dan Winship's avatar
      all: consistently include config.h · 3bfb163a
      Dan Winship authored
      config.h should be included from every .c file, and it should be
      included before any other include. Fix that.
      
      (As a side effect of how I did this, this also changes us to
      consistently use "config.h" rather than <config.h>. To the extent that
      it matters [which is not much], quotes are more correct anyway, since
      we're talking about a file in our own build tree, not a system
      include.)
      3bfb163a
  17. 07 Nov, 2014 1 commit
  18. 28 Oct, 2014 1 commit
    • Dan Winship's avatar
      libnm-core: add nm-core-types.h, remove cross-includes · b1087908
      Dan Winship authored
      Add nm-core-types.h, typedefing all of the GObject types in
      libnm-core; this is needed so that nm-setting.h can reference
      NMConnection in addition to nm-connection.h referencing NMSetting.
      
      Removing the cross-includes from the various headers causes lots of
      fallout elsewhere. (In particular, nm-utils.h used to include
      nm-connection.h, which included every setting header, so any file that
      included nm-utils.h automatically got most of the rest of libnm-core
      without needing to pay attention to specifics.) Fix this up by
      including nm-core-internal.h from those files that are now missing
      includes.
      b1087908
  19. 22 Oct, 2014 2 commits
    • Dan Winship's avatar
      devices: drop device-type-specific error domains · fd7b9df4
      Dan Winship authored
      Most NMDevice types defined their own error domain but then never used
      it. A few did use their errors, but some of those errors are redundant
      with NMDeviceError, and others can be added to it.
      fd7b9df4
    • Dan Winship's avatar
      libnm-core: merge NMSetting*Error into NMConnectionError · 2d8e7bd2
      Dan Winship authored
      Each setting type was defining its own error type, but most of them
      had exactly the same three errors ("unknown", "missing property", and
      "invalid property"), and none of the other values was of much use
      programmatically anyway.
      
      So, this commit merges NMSettingError, NMSettingAdslError, etc, all
      into NMConnectionError. (The reason for merging into NMConnectionError
      rather than NMSettingError is that we also already have
      "NMSettingsError", for errors related to the settings service, so
      "NMConnectionError" is a less-confusable name for settings/connection
      errors than "NMSettingError".)
      
      Also, make sure that all of the affected error messages are localized,
      and (where appropriate) prefix them with the relevant property name.
      
      Renamed error codes:
      
      NM_SETTING_ERROR_PROPERTY_NOT_FOUND -> NM_CONNECTION_ERROR_PROPERTY_NOT_FOUND
      NM_SETTING_ERROR_PROPERTY_NOT_SECRET -> NM_CONNECTION_ERROR_PROPERTY_NOT_SECRET
      
      Remapped error codes:
      
      NM_SETTING_*_ERROR_MISSING_PROPERTY -> NM_CONNECTION_ERROR_MISSING_PROPERTY
      NM_SETTING_*_ERROR_INVALID_PROPERTY -> NM_CONNECTION_ERROR_INVALID_PROPERTY
      NM_SETTING_ERROR_PROPERTY_TYPE_MISMATCH -> NM_CONNECTION_ERROR_INVALID_PROPERTY
      NM_SETTING_BLUETOOTH_ERROR_TYPE_SETTING_NOT_FOUND -> NM_CONNECTION_ERROR_INVALID_SETTING
      NM_SETTING_BOND_ERROR_INVALID_OPTION -> NM_CONNECTION_ERROR_INVALID_PROPERTY
      NM_SETTING_BOND_ERROR_MISSING_OPTION -> NM_CONNECTION_ERROR_MISSING_PROPERTY
      NM_SETTING_CONNECTION_ERROR_TYPE_SETTING_NOT_FOUND -> NM_CONNECTION_ERROR_MISSING_SETTING
      NM_SETTING_CONNECTION_ERROR_SLAVE_SETTING_NOT_FOUND -> NM_CONNECTION_ERROR_MISSING_SETTING
      NM_SETTING_IP4_CONFIG_ERROR_NOT_ALLOWED_FOR_METHOD -> NM_CONNECTION_ERROR_INVALID_PROPERTY
      NM_SETTING_IP6_CONFIG_ERROR_NOT_ALLOWED_FOR_METHOD -> NM_CONNECTION_ERROR_INVALID_PROPERTY
      NM_SETTING_VLAN_ERROR_INVALID_PARENT -> NM_CONNECTION_ERROR_INVALID_PROPERTY
      NM_SETTING_WIRELESS_SECURITY_ERROR_MISSING_802_1X_SETTING -> NM_CONNECTION_ERROR_MISSING_SETTING
      NM_SETTING_WIRELESS_SECURITY_ERROR_LEAP_REQUIRES_802_1X -> NM_CONNECTION_ERROR_INVALID_PROPERTY
      NM_SETTING_WIRELESS_SECURITY_ERROR_LEAP_REQUIRES_USERNAME -> NM_CONNECTION_ERROR_MISSING_PROPERTY
      NM_SETTING_WIRELESS_SECURITY_ERROR_SHARED_KEY_REQUIRES_WEP -> NM_CONNECTION_ERROR_INVALID_PROPERTY
      NM_SETTING_WIRELESS_ERROR_CHANNEL_REQUIRES_BAND -> NM_CONNECTION_ERROR_MISSING_PROPERTY
      
      Dropped error codes (were previously defined but unused):
      
      NM_SETTING_CDMA_ERROR_MISSING_SERIAL_SETTING
      NM_SETTING_CONNECTION_ERROR_IP_CONFIG_NOT_ALLOWED
      NM_SETTING_GSM_ERROR_MISSING_SERIAL_SETTING
      NM_SETTING_PPP_ERROR_REQUIRE_MPPE_NOT_ALLOWED
      NM_SETTING_PPPOE_ERROR_MISSING_PPP_SETTING
      NM_SETTING_SERIAL_ERROR_MISSING_PPP_SETTING
      NM_SETTING_WIRELESS_ERROR_MISSING_SECURITY_SETTING
      2d8e7bd2
  20. 20 Oct, 2014 1 commit
  21. 04 Sep, 2014 1 commit
  22. 25 Aug, 2014 1 commit
  23. 01 Aug, 2014 1 commit
    • Dan Winship's avatar
      libnm, core, cli, tui: fix the capitalization of various types · 3ac0f528
      Dan Winship authored
      GLib/Gtk have mostly settled on the convention that two-letter
      acronyms in type names remain all-caps (eg, "IO"), but longer acronyms
      become initial-caps-only (eg, "Tcp").
      
      NM was inconsistent, with most long acronyms using initial caps only
      (Adsl, Cdma, Dcb, Gsm, Olpc, Vlan), but others using all caps (DHCP,
      PPP, PPPOE, VPN). Fix libnm and src/ to use initial-caps only for all
      three-or-more-letter-long acronyms (and update nmcli and nmtui for the
      libnm changes).
      3ac0f528
  24. 23 Jul, 2014 7 commits
    • Dan Williams's avatar
      wwan: allow using the default subscription APN (bgo #729665) · d307a8b0
      Dan Williams authored
      If no APN is specified, passing "" to ModemManager indicates that
      the connection should use the default subscription APN, which the
      modem and the network determine themselves.  This doesn't work
      with all modems and operators, but in that case the user can
      specify the APN.
      d307a8b0
    • Simon Farnsworth's avatar
      wwan: allow completing new GSM connections without an APN (bgo #729665) · 155cd790
      Simon Farnsworth authored
      In commit 215306f5 [1], NetworkManager was changed to require an APN for GSM
      connections; previously, an omitted APN was taken as "use the default APN
      for this device".
      
      ModemManager supports this behaviour with an empty APN string; older
      NetworkManager versions support this behaviour with no APN in the
      settings. Choose the older NM behaviour, for backwards compatibility.
      
      [1] commit 215306f5
        Author: Dan Williams <dcbw@redhat.com>
        Date:   Mon Jan 10 23:39:12 2011 -0600
      
          core: add AddAndActivate D-Bus method
      
          Given connection details, complete the connection as well as possible
          using the given specific object and device, add it to system
          settings, and activate it all in one method.
      Signed-off-by: default avatarSimon Farnsworth <simon.farnsworth@onelan.co.uk>
      
      https://bugzilla.gnome.org/show_bug.cgi?id=729665
      155cd790
    • Dan Williams's avatar
      wwan: don't disconnect if nothing to disconnect · 20081816
      Dan Williams authored
      Avoid this error:
      
      NetworkManager[25181]: <warn> (cdc-wdm1): Failed to connect 'T-Mobile Internet': Connection requested IPv4 but IPv4 is unsuported by the modem.
      NetworkManager[25181]: <info> (cdc-wdm1): device state change: prepare -> failed (reason 'modem-init-failed') [40 120 28]
      
      ** (NetworkManager:25181): CRITICAL **: mm_modem_simple_disconnect: assertion 'MM_IS_MODEM_SIMPLE (self)' failed
      
      self->priv->simple_iface is only valid if stage1/prepare actually
      completes, so don't try to access it if stage1/prepare failed.
      20081816
    • Dan Williams's avatar
    • Dan Williams's avatar
      wwan: clean up and split IP method values · dd6abd40
      Dan Williams authored
      Add an 'unknown' value; make the type an enum, and rename it since
      this enum is private to NetworkManager and abstracts differences
      in old and new MM.
      
      We also need separate methods for IPv4 and IPv6 since they may not
      use the same mechanism.  For example, IPv4 may use DHCP but IPv6 may
      require static configuration, based on what the modem firmware wants.
      dd6abd40
    • Dan Williams's avatar
      wwan: read supported IP types from ModemManager · f3557d32
      Dan Williams authored
      Not all modems support IPv6, and to prevent some common failure
      cases, make sure we don't try to use IPv6 when the modem doesn't
      support it.
      f3557d32
    • Dan Winship's avatar
      core: fill in nm-types.h, clean out other headers · b28f6526
      Dan Winship authored
      Clean up some of the cross-includes between headers (which made it so
      that, eg, if you included NetworkManagerUtils.h in a test program, you
      would need to build the test with -I$(top_srcdir)/src/platform, and if
      you included nm-device.h you'd need $(POLKIT_CFLAGS)) by moving all
      GObject struct definitions for src/ and src/settings/ into nm-types.h
      (which already existed to solve the NMDevice/NMActRequest circular
      references).
      
      Update various .c files to explicitly include the headers they used to
      get implicitly, and remove some now-unnecessary -I options from
      Makefiles.
      b28f6526
  25. 19 Jun, 2014 1 commit
  26. 30 May, 2014 1 commit
  27. 07 May, 2014 1 commit
    • Dan Williams's avatar
      wwan: set modem to low power state when disabling · 837bf2e3
      Dan Williams authored
      When WWAN airplane mode is enabled, set modems to low power state to
      ensure they are in airplane mode if either (a) the machine does not
      have an rfkill switch, or (b) the modem is not tied to any rfkill
      switch (eg, external USB/SDIO/etc).
      837bf2e3