Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wwan: Do not change initial bearer config and properly clear unused default bearers #4401

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

milan-zededa
Copy link
Contributor

@milan-zededa milan-zededa commented Oct 25, 2024

This PR addresses two issues related to cellular connectivity.

First, make sure that there are no bearers left from previous
connection attempts before starting a new connection, Otherwise, we may get
interface-in-use-config-match error from ModemManager.

Second, we should not change the initial EPS bearer settings and assume that
the same APN should be used for both the initial and the default bearer.
This is not always the case and the modem registration may fail when we
apply the same APN. However, we might want to make this user configurable
through EVE API and the controller.

Some background for understanding: LTE connection consists of two IP bearers,
the initial EPS bearer and the default bearer. Device must first establish
the initial bearer (which shows as transition from the searching to registered
state) and then it connects to a default bearer (transition from registered to
connected). Both bearers require PDP context settings (APN, ip-type, potentially
username/password, etc.).
Settings for the initial bearer are typically provided by the SIM card while
settings for the default bearer are user-configured.

It is not necessarily the case that the APNs for the initial and the default bearers
are the same. We used to make that assumption but this has led to cases where modem
was failing registration because the APN for the initial bearer was wrong. It is
better to let the SIM card provide the PDP context setting for the initial EPS bearer.
Furthermore, once these settings are changed, there is no straightforward method to
revert back to the SIM-provided configuration; for more details, see the discussion here:
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1490#note_2628804

Users may only need to override SIM-provided settings in rather rare cases: either when
the SIM card has incorrect configuration (we have seen this only once) or when the initial
EPS bearer requires username/password authentication (also uncommon). Despite the rarity
of these cases, these settings should be user-configurable. We will do this later
(requires EVE API and controller changes).
Please note, that the same enhancement was recently implemented in NetworkManager
(used by Ubuntu and other major Linux distributions):
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1915

Also included in this PR is a documentation how to capture control-plane traffic on
Qualcomm-based modems.

@milan-zededa milan-zededa added the stable Should be backported to stable release(s) label Oct 25, 2024
@milan-zededa milan-zededa self-assigned this Oct 25, 2024
…efault bearers

This commit addresses two issues related to cellular connectivity.

First, make sure that there are no bearers left from previous
connection attempts before starting a new connection, Otherwise, we may get
"interface-in-use-config-match" error from ModemManager.

Second, we should not change the initial EPS bearer settings and assume that
the same APN should be used for both the initial and the default bearer.
This is not always the case and the modem registration may fail when we
apply the same APN. However, we might want to make this user configurable
through EVE API and the controller.

Some background for understanding: LTE connection consists of two IP bearers,
the initial EPS bearer and the default bearer. Device must first establish
the initial bearer (which shows as transition from the "searching" to "registered"
state) and then it connects to a default bearer (transition from "registered" to
"connected"). Both bearers require PDP context settings (APN, ip-type, potentially
username/password, etc.).
Settings for the initial bearer are typically provided by the SIM card while
settings for the default bearer are user-configured.

It is not necessarily the case that the APNs for the initial and the default bearers
are the same. We used to make that assumption but this has led to cases where modem
was failing registration because the APN for the initial bearer was wrong. It is
better to let the SIM card provide the PDP context setting for the initial EPS bearer.
Furthermore, once these settings are changed, there is no straightforward method to
revert back to the SIM-provided configuration; for more details, see the discussion here:
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1490#note_2628804

Users may only need to override SIM-provided settings in rather rare cases: either when
the SIM card has incorrect configuration (we have seen this only once) or when the initial
EPS bearer requires username/password authentication (also uncommon). Despite the rarity
of these cases, these settings should be user-configurable. We will do this later
(requires EVE API and controller changes).
Please note, that the same enhancement was recently implemented in NetworkManager
(used by Ubuntu and other major Linux distributions):
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1915

