summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorViacheslav Hletenko <v.gletenko@vyos.io>2025-12-05 19:59:12 +0200
committerGitHub <noreply@github.com>2025-12-05 19:59:12 +0200
commit477ada14a4cfb682ef2cc611b82296dbda420baf (patch)
treea39e06f3dabdf7f868f77e98617c187711100b57
parent6795f106a581489148bffb61fdeb067ff81d2fe0 (diff)
parent8653844687467bd11ce73e6cada8a939db5c0436 (diff)
downloadvyos-1x-477ada14a4cfb682ef2cc611b82296dbda420baf.tar.gz
vyos-1x-477ada14a4cfb682ef2cc611b82296dbda420baf.zip
Merge pull request #4888 from dmbaturin/T7810-fix-pppoe-reset
op-mode: T7810: fix broken 'reset connection' command
-rw-r--r--op-mode-definitions/reset-connection.xml.in2
-rwxr-xr-xsrc/op_mode/connect_disconnect.py24
2 files changed, 15 insertions, 11 deletions
diff --git a/op-mode-definitions/reset-connection.xml.in b/op-mode-definitions/reset-connection.xml.in
index e41d8ed20..a3c45d421 100644
--- a/op-mode-definitions/reset-connection.xml.in
+++ b/op-mode-definitions/reset-connection.xml.in
@@ -11,7 +11,7 @@
<path>interfaces wwan</path>
</completionHelp>
</properties>
- <command>${vyos_op_scripts_dir}/connect_disconnect.py --connect --disconnect --interface "$3"</command>
+ <command>${vyos_op_scripts_dir}/connect_disconnect.py --reconnect --interface "$3"</command>
</tagNode>
</children>
</node>
diff --git a/src/op_mode/connect_disconnect.py b/src/op_mode/connect_disconnect.py
index 117e65713..d5db85d25 100755
--- a/src/op_mode/connect_disconnect.py
+++ b/src/op_mode/connect_disconnect.py
@@ -98,19 +98,23 @@ def main():
group = parser.add_mutually_exclusive_group()
group.add_argument("--connect", help="Bring up a connection-oriented network interface", action="store_true")
group.add_argument("--disconnect", help="Take down connection-oriented network interface", action="store_true")
+ group.add_argument("--reconnect", help="Reconnect connection-oriented network interface", action="store_true")
parser.add_argument("--interface", help="Interface name", action="store", required=True)
args = parser.parse_args()
- if args.connect or args.disconnect:
- if args.disconnect:
- disconnect(args.interface)
-
- if args.connect:
- if commit_in_progress():
- print('Cannot connect while a commit is in progress')
- exit(1)
- connect(args.interface)
-
+ # Disallow connecting interfaces while their configuration might be changing
+ if args.connect or args.reconnect:
+ if commit_in_progress():
+ print('Cannot connect while a commit is in progress')
+ exit(1)
+
+ if args.connect:
+ connect(args.interface)
+ elif args.disconnect:
+ disconnect(args.interface)
+ elif args.reconnect:
+ disconnect(args.interface)
+ connect(args.interface)
else:
parser.print_help()