summaryrefslogtreecommitdiff
path: root/src/mm-base-bearer.c
AgeCommit message (Collapse)AuthorFilesLines
2021-11-03base-bearer: allow reporting uplink/downlink speeds via indicationsAleksander Morgado1-0/+15
2021-11-03base-bearer: implement support for 'uplink-speed' and 'downlink-speed'Aleksander Morgado1-4/+43
We let protocol implementations provide the uplink and downlink speeds agreed with the network as part of the connect result, and we then move them to the bearer stats in DBus.
2021-10-22api,bearer: new 'start-date' field in bearer statisticsFrederic Martinsons1-0/+4
It stores the epoch timestamp of the current bearer session start. If there is no connected bearer, it is set to 0 and not displayed in mmcli output. Signed-off-by: Frederic Martinsons <frederic.martinsons@sigfox.com> Includes updates by Aleksander Morgado to fix coding style issues.
2021-05-26base-bearer: ignore cancellation during sync()Aleksander Morgado1-6/+0
There is no input cancellable in the method, so the GTask will never get cancelled from the outside.
2021-05-26base-bearer: propagate the new connection status after reloadAleksander Morgado1-6/+23
Just triggering a connection status reload won't change the actual bearer object state. We change the signature of the reload_connection_status_finish() method so that it returns the actual reloaded bearer connection status, and so both the load_ and reload_ methods can be implemented with exactly the same method, something that was not possible before. Once we get the new connection status reloaded, we apply it in the bearer object only if it's DISCONNECTED (and it wasn't DISCONNECTED before). This should cover the true real case we're interested in, and nothing else (i.e. we won't overcomplicate the logic attempting to handle disconnected->connected transitions detected in the sync() operation).
2021-05-26base-bearer: fix connection reload completionAleksander Morgado1-9/+1
If we called the class reload_connection_status() method, we should call the class reload_connection_status_finish() as well.
2021-05-26base-bearer: synchronize state when resumingDylan Van Assche1-0/+124
Refresh connection status on resume to confirm that the connection bearers are still valid.
2021-05-23base-bearer: never overwrite a connection error that is already setAleksander Morgado1-0/+5
2021-05-23base-bearer: limit the type of errors we can set as 'ConnectionError'Aleksander Morgado1-2/+41
2021-05-23base-bearer: clear connection error on every new attemptAleksander Morgado1-0/+3
2021-05-23base-bearer: report connection error on network initiated disconnectionsAleksander Morgado1-10/+27
By default, fallback to "unknown" mobile equipment error when the modem gets disconnected by the network and we don't have any way to know a more detailed reason.
2021-05-23base-bearer: report connection error on failed connection attemptsAleksander Morgado1-1/+19
When a user-requested connection attempt fails, we not only return the connection error to the user that requested it, we also publish the specific connection error in DBus for others to check why the failure happened.
2021-05-18base-bearer: trivial fix printing stats reportsAleksander Morgado1-1/+1
2021-04-29bearer-list: allow lookup by connected profile idAleksander Morgado1-0/+6
Some of the operations performed by the profile management interface will require checking whether the operation is attempted on a profile for which there is a known connected bearer object. We introduce a new method to lookup a bearer in the bearer list by its connected profile id.
2021-04-29base-bearer: propagate connected profile id value in the connect resultAleksander Morgado1-0/+20
Implementations that support profile management will provide the connected profile id value in the MMBearerConnectResult returned to the base bearer object during the connection attempt.
2021-03-31base-bearer: remove default IP family propertyAleksander Morgado1-25/+0
There is no point in providing a configurable default IP family in the bearer object, because we can always assume IPv4 as being the only default expected. Simplify the logic and also provide a new method to get the normalize the IP family, using IPv4 as default always.
2021-03-17base-bearer: ignore forced disconnectionsAleksander Morgado1-0/+5
If using PPP, ModemManager is never in charge of deciding when the connection is finished, because that would end up making ModemManager try to use the TTY port while pppd is still using it. When the modem goes unregistered for some time, we should not force the disconnection of the bearer object, we still need to wait for pppd to tell us the modem is disconnected. Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/331
2021-03-10api,bearer: new 'Multiplexed' propertyAleksander Morgado1-5/+25
This property will be TRUE if the bearer has the data session connected through a multiplexed interface. If the bearer is disconnected, or connected without multiplexing, the property will report FALSE.
2020-04-10base-bearer: log connection attempt failure reasonAleksander Morgado1-1/+3
We were logging it as debug, increase logging level to warning to make sure it's always logged.
2020-04-10base-bearer: log stats on disconnectionAleksander Morgado1-0/+15
2020-04-10base-bearer: don't run disconnection path multiple timesAleksander Morgado1-0/+4
2020-04-10api,bearer: add 'total-rx-bytes', 'total-tx-bytes' and 'total-duration' statsAleksander Morgado1-9/+63
Compiling the amount of bytes transferred and received during all tracked connection attempts, as well as the total duration of all the connections.
2020-04-10api,bearer: add 'attempts' and 'failed-attempts' statisticsAleksander Morgado1-12/+20
When we're reusing over and over the same bearer object, we can provide statistical information about the number of connection attempts that have been done and how many of them failed.
2020-04-09api: new 'attached RLOS' registration stateAleksander Morgado1-0/+1
Reporting the state when the UE attaches to access restricted local operator services.
2020-04-08base-bearer: port to use object loggingAleksander Morgado1-46/+57
2020-04-08base-bearer: set dbus id as soon as object is createdAleksander Morgado1-2/+9
2020-01-30core,base-bearer: fix warnings with -Wswitch-defaultAleksander Morgado1-0/+2
mm-base-bearer.c: In function ‘modem_3gpp_registration_state_changed’: mm-base-bearer.c:463:5: warning: switch missing default case [-Wswitch-default] 463 | switch (state) { | ^~~~~~
2019-12-16base-bearer: avoid conncheck or stats update while disconnectingAleksander Morgado1-12/+18
We don't want the connection status checks to interfere with the disconnection logic, e.g. if they're both using the same TTY for both things. E.g. the CGACT? from the conncheck gets in the way of the disconnection logic: <debug> [1576037519.710684] Flashing data port (ttyUSB1)... <debug> [1576037519.710740] (ttyUSB1): port attributes not fully set <debug> [1576037520.287636] (ttyUSB1) device open count is 3 (open) <debug> [1576037520.287804] (ttyUSB1): --> 'AT+CGACT?<CR>' <debug> [1576037520.711067] (ttyUSB1) device open count is 2 (close) <debug> [1576037520.711127] (ttyUSB1): running init sequence... <debug> [1576037520.711231] PDP disconnection already sent <debug> [1576037520.711263] Disconnected bearer '/org/freedesktop/ModemManager1/Bearer/0' Instead, fully skip all conncheck and stat updates as long as the modem is not connected. The actual conncheck and stat update timeouts will be removed once completely disconnected, as it was before.
2019-10-17base-bearer,iface-modem-simple: log user requests to connect/disconnectAleksander Morgado1-0/+4
2019-10-11base-bearer: avoid using MM_CORE_ERROR_CANCELLEDAleksander Morgado1-6/+3
2019-09-17base-bearer: debug log only when ignoring disconnection from CGACT?Aleksander Morgado1-1/+1
There are modems out there (e.g. SIM7600E) where we connect a given CID >1 but once connected, only CID=1 is reported as connected, and not the one we explicitly attempted to connect. In this situation the modem is connected successfully, and we're properly ignoring the disconnection report detected from CGACT? responses, but we're probably better logging this situation only in debug level, not as info, because this check is done periodically every 5s... <debug> [1568649020.333263] (ttyUSB5): --> 'AT+CGDCONT=7,"IP","inet.es"<CR>' <debug> [1568649020.383517] (ttyUSB5): <-- '<CR><LF>OK<CR><LF>' <debug> [1568649020.383617] (ttyUSB5) device open count is 3 (open) <debug> [1568649020.383655] Connection through a plain serial AT port (ttyUSB5) <debug> [1568649020.383683] (ttyUSB5) device open count is 4 (open) <debug> [1568649020.383802] (ttyUSB5) device open count is 3 (close) <debug> [1568649020.383873] (ttyUSB5): --> 'ATD*99***7#<CR>' <debug> [1568649020.405767] (ttyUSB5): <-- '<CR><LF>CONNECT 115200<CR><LF>' <debug> [1568649020.405853] [ttyUSB5] Setting flow control: rts-cts <debug> [1568649020.405878] (ttyUSB5): enabling RTS/CTS flow control <debug> [1568649020.405897] (ttyUSB5): port attributes not fully set <debug> [1568649020.405910] (ttyUSB5): flow control settings updated to rts-cts <debug> [1568649020.405940] (ttyUSB5): port now connected <debug> [1568649020.405983] Connected bearer '/org/freedesktop/ModemManager1/Bearer/0' <debug> [1568649020.406081] PPP is required for connection, will ignore disconnection reports <info> [1568649020.406155] Modem /org/freedesktop/ModemManager1/Modem/0: state changed (connecting -> connected) <info> [1568649020.406361] Simple connect state (8/8): All done <debug> [1568649020.406461] (ttyUSB5) device open count is 2 (close) <debug> [1568649020.448483] (net/ppp0): adding device at sysfs path: /sys/devices/virtual/net/ppp0 <debug> [1568649020.448738] (net/ppp0) could not get vendor/product id <debug> [1568649020.448776] [filter] (net/ppp0) port filtered: virtual device <debug> [1568649050.395662] (ttyUSB6) device open count is 2 (open) <debug> [1568649050.395871] (ttyUSB6): --> 'AT+CGACT?<CR>' <debug> [1568649050.408638] (ttyUSB6): <-- '<CR><LF>+CGACT: 1,1<CR><LF>+CGACT: 2,0<CR><LF>+CGACT: 3,0<CR><LF>+CGACT: 4,0<CR><LF>+CGACT: 5,0<CR><LF>+CGACT: 6,0<CR><LF>+CGACT: 7,0<CR><LF><CR><LF>OK<CR><LF>' <debug> [1568649050.408803] connection status loaded: disconnected ---> <info> [1568649050.408825] ignoring disconnection report for bearer '/org/freedesktop/ModemManager1/Bearer/0' <debug> [1568649050.408848] (ttyUSB6) device open count is 1 (close) <debug> [1568649055.398994] (ttyUSB6) device open count is 2 (open) <debug> [1568649055.399084] (ttyUSB6): --> 'AT+CGACT?<CR>' <debug> [1568649055.411489] (ttyUSB6): <-- '<CR><LF>+CGACT: 1,1<CR><LF>+CGACT: 2,0<CR><LF>+CGACT: 3,0<CR><LF>+CGACT: 4,0<CR><LF>+CGACT: 5,0<CR><LF>+CGACT: 6,0<CR><LF>+CGACT: 7,0<CR><LF><CR><LF>OK<CR><LF>' <debug> [1568649055.411652] connection status loaded: disconnected ---> <info> [1568649055.411674] ignoring disconnection report for bearer '/org/freedesktop/ModemManager1/Bearer/0'
2019-09-10base-bearer: include disconnection error message in logAleksander Morgado1-1/+1
2019-08-05base-bearer: if method is PPP, require explicit bearer disconnectionAleksander Morgado1-2/+50
Never automatically flag the bearer as disconnected if it's using PPP, because we could end up using the TTY at the same time as pppd, with the wrong CLOCAL settings. So, whenever we detect that the bearer requires PPP, we will ignore all disconnection reports generated by ModemManager itself.
2019-05-14base-bearer: fix check for cancellationLubomir Rintel1-3/+2
If we cancel connect_cancellable, the connect task will return a G_IO_ERROR_CANCELLED. We may need to do some cleanup (like, disconnect if the connection went far enough to actually start the network connection), thus it's important we check for cancellation correctly.
2018-12-07api,modem-3gpp: new 'InitialEpsBearer' propertyAleksander Morgado1-5/+23
This property contains the DBus path of a Bearer object of type MM_BEARER_TYPE_DEFAULT_ATTACH, which is automatically exposed by the modem when registered in the LTE network. Unlike standard bearer objects created by the user, this bearer won't allow any connection/disconnection request, as its status is bound to the LTE registration exclusively. The bearer settings exposed by the object include the APN details that have been used during the initial packet network attach, which may be defined by modem settings (e.g. if previously configured in the firmware which APN to use for the given SIM card operator) or by the network itself (e.g. if none configured, or if a network override is required as when roaming). The bearer object will be created as soon as the LTE attach status details are known, and only while the modem is enabled. The implementation allows modems to update the LTE attach status details during runtime, so the bearer object with the settings may be recreated during runtime as well.
2018-12-07api,bearer: new 'BearerType' propertyAleksander Morgado1-9/+10
Until now we have only allowed to use and setup 'default bearers' (in 4G) or 'primary contexts' (in 2G/3G). We can define a couple of additional bearer types, though: * The 'dedicated bearers' (in 4G) or 'secondary contexts' (in 2G/3G), which are associated to a specific default/primary one, but which provide specific QoS settings configured via traffic flow templates. * The 'initial default EPS bearer', which is a special case of default bearer in LTE, which is automatically created and connected when the modem is registered in the LTE network. This commit introduces a new 'MMBearerType' enumeration that will be associated to each bearer through a 'BearerType' property in the org.freedesktop.ModemManager1.Bearer interface, showing what kind of bearer/context this is. By default, right now, all bearer objects created are 'default' bearers.
2017-10-19base-bearer: fix reporting tx/rx statsAleksander Morgado1-2/+2
The numbers were actually swapped!
2017-07-03base-bearer: port mm_base_bearer_disconnect to use GTaskBen Chan1-24/+17
2017-07-03base-bearer: port mm_base_bearer_connect to use GTaskBen Chan1-27/+28
2017-06-05base-bearer: use an initial longer timeout for connectivity checkAleksander Morgado1-7/+26
If we ask too quick for the PDP context status after a successful connection attempt reported by the modem, we may find it still flagged as inactive if the modem is still busy setting up the PPP session. Do an explicit longer initial timeout before we run the first check, and after that one setup the additional checks at a higher rate. Reported-by: Colin Helliwell <colin.helliwell@ln-systems.com>
2017-03-24base-bearer: stop connection status monitoring if no TTY availableAleksander Morgado1-2/+18
On modems with a single TTY for both control and data, we cannot use the TTY to load connection status once we're in connected mode: Connection through a plain serial AT port (ttyUSB2) (ttyUSB2): --> 'ATD*99***2#<CR>' (ttyUSB2): <-- '<CR><LF>CONNECT 100000000<CR><LF>' (ttyUSB2): port now connected Connected bearer '/org/freedesktop/ModemManager1/Bearer/0' Modem /org/freedesktop/ModemManager1/Modem/0: state changed (connecting -> connected) Simple connect state (8/8): All done checking if connected failed: Couldn't check current list of active PDP contexts: No AT port available to run command checking if connected failed: Couldn't check current list of active PDP contexts: No AT port available to run command checking if connected failed: Couldn't check current list of active PDP contexts: No AT port available to run command ... So, disable connection monitoring right away if that situation is detected: Connection through a plain serial AT port (ttyUSB2) (ttyUSB2): --> 'ATD*99***2#<CR>' (ttyUSB2): <-- '<CR><LF>CONNECT 100000000<CR><LF>' (ttyUSB2): port now connected Connected bearer '/org/freedesktop/ModemManager1/Bearer/0' Modem /org/freedesktop/ModemManager1/Modem/0: state changed (connecting -> connected) Simple connect state (8/8): All done Connection monitoring is unsupported by the device ... https://bugs.freedesktop.org/show_bug.cgi?id=100376
2016-10-12base-bearer: allow deactivating stats loading if device says unsupportedAleksander Morgado1-6/+20
2016-10-123gpp: update registration state enumeration with CSFB related statesAleksander Morgado1-1/+18
Introduce "sms only" and "CSFB not preferred" home/roaming states to be reported for the CS context, while already registered on LTE. Based on 3GPP TS 27.007 v13.5.0.
2016-10-12base-bearer: new periodic monitoring of connection statusAleksander Morgado1-6/+74
2016-08-15core: use MM-specific logging methods always instead of the generic GLib onesAleksander Morgado1-1/+1
2015-12-07base-bearer: setup periodic stats loadingAleksander Morgado1-3/+120
If the bearer implementation supports it, load stats periodically. By default every 30s for now.
2015-12-02core: use G_SOURCE_REMOVE and G_SOURCE_CONTINUE in GSourceFuncsAleksander Morgado1-2/+2
2014-07-06bearer: rename 'MMBearer' to 'MMBaseBearer'Aleksander Morgado1-0/+1300
Just so that we don't have same header names in src/ and /libmm-glib.