Commit graph

33 commits

Author SHA1 Message Date
Dan Winship
6f44b7f3c6 all: remove redundant return-if-fail checks
NM_IS_FOO(x) returns FALSE if x is NULL, so we don't need a separate
(x != NULL) check before it.
2013-03-07 07:32:27 -05:00
Pavel Šimerda
e7caad20c9 device: share implementation of hw_is_up, hw_bring_up and hw_take_down 2013-01-22 18:03:25 +01:00
Dan Williams
d3e4930177 mobile: assume IFF_NOARP when given a /32 prefix
Trying to ARP with no other machines in the broadcast domain
is pretty pointless, and in many cases doesn't work (ZTE MF691
/T-Mobile Rocket 2), so turn it off.
2012-11-21 11:48:26 -06:00
Aleksander Morgado
998b9295c9 modem-manager: don't report the data interface along with the IPv4 configuration
The only case where this was being used was in PPP-based connections, as the
ppp0 interface was reported by pppd once the IP setup was done. Instead, just
update the 'NM_MODEM_DATA_PORT' property, as the NMDevices already listen for
changes in that property.
2012-11-21 11:48:25 -06:00
Aleksander Morgado
c9579b1bf0 device-bt, device-modem: listen for data port changes in the `NMModem'
The new ModemManager1-based `NMModemBroadband' objects will set the data port
information only after having created the bearer as part of the connection
process. The devices, therefore, need to listen to changes in the `data-port'
property, so that the `ip-iface' in the `NMDevice' is set before finishing the
stage1 of the activation. This is required in order to have a proper ifup of the
data port.
2012-11-21 11:48:25 -06:00
Aleksander Morgado
2e74fc8cf4 modem-manager, manager: integrate the new `ModemManager1' interface support
The new `MMManager' object takes care of notifying modems added or removed from
the ModemManager1 interface.

We will listen to both the old and new ModemManager implementations, but as soon
as the first ModemManager implementation is found, the other one gets cleared,
so that we don't wait forever to appear.
2012-11-21 11:48:25 -06:00
Aleksander Morgado
a8f7a45e3f modem-manager: rework interface related properties in `NMModem'
The logic behind the `iface' property (which actually is removed) gets split
into three new properties, as follows::

 * `uid': Just defines a new string property which must contain a unique ID of
    the modem, mainly for logging.

 * `control-port': a string property defining which is the control port the
    modem uses. This property is actually optional and may be specified as NULL.
    The main purpose of this property is to allow the easy integration of the
    new ModemManager into the `NMDeviceBt' object. The bluetooth device needs
    to know the port used by the modem; and we cannot use the Data port
    information as that is only available until the bearer is created. Instead,
    for the new ModemManager we will use the control port information exposed.

 * `data-port': a string property defining which is the data port to use in the
    connection. This property is always defined in the `NMModemGsm' and
    `NMModemCdma' objects.
