cmd_trace: limit maximum file size to 25% of free mem

Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
John Crispin
2022-10-27 16:49:03 +02:00
parent f941f47057
commit 9968cb6688

View File

@@ -27,10 +27,12 @@ if (!match(args.interface, /^[^\/]+$/) || (args.interface != "any" && !fs.stat("
let duration = +args.duration || 0;
let packets = +args.packets || 0;
let filename = sprintf("/tmp/pcap-%s-%d", serial, time());
let sys = ctx.call('system', 'info');
let command = [
'tcpdump_timeout',
duration,
'-C', sys.memory.free / 4,
'-W', '1',
'-w', filename,
'-i', args.interface