From 36a980469f9d5fc55117b4bf315db9f2d6890115 Mon Sep 17 00:00:00 2001 From: bol-van Date: Thu, 27 Nov 2025 08:47:28 +0300 Subject: [PATCH] zapret-pcap: 'keep' parameter --- lua/zapret-pcap.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lua/zapret-pcap.lua b/lua/zapret-pcap.lua index d205838..687bf58 100644 --- a/lua/zapret-pcap.lua +++ b/lua/zapret-pcap.lua @@ -18,6 +18,7 @@ end -- test case : nfqws2 --qnum 200 --debug --lua-init=@zapret-lib.lua --lua-init=@zapret-pcap.lua --writeable=zdir --in-range=a --lua-desync=pcap:file=test.pcap -- arg : file= - file for storing pcap data. if --writeable is specified and filename is relative - append filename to writeable path +-- arg : keep - do not overwrite file function pcap(ctx, desync) if not desync.arg.file or #desync.arg.file==0 then error("pcap requires 'file' parameter") @@ -26,7 +27,9 @@ function pcap(ctx, desync) if not _G[fn_cache_name] then _G[fn_cache_name] = writeable_file_name(desync.arg.file) -- overwrite file - os.remove(_G[fn_cache_name]) + if not desync.arg.keep then + os.remove(_G[fn_cache_name]) + end end local f = io.open(_G[fn_cache_name], "a") if not f then