summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorAdam Smith <adamsmith@yzguy.io>2026-09-30 05:18:14 +0000
committerAdam Smith <adamsmith@yzguy.io>2026-09-30 06:30:41 +0000
commit5299606d0e6adf5f522cc6cbfb35ea39fc138bb4 (patch)
tree51697ce3b21136f1a42b08b7520bed789260be9d /python
parent888bc31365e22b4f04ac0a8692406c83d0b6d074 (diff)
downloadvyos-1x-5299606d0e6adf5f522cc6cbfb35ea39fc138bb4.tar.gz
vyos-1x-5299606d0e6adf5f522cc6cbfb35ea39fc138bb4.zip
wwan: T9326: always pre-negotiate the attach-time PDN type before connect
modem_connect() only ran the --3gpp-set-initial-eps-bearer-settings pre-step (added by T9326) when the requested ip-type included IPv6, gated on options.partition('ip-type=')[2].partition(',')[0] in ('ipv6', 'ipv4v6'). A bare 'ipv4' request skipped it entirely. Confirmed live (same MC7455/Google Fi setup as T9326's original report) that the underlying ip-version-mismatch rejection isn't IPv6-specific: with the attach committed to ip-type=ipv6, a bare ip-type=ipv4 --simple-connect fails outright with the same QMI CallEndReason, not just the ipv4v6 case's silent single-family drop. A WWAN interface whose configured address family changes (e.g. dropping dhcpv6 down to dhcp-only) can hit exactly this, and won't self-heal on retry since nothing about a failed connect touches the attach-committed PDN type - vyos-netlinkd's reconcile loop would back off and retry the identical failing request forever. Removed the gate entirely: the pre-step already fails silently and falls through unchanged on a modem/network that doesn't need it, so there's no reason to skip it for any particular family.
Diffstat (limited to 'python')
-rw-r--r--python/vyos/utils/wwan.py27
1 files changed, 10 insertions, 17 deletions
diff --git a/python/vyos/utils/wwan.py b/python/vyos/utils/wwan.py
index 8ee6a5a9a..cf7d7b143 100644
--- a/python/vyos/utils/wwan.py
+++ b/python/vyos/utils/wwan.py
@@ -236,23 +236,16 @@ def modem_connect(ifname: str, options: str) -> bool:
if modem is None:
return False
- # Some networks only ever admit a single combined IPv4+IPv6 PDN context per
- # APN and reject a standalone IPv6 "Start Network" request outright (QMI
- # CallEndReason ip-version-mismatch) once an IPv4 session already exists for
- # that APN. ModemManager's --simple-connect with ip-type=ipv4v6 opens two
- # separate WDS sessions (one per family) rather than negotiating both
- # together, which is what a normal handset attach does and why this is
- # invisible on most other devices.
- #
- # Pre-negotiating the attach-time PDN type upfront avoids the rejection; the
- # resulting bearer only sets up what the *next* --simple-connect is allowed
- # to request and can't be connected directly, so a failure here isn't fatal
- # - unsupported modems simply proceed to --simple-connect exactly as before.
- if options.partition('ip-type=')[2].partition(',')[0] in ('ipv6', 'ipv4v6'):
- # best effort by definition, so do not report the rejection a modem
- # without attach configuration support answers with on every dial
- call(f'mmcli --modem {modem} --3gpp-set-initial-eps-bearer-settings="{options}"',
- stdout=DEVNULL, stderr=DEVNULL)
+ # A network only commits to one PDN type per APN at attach time, and
+ # rejects any later --simple-connect for a family that doesn't match it
+ # (QMI ip-version-mismatch, T9326) - pre-negotiating it here avoids that.
+ # The resulting bearer can't be connected directly, so a failure here
+ # isn't fatal - unsupported modems just proceed to --simple-connect.
+ call(
+ f'mmcli --modem {modem} --3gpp-set-initial-eps-bearer-settings="{options}"',
+ stdout=DEVNULL,
+ stderr=DEVNULL,
+ )
command = f'mmcli --modem {modem} --simple-connect="{options}"'
return call(command, stdout=DEVNULL) == 0