summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNataliia Solomko <natalirs1985@gmail.com>2026-05-22 16:54:27 +0300
committerNataliia Solomko <natalirs1985@gmail.com>2026-05-22 16:54:27 +0300
commit8a537e8097ac80c696299d267e1dd1c9b6000bab (patch)
treed2d60846907cd5643911160a9b668ffe0f72cc4f
parent88b93c96faa5b1016546cbc15d1327b4692a87cc (diff)
downloadvyos-1x-8a537e8097ac80c696299d267e1dd1c9b6000bab.tar.gz
vyos-1x-8a537e8097ac80c696299d267e1dd1c9b6000bab.zip
wwan: T8412: Fix commit failure when modem is absent or not connected
`mmcli --simple-disconnect` can be called when the modem bearer is not active. This causes cmd() to raise a `PermissionError` and abort the commit. Handle the case gracefully so the configuration can be committed before the modem is physically present or fully connected.
-rw-r--r--python/vyos/ifconfig/wwan.py4
-rw-r--r--python/vyos/utils/network.py6
-rwxr-xr-xsrc/conf_mode/interfaces_wwan.py8
3 files changed, 16 insertions, 2 deletions
diff --git a/python/vyos/ifconfig/wwan.py b/python/vyos/ifconfig/wwan.py
index 2b5714b85..ffd3d0a67 100644
--- a/python/vyos/ifconfig/wwan.py
+++ b/python/vyos/ifconfig/wwan.py
@@ -26,6 +26,10 @@ class WWANIf(Interface):
},
}
+ def _create(self):
+ # we can not create this interface as it is managed by the Kernel
+ pass
+
def remove(self):
"""
Remove interface from config. Removing the interface deconfigures all
diff --git a/python/vyos/utils/network.py b/python/vyos/utils/network.py
index f20450a5f..8985224f3 100644
--- a/python/vyos/utils/network.py
+++ b/python/vyos/utils/network.py
@@ -238,7 +238,11 @@ def is_wwan_connected(interface):
modem = interface.lstrip('wwan')
- tmp = cmd(f'mmcli --modem {modem} --output-json')
+ try:
+ tmp = cmd(f'mmcli --modem {modem} --output-json')
+ except OSError:
+ return False
+
tmp = loads(tmp)
# return True/False if interface is in connected state
diff --git a/src/conf_mode/interfaces_wwan.py b/src/conf_mode/interfaces_wwan.py
index 166b857a8..ad6c806ad 100755
--- a/src/conf_mode/interfaces_wwan.py
+++ b/src/conf_mode/interfaces_wwan.py
@@ -149,9 +149,15 @@ def apply(wwan):
modem = wwan['ifname'].lstrip('wwan')
base_cmd = f'mmcli --modem {modem}'
# Number of bearers is limited - always disconnect first
- cmd(f'{base_cmd} --simple-disconnect')
+ call(f'{base_cmd} --simple-disconnect')
w = WWANIf(wwan['ifname'])
+
+ # We cannot proceed with the configuration if the modem is not detected - so we bail out
+ # and wait for the next cronjob run to re-apply the configuration.
+ if not w.exists(wwan['ifname']):
+ return None
+
if 'deleted' in wwan or 'disable' in wwan:
w.remove()