2012-10-30 18:34:26 -05:00
Aleksander Morgado
1f0dbd6790 modem-manager: let the `NMDeviceModem' handle hw_is_up() and hw_bring_up()
These actions don't require anything from the `NMModem' object, so just move
them back to `NMDeviceModem'.
2012-10-30 18:24:28 -05:00
Aleksander Morgado
24b6fc9e62 modem-manager: switch the state' property from NMModem' into just `connected'
We don't want to depend in the `NMModem' interface on an enumeration which is
very specific to the old ModemManager interface, so we'll just skip exposing it
and instead we'll just give a new boolean property which tells whether the modem
is connected or not (which was at the end the whole purpose of the `state'
property).
2012-10-30 18:24:25 -05:00
Dan Winship
0fdf2e7438 core: implement NMDevice::state-changed more idiomatically
Rather than having NMDevice subclasses connect to their own
::state-changed signal, fix up the signal definition so they can just
override the class handler.
2012-10-02 15:46:08 -04:00
Dan Winship
565c43e91d core: remove "real_" prefix from method implementation names
The idea was copied from gtk, but it's only used there in cases where
the method's wrapper function and default implementation would
otherwise have the same name, which never happens in NM because our
method implementations aren't prefixed with the type name, so it's
just noise here.
2012-10-02 15:43:24 -04:00
Dan Williams
052a24343e modem: track modem state and fail device if modem disconnects
This worked fine with PPP because PPP terminates, and NM watches
for that and handles it fine.  But modems with pseudo-ethernet ports
don't have anything like that, so we have to watch the modem's state
property instead.  This works only with MM 0.5.4 and later (including
0.6).
2012-08-24 13:24:16 -05:00
Dan Williams
0e801e5ca3 modem: ensure radio disable cleans up during activation too
Instead of just when activated.
2012-06-06 10:25:47 -05:00
Dan Williams
43f449824a mobile: ensure IPv4 timeout fails activation
With the switch to IPv4 being allowed to fail by default we need
to clean up this old code a bit.  PPP failure during IP config
should trigger a timeout, and the core code will handle whether
to fail the device completely or not.  But if we got a valid IPv4
config and PPP failed later, the device gets failed.  Previously
the device would just sit in IP_CONFIG state because now IPv4
defaults may-fail to TRUE, and when PPP failed the
nm_device_ip_config_should_fail() check would obviously not pass.
2012-03-20 23:21:17 -05:00
Dan Williams
6b9511f6e9 core: treat missing IPv6 setting as AUTO
Like IPv4, if the connection contains no IPv6 setting, perform
IPv6 addressing.  Since may-fail defaults to TRUE for IPv6, failure
should have no consequence.
2012-03-16 09:43:16 -05:00
Dan Williams
da8e21a7d7 core: kill NMDeviceInterface 2011-12-02 13:30:07 -06:00
Dan Williams
6d567e71e6 core: move NMDeviceInterface properties and methods to nm-device.c 2011-12-02 13:30:07 -06:00
Dan Williams
827d9defb9 core: move nm_device_interface_set_enabled() to nm-device.c 2011-12-02 13:30:07 -06:00
Dan Williams
51c25508c2 core: move nm_device_interface_get_enabled() to nm-device.c 2011-12-02 13:30:07 -06:00
Dan Williams
f8852bf4a4 core: kill nm_device_interface_get_state() 2011-12-02 13:30:06 -06:00
Dan Williams
3927ccd1c0 core: decouple initial IP configuration states from device state
Initial IP configuration can happen during ACTIVATED state if both
v4 and v6 are enabled, but one takes longer than the other.  Thus
various checks throughout the code for IP_CONFIG were incorrect
since they depended on IP configuration only happening during the
IP_CONFIG state.  Fix that by using a separate state for IP config
and using that state for various checks instead of the overall
device state.
2011-11-09 21:36:52 -06:00
Dan Williams
bdd556fe4d core: kill stage4 (IP Config Get)
It was somewhat pointless since the IP config is always known when
stage4 gets scheduled, so why not just pass the config to stage5
immediately?  Also helps consolidate the v4/v6 failure handling
logic and makes the operational flow clearer where both v4 and
v6 are active and proceeding in parallel.
2011-11-09 21:36:52 -06:00
Dan Williams
23943e7ce2 core: handle new device states
The device states aren't used yet, but handle them anyway.
2011-03-17 13:42:22 -05:00
Dan Williams
2140dad5e0 core: consolidate mobile broadband device types
These days more and more devices are showing up that support a
number of different access technology families in the same hardware,
like Qualcomm Gobi (CDMA and GSM), Pantech UM190 (CDMA and GSM),
Pantech UML290 (CDMA and LTE), LG VL600 (CDMA and LTE), Sierra
320U (GSM and LTE), etc.  The previous scheme of having device
classes based on access technology family simply cannot handle
this hardware and attempting to add LTE to both the CDMA and GSM
device classes would result in a bunch of code duplication that
we don't want.  There's a better way...

Instead, combine both CDMA and GSM device classes into a generic
"Modem" device class that provides capabilities indicating what
access technology families a modem supports, and what families
it supports immediately without a firmware reload.  (Gobi devices
for example require a firmware reload before they can switch
between GSM and CDMA).  This provides the necessary flexibility
to the client and allows us to keep the API stable when the
same consolidation change is made in ModemManager.

The current code doesn't yet allow multi-mode operation internally,
but the API is now what we want it to be and won't need to be
changed.
2011-02-25 10:16:17 -06:00
Dan Williams
3b61adec74 core: consolidate deactivation methods
deactivate_quickly is misnamed these days; it was originally used
for quickly tearing down a device for sleep and such.  But these
days it's used for the bulk of device deactivation.  Only the wifi
class used the actual deactivate method.  So combine the two and
make device implementations less complicated.
2011-02-24 11:27:42 -06:00
Dan Williams
215306f5a1 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.
2011-01-10 23:39:12 -06:00
Dan Williams
62a2c34e27 core: simplify secrets handling during activation
Instead of a bizare mechanism of signals back to the manager
object that used to be required because of the user/system settings
split, let each place that needs secrets request those secrets
itself.  This flattens the secrets request process a ton and
the code flow significantly.

Previously the get secrets flow was something like this:

nm_act_request_get_secrets ()
    nm_secrets_provider_interface_get_secrets ()
        emits manager-get-secrets signal
            provider_get_secerts ()
                system_get_secrets ()
                    system_get_secrets_idle_cb ()
                        nm_sysconfig_connection_get_secrets ()
                            system_get_secrets_reply_cb ()
                                nm_secrets_provider_interface_get_secrets_result ()
                                    signal failure or success

now instead we do something like this:

nm_agent_manager_get_secrets ()
    nm_agent_manager_get_secrets ()
        request_start_secrets ()
            nm_sysconfig_connection_get_secrets ()
                return failure or success to callback
2010-12-13 21:14:23 -06:00
Dan Williams
2e92d84ef0 modem: fix WWAN hardware enable state tracking (rh #591622) 2010-05-24 17:07:46 -07:00
Dan Williams
8aef7ef411 core: allow selective failure of IP configuration (rh #567978)
As long as at least one IP config method completes, and as long as
methods that the user required to complete do complete, allow the
connection to complete.
2010-05-03 01:19:54 -07:00
Dan Williams
4bc59be464 mobile-broadband: update logging 2010-04-07 11:08:43 -07:00
Dan Williams
f032e478d8 modem: consolidate common modem code into NMDeviceModem 2010-03-25 13:15:03 -07:00
Dan Williams
c45064ba36 modem: remove debugging printf 2010-03-25 12:21:01 -07:00
Dan Williams
9a1143b337 modem: fix modem type checking for various operations
After the DUN branch merge (I think?) a number of NM_IS_MODEM
calls were left around which now always return FALSE since
NMDeviceCdma and NMDeviceGsm aren't subclasses of NMModem anymore.
But we still need generic "is this a modem subclass" checks in
a few places, so add a modem base class that both the GSM and
CDMA device classes inherit from and use that.

Plus, we want to consolidate a ton of the common code in
nm-device-gsm.c and nm-device-cdma.c into the base class in the
future anyway.
2010-03-25 12:18:26 -07:00