From 1ae142d7d11862b11a6e0cea06562875cc778ae7 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Wed, 27 Apr 2022 20:43:05 +0200 Subject: [PATCH] luci-mod-network: diagnostics: peg max traceroute hops to rpc timeout In the worst case, traceroute might take up to 30s to complete when tracing a completely unreachable path, due to the default limit of 30 hops multiplied by the per-hop deadline of 1 second (-w 1). Limit the maximum amount of hops to the configured rpc execution timeout, 20 second by default, in order to avoid running into timed out rpc requests. Fixes: #5782 Signed-off-by: Jo-Philipp Wich --- .../htdocs/luci-static/resources/view/network/diagnostics.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/diagnostics.js b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/diagnostics.js index 50ab6ef77c..da7cd95bdc 100644 --- a/modules/luci-mod-network/htdocs/luci-static/resources/view/network/diagnostics.js +++ b/modules/luci-mod-network/htdocs/luci-static/resources/view/network/diagnostics.js @@ -29,7 +29,7 @@ return view.extend({ handlePing: function(ev, cmd) { var exec = cmd || 'ping', addr = ev.currentTarget.parentNode.previousSibling.value, - args = (exec == 'ping') ? [ '-4', '-c', '5', '-W', '1', addr ] : [ '-c', '5', addr ]; + args = (exec == 'ping') ? [ '-4', '-c', '5', '-W', '1', addr ] : [ '-6', '-c', '5', addr ]; return this.handleCommand(exec, args); }, @@ -37,7 +37,7 @@ return view.extend({ handleTraceroute: function(ev, cmd) { var exec = cmd || 'traceroute', addr = ev.currentTarget.parentNode.previousSibling.value, - args = (exec == 'traceroute') ? [ '-4', '-q', '1', '-w', '1', '-n', addr ] : [ '-q', '1', '-w', '2', '-n', addr ]; + args = (exec == 'traceroute') ? [ '-4', '-q', '1', '-w', '1', '-n', '-m', String(L.env.rpctimeout || 20), addr ] : [ '-q', '1', '-w', '2', '-n', addr ]; return this.handleCommand(exec, args); }, -- 2.30.2