summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2026-11-07 22:14:15 +0100
committerChristian Breunig <christian@breunig.cc>2026-11-07 22:19:52 +0100
commit5da28d873cfbf41c56c3e6cb04154022456b5e32 (patch)
tree95a9ff86bc5c6a86da19b7f4fece3102da28b601 /python
parent1f1257d7eea71978210daa03a857a21f9ffb32ea (diff)
downloadvyos-1x-5da28d873cfbf41c56c3e6cb04154022456b5e32.tar.gz
vyos-1x-5da28d873cfbf41c56c3e6cb04154022456b5e32.zip
wwan: T9388: drop a stale DHCP router once a static bearer applies
An interface with "address dhcp" contributes a DHCP default route next to the one of its static bearer. The DHCP one is built from the router of the last lease event, which is only cleared by a STOP event. A client which ended up failed never sends one, so a router from an earlier lease added a second default route towards a stale gateway. The record of the last lease event is now removed when a static bearer takes over IPv4.
Diffstat (limited to 'python')
-rw-r--r--python/vyos/ifconfig/wwan.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/python/vyos/ifconfig/wwan.py b/python/vyos/ifconfig/wwan.py
index 8dd10b60d..c43f05c37 100644
--- a/python/vyos/ifconfig/wwan.py
+++ b/python/vyos/ifconfig/wwan.py
@@ -13,8 +13,11 @@
# You should have received a copy of the GNU Lesser General Public
# License along with this library. If not, see <http://www.gnu.org/licenses/>.
+import os
+
from json import loads
+from vyos.defaults import directories
from vyos.ifconfig.interface import Interface
from vyos.utils.dict import dict_search
from vyos.utils.misc import wait_for
@@ -292,6 +295,12 @@ class WWANIf(Interface):
pass
if family == 'ipv4':
self.set_dhcp(False)
+ # A client which ended without a STOP event leaves the router of
+ # its last lease behind, and FRR would install a second default
+ # route towards it
+ lease = directories['isc_dhclient_dir'] + f'/dhclient_{self.ifname}.lease'
+ if os.path.exists(lease):
+ os.remove(lease)
else:
self.set_dhcpv6(False)