modemmanager: rework initial EPS bearer modes

Commit 246506690f ("modemmanager: always reset the init_eps if not
configured") changed the behaviour for an unset 'init_epsbearer' from
leaving the modem untouched to clearing the initial EPS bearer on every
setup. This is a regression for users upgrading from 24.10:

- Modems without support for setting the LTE attach configuration (e.g.
  Sierra Wireless EM7430) fail the setup with
  MM_INIT_EPS_BEARER_SET_FAILED and never come up.
- Attach settings preloaded by the carrier firmware are wiped.

The same commit also removed the explicit 'none' case, so 'none' now
silently skips the initial EPS bearer setup, while it cleared it in
24.10. Neither matches the documentation.

Make all modes explicit, each naming where the initial EPS bearer
settings come from:

- modem:      leave the settings stored on the modem unchanged (default)
- network:    set an empty initial EPS bearer, the network assigns the
              APN; replaces the implicit clear, e.g. after a SIM swap
- connection: use the connection options (apn, iptype, ...)
- custom:     use the init_* options

'none' and 'default' are kept as deprecated aliases for 'modem' and
'connection'. 'none' maps to 'modem' as documented in the README and as
it behaves since 246506690f, although an explicit 'none' cleared the
initial EPS bearer in 24.10; use 'network' for that. Unknown values fall
back to 'modem'. The README now documents the modes and how to clear
stale settings manually.

Fixes: https://github.com/openwrt/packages/issues/30299
Signed-off-by: Michael Pfeifroth <micpf@westermo.com>
This commit is contained in:
Michael Pfeifroth authored and Florian Eckert committed 2026-10-05 11:12:07 +02:00
1 parent 3f87f7ae83
commit ab97fcad72
3 files changed
+72 -56

No files matched your search

+1 -1
View File
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=modemmanager
PKG_VERSION:=1.24.0
PKG_RELEASE:=15
PKG_RELEASE:=16
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://gitlab.freedesktop.org/mobile-broadband/ModemManager.git
+23 -14
View File
@@ -27,7 +27,7 @@ Once installed, you can configure the 2G/3G/4G modem connections directly in
option signalrate '30'
option allow_roaming '1'
option force_connection '1'
option init_epsbearer '<none|default|custom>'
option init_epsbearer '<modem|network|connection|custom>'
option timeout '120'
Only 'device' and 'proto' are mandatory options, the remaining ones are all
@@ -56,16 +56,25 @@ The 'force_connection' option is designed to ensure that the modem automatically
attempts to reconnect regardless of any errors encountered during the
connection process.
If there is no Circuit switch network available, then an initial EPS
bearer must be set, so this could be used during the network registration
process in 4G and 5G network. For this resaon a new configuration option
'init_epsbearer' was added, which could have the following values.
* none: Do not set an initial EPS bearer (default)
* default: Use the configuration option 'apn', 'iptype', 'allowedauth',
'username' and 'password' for setting the initial EPS bearer.
These are the same options as when establishing a connection.
* custom: This could be used to use diffrent options when establishing a
connection. The options are prefixed with an 'init'. So we have
the following options 'init_apn', 'init_iptype',
'init_allowedauth', 'init_username' and 'init_password' for
setting the initial EPS bearer.
On 4G and 5G networks, the modem attaches to the network with an initial
EPS bearer, before the data connection is established. The 'init_epsbearer'
option selects where the settings for this initial EPS bearer come from:
* modem: Leave the initial EPS bearer settings stored on the modem
unchanged (default). These are usually provided by the carrier
firmware or set by a previous configuration.
* network: Set an empty initial EPS bearer, so the network assigns the APN.
Use this to override settings left on the modem, e.g. after
swapping the SIM card.
* connection: Use the options 'apn', 'iptype', 'allowedauth', 'username' and
'password', the same options as for the data connection.
* custom: Use separate options, prefixed with 'init_': 'init_apn',
'init_iptype', 'init_allowedauth', 'init_username' and
'init_password'.
The values 'none' and 'default' are deprecated aliases for 'modem' and
'connection'.
The initial EPS bearer settings stored on the modem can also be cleared once
manually:
mmcli -m <modem> --3gpp-set-initial-eps-bearer-settings=""
@@ -530,10 +530,10 @@ modemmanager_init_epsbearer() {
local apn="$4"
local timeout="$5"
if [ "$eps" = "none" ]; then
echo "Deleting inital EPS bearer"
if [ "$eps" = "network" ]; then
echo "Setting network-assigned initial EPS bearer"
else
echo "Setting '$eps' inital EPS bearer apn to '$apn'"
echo "Setting '$eps' initial EPS bearer apn to '$apn'"
fi
mmcli --modem="${device}" \
@@ -629,44 +629,51 @@ proto_modemmanager_setup() {
}
# set initial eps bearer settings
if [ -z "${init_epsbearer}" ]; then
modemmanager_init_epsbearer "none" "$device" "" "$apn" "${timeout}"
else
case "$init_epsbearer" in
"default")
cliauth=""
for auth in $allowedauth; do
cliauth="${cliauth}${cliauth:+|}$auth"
done
connectargs=""
append_param "apn=${apn}"
append_param "${iptype:+ip-type=${iptype}}"
append_param "${cliauth:+allowed-auth=${cliauth}}"
append_param "${username:+user=${username}}"
append_param "${password:+password=${password}}"
modemmanager_init_epsbearer "default" \
"$device" "${connectargs}" "$apn" \
"${timeout}"
;;
"custom")
cliauth=""
for auth in $init_allowedauth; do
cliauth="${cliauth}${cliauth:+|}$auth"
done
connectargs=""
append_param "apn=${init_apn}"
append_param "${init_iptype:+ip-type=${init_iptype}}"
append_param "${cliauth:+allowed-auth=${cliauth}}"
append_param "${init_username:+user=${init_username}}"
append_param "${init_password:+password=${init_password}}"
modemmanager_init_epsbearer "custom" \
"$device" "${connectargs}" "$init_apn" \
"${timeout}"
;;
esac
# check error for init_epsbearer function call
[ "$?" -ne "0" ] && return 1
fi
case "${init_epsbearer:-modem}" in
"modem"|"none")
echo "Using initial EPS bearer stored on the modem"
;;
"network")
modemmanager_init_epsbearer "network" \
"$device" "" "" "${timeout}"
;;
"connection"|"default")
cliauth=""
for auth in $allowedauth; do
cliauth="${cliauth}${cliauth:+|}$auth"
done
connectargs=""
append_param "apn=${apn}"
append_param "${iptype:+ip-type=${iptype}}"
append_param "${cliauth:+allowed-auth=${cliauth}}"
append_param "${username:+user=${username}}"
append_param "${password:+password=${password}}"
modemmanager_init_epsbearer "connection" \
"$device" "${connectargs}" "$apn" \
"${timeout}"
;;
"custom")
cliauth=""
for auth in $init_allowedauth; do
cliauth="${cliauth}${cliauth:+|}$auth"
done
connectargs=""
append_param "apn=${init_apn}"
append_param "${init_iptype:+ip-type=${init_iptype}}"
append_param "${cliauth:+allowed-auth=${cliauth}}"
append_param "${init_username:+user=${init_username}}"
append_param "${init_password:+password=${init_password}}"
modemmanager_init_epsbearer "custom" \
"$device" "${connectargs}" "$init_apn" \
"${timeout}"
;;
*)
echo "Unknown init_epsbearer '${init_epsbearer}'," \
"using initial EPS bearer stored on the modem"
;;
esac
# check error for init_epsbearer function call
[ "$?" -ne "0" ] && return 1
if [ -z "${allowedmode}" ]; then
modemmanager_set_allowed_mode "$device" "$interface" "any"