Signed-off-by: Milan Lenco <[email protected]>
@milan-zededa milan-zededa changed the title wwan: Do not change default bearer config and properly clear unused dedicated bearers wwan: Do not change initial bearer config and properly clear unused default bearers Oct 29, 2024
@milan-zededa milan-zededa marked this pull request as ready for review October 29, 2024 14:42
QCSuper[*] allows to capture raw 2G/3G/4G (and for certain
models also 5G) control-plane radio frames from Qualcomm-based modems.
This can be super useful when troubleshooting registration/connection
establishment issues.

[*] https://github.com/P1sec/QCSuper

Signed-off-by: Milan Lenco <[email protected]>
return err
}
for _, bearerPath := range bearers {
if !bearerPath.IsValid() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so we will keep non-valid bearers?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just checking if the path itself is valid. This should be unreachable because otherwise it means we are getting some nonsense output from ModemManager. I put it there just in case (I have these path validations in multiple places across mmagent).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe then we should just in case log them. If there will be some weird (faulty) modem or ModemManager will go insane. What do you think?

@uncleDecart
Copy link
Member

Do I get it right that you're deleting all default bearers, which are user configured?

@milan-zededa
Copy link
Contributor Author

Do I get it right that you're deleting all default bearers, which are user configured?

Yes correct.

Copy link
Contributor

@eriknordmark eriknordmark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@eriknordmark eriknordmark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Run eden again

@milan-zededa
Copy link
Contributor Author

There seems to be some problem with onboarding and also pull limit was reached. I will retry and investigate tomorrow.

@uncleDecart
Copy link
Member

Do I get it right that you're deleting all default bearers, which are user configured?

Yes correct.

Then what's the point of specifying default bearers?

But if a user has a contract with a big telco, I'd assume one way they will have connectivity through some credentials that they will be supplying to a modem. Maybe I'm not following the logic, but then the scenario is following :

  1. I'm using my modem with default bearer to login into network, I mean I might use an operator which uses other's telco towers, so I need that particular default bearer
  2. Then once I'm logged in you're deleting the default bearers that I specified
  3. Modem tries to communicate with telco, not with my overlay credentials and therefore there's no connectivity

@milan-zededa
Copy link
Contributor Author

milan-zededa commented Oct 31, 2024

Do I get it right that you're deleting all default bearers, which are user configured?

Yes correct.

Then what's the point of specifying default bearers?

But if a user has a contract with a big telco, I'd assume one way they will have connectivity through some credentials that they will be supplying to a modem. Maybe I'm not following the logic, but then the scenario is following :

1. I'm using my modem with default bearer to login into network, I mean I might use an operator which uses other's telco towers, so I need that particular default bearer

2. Then once I'm logged in you're deleting the default bearers that I specified

3. Modem tries to communicate with telco, not with my overlay credentials and therefore there's no connectivity

What you are referring to is the "initial EPS bearer", with parameters embedded in the SIM card / modem. We do not touch this bearer here (if it is connected, it stays connect even after this method). Default bearer is what user configured through zedcloud. We do not support multiple PDN contexts at the moment, so there will be at most one default bearer active at any time. I noticed that the ModemManager Disconnect method only deactivates the currently active bearer, without removing it. When we run Connect (with the same or changed args), ModemManager looks for the same (inactive) bearer and tries to activate it. However, I have seen this to fail in the past in multiple occasions. It was necessary to delete inactive default bearer(s) and let ModemManager to create a new one from scratch. So I'm thinking that is maybe better to not keep inactive bearers hanging around. But I could be wrong on this and there is no documentation on "how to do this the right way", it is mostly driven by experiments :/

@milan-zededa
Copy link
Contributor Author

We are still seeing some issues on the modem tested, so I'm bringing this back to Draft. I really don't like these cellular modems :/

@milan-zededa milan-zededa marked this pull request as draft October 31, 2024 14:53
@milan-zededa
Copy link
Contributor Author

We have some positive updates from the issue reporter. It seems that soon this PR will be moved back into the ready-for-review state. Stay tuned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stable Should be backported to stable release(s)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants