From: Jo-Philipp Wich Date: Wed, 27 Apr 2022 18:43:05 +0000 (+0200) Subject: luci-mod-network: diagnostics: peg max traceroute hops to rpc timeout X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=1ae142d7d11862b11a6e0cea06562875cc778ae7;p=project%2Fluci.git 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 --- 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); },